REFACTOR SOON

This commit is contained in:
Evil Factory
2021-02-15 11:11:59 -03:00
parent 585a629c6f
commit 318333f466
3 changed files with 97 additions and 13 deletions
@@ -2395,7 +2395,7 @@ namespace Barotrauma.Networking
{
if (!(GameMain.GameSession?.GameMode is CampaignMode))
{
if (!GameMain.Lua.overrideTraitors)
if (!GameMain.Lua.game.overrideTraitors)
{
TraitorManager = new TraitorManager();
TraitorManager.Start(this);
@@ -84,6 +84,10 @@ namespace Barotrauma.Networking
private bool ShouldStartRespawnCountdown(int characterToRespawnCount)
{
if (GameMain.Lua.game.overrideRespawnSub)
{
characterToRespawnCount = 0;
}
int totalCharacterCount = GameMain.Server.ConnectedClients.Count;
return (float)characterToRespawnCount >= Math.Max((float)totalCharacterCount * GameMain.Server.ServerSettings.MinRespawnRatio, 1.0f);
}
@@ -125,11 +129,18 @@ namespace Barotrauma.Networking
}
}
private void DispatchShuttle()
public void DispatchShuttle()
{
if (RespawnShuttle != null)
{
CurrentState = State.Transporting;
if (GameMain.Lua.game.overrideRespawnSub)
{
CurrentState = State.Waiting;
}
else
{
CurrentState = State.Transporting;
}
GameMain.Server.CreateEntityEvent(this);
ResetShuttle();
@@ -142,7 +153,11 @@ namespace Barotrauma.Networking
GameServer.Log("Dispatching the respawn shuttle.", ServerLog.MessageType.Spawning);
Vector2 spawnPos = FindSpawnPos();
RespawnCharacters(spawnPos);
if (!GameMain.Lua.game.overrideRespawnSub)
{
RespawnCharacters(spawnPos);
}
CoroutineManager.StopCoroutines("forcepos");
if (spawnPos.Y > Level.Loaded.Size.Y)