Class enum instead of hardcoded ints.

Removed superfluous .Valid() checks.

Check for spectator spawnrequest in case they somehow has a class, so we don't get "x players were supposed to be spawned but failed" if it happens.
This commit is contained in:
William Moberg
2016-03-09 11:35:32 +01:00
parent b782e73556
commit 534d6639e5
4 changed files with 29 additions and 19 deletions
+2 -2
View File
@@ -35,7 +35,7 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
//components that we need from player
auto playerModel = player.FirstChildByName("PlayerModel");
if (!playerModel.Valid() || !playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
if (!playerModel.HasComponent("Model") || !playerModel.HasComponent("Animation")) {
if (player == LocalPlayer) {
setSpectatorCamera();
}
@@ -82,7 +82,7 @@ void PlayerDeathSystem::setSpectatorCamera()
{
// Look for the spectator camera entity in the level.
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
if (!spectatorCam.Valid() || !spectatorCam.HasComponent("Camera")) {
if (!spectatorCam.HasComponent("Camera")) {
return;
}
Events::SetCamera eSetCamera;