Fix so client doesn't override the servers respawn time with its config file. Server or single player client can still override the component with the config RespawnTime.

This commit is contained in:
William Moberg
2016-03-02 14:37:33 +01:00
parent 06d60f9884
commit 95078b6a4b
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -10,7 +10,7 @@ PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0;
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
}
void PlayerSpawnSystem::Update(double dt)
@@ -26,7 +26,10 @@ void PlayerSpawnSystem::Update(double dt)
// Increase timer.
double& timer = (double&)modeComponent["RespawnTime"];
timer += dt;
double maxRespawnTime = m_DbgConfigForceRespawn ? m_ForcedRespawnTime : (double)modeComponent["MaxRespawnTime"];
if (m_DbgConfigForceRespawn) {
(double&)modeComponent["MaxRespawnTime"] = m_ForcedRespawnTime;
}
double maxRespawnTime = (double)modeComponent["MaxRespawnTime"];
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
if (spectatorCam.Valid()) {
EntityWrapper HUD = spectatorCam.FirstChildByName("SpectatorHUD");