Removed zombie.inc and created a round start core module.

This commit is contained in:
Greyscale 2009-05-19 21:24:43 -07:00
parent d466ab8b24
commit 6e464880f4
4 changed files with 60 additions and 27 deletions

View File

@ -36,6 +36,7 @@
#include "zr/playerclasses/playerclasses" #include "zr/playerclasses/playerclasses"
#include "zr/weapons/weapons" #include "zr/weapons/weapons"
#include "zr/hitgroups" #include "zr/hitgroups"
#include "zr/roundstart"
#include "zr/roundend" #include "zr/roundend"
#include "zr/infect" #include "zr/infect"
#include "zr/damage" #include "zr/damage"
@ -61,9 +62,6 @@
#include "zr/jumpboost" #include "zr/jumpboost"
#include "zr/volfeatures/volfeatures" #include "zr/volfeatures/volfeatures"
// Almost replaced! :)
#include "zr/zombie"
/** /**
* Record plugin info. * Record plugin info.
*/ */

View File

@ -72,6 +72,7 @@ public Action:EventRoundStart(Handle:event, const String:name[], bool:dontBroadc
// Forward event to sub-modules. // Forward event to sub-modules.
OverlaysOnRoundStart(); OverlaysOnRoundStart();
WeaponsOnRoundStart(); WeaponsOnRoundStart();
RoundStartOnRoundStart();
RoundEndOnRoundStart(); RoundEndOnRoundStart();
InfectOnRoundStart(); InfectOnRoundStart();
SEffectsOnRoundStart(); 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) public Action:EventRoundFreezeEnd(Handle:event, const String:name[], bool:dontBroadcast)
{ {
RemoveObjectives();
// Forward events to modules. // Forward events to modules.
RoundEndOnRoundFreezeEnd(); RoundEndOnRoundFreezeEnd();
InfectOnRoundFreezeEnd(); InfectOnRoundFreezeEnd();

58
src/zr/roundstart.inc Normal file
View File

@ -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);
}
}

View File

@ -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);
}
}
}