From 6e464880f40f63e2f00d813036380d58daa4324c Mon Sep 17 00:00:00 2001 From: Greyscale Date: Tue, 19 May 2009 21:24:43 -0700 Subject: [PATCH] Removed zombie.inc and created a round start core module. --- src/zombiereloaded.sp | 4 +-- src/zr/event.inc | 3 +-- src/zr/roundstart.inc | 58 +++++++++++++++++++++++++++++++++++++++++++ src/zr/zombie.inc | 22 ---------------- 4 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 src/zr/roundstart.inc delete mode 100644 src/zr/zombie.inc diff --git a/src/zombiereloaded.sp b/src/zombiereloaded.sp index 69be134..5183cf5 100644 --- a/src/zombiereloaded.sp +++ b/src/zombiereloaded.sp @@ -36,6 +36,7 @@ #include "zr/playerclasses/playerclasses" #include "zr/weapons/weapons" #include "zr/hitgroups" +#include "zr/roundstart" #include "zr/roundend" #include "zr/infect" #include "zr/damage" @@ -61,9 +62,6 @@ #include "zr/jumpboost" #include "zr/volfeatures/volfeatures" -// Almost replaced! :) -#include "zr/zombie" - /** * Record plugin info. */ diff --git a/src/zr/event.inc b/src/zr/event.inc index f9d1e16..6ab6b85 100644 --- a/src/zr/event.inc +++ b/src/zr/event.inc @@ -72,6 +72,7 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc // Forward event to sub-modules. OverlaysOnRoundStart(); WeaponsOnRoundStart(); + RoundStartOnRoundStart(); RoundEndOnRoundStart(); InfectOnRoundStart(); SEffectsOnRoundStart(); @@ -90,8 +91,6 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc */ public Action:EventRoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast) { - RemoveObjectives(); - // Forward events to modules. RoundEndOnRoundFreezeEnd(); InfectOnRoundFreezeEnd(); diff --git a/src/zr/roundstart.inc b/src/zr/roundstart.inc new file mode 100644 index 0000000..ec0a629 --- /dev/null +++ b/src/zr/roundstart.inc @@ -0,0 +1,58 @@ +/* + * ============================================================================ + * + * Zombie:Reloaded + * + * File: roundstart.inc + * Type: Core + * Description: Handles round start actions. + * + * ============================================================================ + */ + +/** + * List of objective entities. + */ +#define ROUNDSTART_OBJECTIVE_ENTITIES "func_bomb_target|func_hostage_rescue|c4|hostage_entity" + +/** + * The round is starting. + */ +RoundStartOnRoundStart() +{ + // Kill all objective entities. + RoundStartKillObjectives(); +} + +/** + * Kills all objective entities. + */ +RoundStartKillObjectives() +{ + decl String:classname[64]; + + // Get max entity count. + new maxentities = GetMaxEntities(); + + // x = entity index. + for (new x = 0; x <= maxentities; x++) + { + // If entity isn't valid, then stop. + if(!IsValidEdict(x)) + { + continue; + } + + // Get valid edict's classname. + GetEdictClassname(x, classname, sizeof(classname)); + + // Check if it matches any objective entities, then stop if it doesn't. + if(StrContains(ROUNDSTART_OBJECTIVE_ENTITIES, classname) == -1) + { + continue; + } + + // Entity is an objective, kill it. + RemoveEdict(x); + } +} \ No newline at end of file diff --git a/src/zr/zombie.inc b/src/zr/zombie.inc deleted file mode 100644 index dba9d8b..0000000 --- a/src/zr/zombie.inc +++ /dev/null @@ -1,22 +0,0 @@ -RemoveObjectives() -{ - decl String:classname[64]; - - new maxentities = GetMaxEntities(); - for (new x = 0; x <= maxentities; x++) - { - if(!IsValidEdict(x)) - { - continue; - } - - GetEdictClassname(x, classname, sizeof(classname)); - if( StrEqual(classname, "func_bomb_target") || - StrEqual(classname, "func_hostage_rescue") || - StrEqual(classname, "c4") || - StrEqual(classname, "hostage_entity")) - { - RemoveEdict(x); - } - } -}