Server now deletes the player on a new player spawn.

This commit is contained in:
stiffly
2016-02-11 23:52:55 +01:00
parent 70f4002d70
commit e24a84c52d
2 changed files with 7 additions and 7 deletions
+4 -5
View File
@@ -71,18 +71,17 @@ bool PlayerSpawnSystem::OnInputCommand(const Events::InputCommand& e)
bool PlayerSpawnSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
{
// When a player is actually spawned (since the actual spawning is handled on the server)
if (!IsClient) {
return false;
}
// Check if a player already exists
// Hack should be moved.
if (m_PlayerEntities.count(e.PlayerID) != 0) {
// TODO: Disallow infinite respawning here
if (m_PlayerEntities[e.PlayerID].Valid()) {
m_World->DeleteEntity(m_PlayerEntities[e.PlayerID].ID);
}
}
if (!IsClient) {
return false;
}
// Store the player for future reference
m_PlayerEntities[e.PlayerID] = e.Player;