// ==========
set g_invasion 0 "Invasion: survive against waves of monsters"
set g_invasion_round_timelimit 120 "maximum time to kill all monsters"
-set g_invasion_warmup 20 "time between waves to prepare for battle"
-set g_invasion_monster_count 20 "number of monsters on first wave (increments)"
-set g_invasion_zombies_only 0 "only spawn zombies"
+set g_invasion_warmup 10 "time between waves to prepare for battle"
+set g_invasion_monster_count 10 "number of monsters on first wave (increments)"
+set g_invasion_zombies_only 1 "only spawn zombies"
round_handler_Init(5, autocvar_g_invasion_warmup, autocvar_g_invasion_round_timelimit);
return 1;
}
+
+ float total_alive_monsters = 0;
+
+ FOR_EACH_MONSTER(head) if(head.health > 0)
+ ++total_alive_monsters;
- if((numspawned + numkilled) < maxspawned)
+ if((total_alive_monsters + numkilled) < maxspawned)
{
if(time >= last_check)
{
return 0;
}
- if(numspawned < 1 || numkilled < numspawned)
+ if(numspawned < 1 || numkilled < maxspawned)
return 0; // nothing has spawned yet, or there are still alive monsters
if(roundcnt >= maxrounds)
float numplayers = 0;
FOR_EACH_PLAYER(e)
{
- ++numplayers;
e.player_blocked = 0;
+ ++numplayers;
}
roundcnt += 1;
MUTATOR_HOOKFUNCTION(invasion_PlayerDamage)
{
- if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target))
+ if(IS_PLAYER(frag_attacker) && IS_PLAYER(frag_target) && frag_attacker != frag_target)
{
frag_damage = 0;
frag_force = '0 0 0';
}
- if(frag_attacker.flags & FL_MONSTER && frag_target.flags & FL_MONSTER)
+ if(frag_attacker.flags & FL_MONSTER && frag_target.flags & FL_MONSTER && frag_attacker != frag_target)
frag_damage = 0;
return FALSE;
}
+MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
+{
+ if(MUTATOR_RETURNVALUE) // command was already handled?
+ return FALSE;
+
+ if(cmd_name == "debuginvasion")
+ {
+ sprint(self, strcat("maxspawned = ", ftos(maxspawned), "\n"));
+ sprint(self, strcat("numspawned = ", ftos(numspawned), "\n"));
+ sprint(self, strcat("numkilled = ", ftos(numkilled), "\n"));
+ sprint(self, strcat("roundcnt = ", ftos(roundcnt), "\n"));
+ sprint(self, strcat("monsters_total = ", ftos(monsters_total), "\n"));
+ sprint(self, strcat("monsters_killed = ", ftos(monsters_killed), "\n"));
+
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
void invasion_ScoreRules()
{
ScoreRules_basics(0, SFL_SORT_PRIO_SECONDARY, 0, FALSE);
allowed_to_spawn = TRUE;
- monster_skill = 0.01;
+ monster_skill = 0;
roundcnt = 0;
}
MUTATOR_HOOK(PlayerPreThink, invasion_PlayerThink, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, invasion_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerDamage_Calculate, invasion_PlayerDamage, CBC_ORDER_ANY);
+ MUTATOR_HOOK(SV_ParseClientCommand, invasion_PlayerCommand, CBC_ORDER_ANY);
MUTATOR_ONADD
{