From a1aebe5ca51304f36560bc4aad4cd7e43dd49e43 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Wed, 20 May 2009 19:15:55 -0700 Subject: [PATCH] Removed all non-forwarding code from events.inc and moved to appropriate modules. --- src/zr/event.inc | 28 +++------------------------- src/zr/infect.inc | 10 ++++++++++ src/zr/overlays.inc | 11 +++++++++++ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/zr/event.inc b/src/zr/event.inc index 6ab6b85..7e22b7d 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -153,32 +153,10 @@ public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroad // Get all required event info. new index = GetClientOfUserId(GetEventInt(event, "userid")); - // Reset FOV and overlay. - ToolsSetClientDefaultFOV(index, 90); - ClientCommand(index, "r_screenoverlay \"\""); - - // Check if client is on a team. - if (ZRIsClientOnTeam(index)) - { - // Turn off nightvision. - ToolsClientNightVision(index, false, false); - - // Take nightvision away. - ToolsClientNightVision(index, false); - - if (g_bZombieSpawned) - { - if (ZRIsClientOnTeam(index, CS_TEAM_T)) - { - CS_SwitchTeam(index, CS_TEAM_CT); - CS_RespawnPlayer(index); - } - } - } - // Forward event to modules. - InfectOnClientSpawn(index); - ClassOnClientSpawn(index); // Module event depends on infect module. + InfectOnClientSpawn(index); // Multiple modules depend on this to finish first. + OverlaysOnClientSpawn(index); + ClassOnClientSpawn(index); RestrictOnClientSpawn(index); SEffectsOnClientSpawn(index); AccountOnClientSpawn(index); diff --git a/src/zr/infect.inc b/src/zr/infect.inc index d57406d..7cd86a2 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -213,6 +213,16 @@ InfectOnClientSpawn(client) { // Disable zombie flag on client. bZombie[client] = false; + + // Check if client is spawning on the terrorist team. + if (ZRIsClientOnTeam(client, CS_TEAM_T)) + { + if (g_bZombieSpawned) + { + CS_SwitchTeam(client, CS_TEAM_CT); + CS_RespawnPlayer(client); + } + } } /** Client has been hurt. diff --git a/src/zr/overlays.inc b/src/zr/overlays.inc index 477eb18..f9b129a 100644 --- a/src/zr/overlays.inc +++ b/src/zr/overlays.inc @@ -129,6 +129,17 @@ public OverlaysQueryClientDXLevel(QueryCookie:cookie, client, ConVarQueryResult: g_iOverlaysDXL[client] = StringToInt(cvarValue); } +/** + * Client is spawning into the game. + * + * @param client The client index. + */ +OverlaysOnClientSpawn(client) +{ + // Update overlay. + OverlaysClientUpdateOverlay(client); +} + /** * The round is starting. */