-void spawnfunc_invasion_spawnpoint()
+#include "gamemode_invasion.qh"
+#include "../_all.qh"
+
+#include "gamemode.qh"
+
+#include "../../common/monsters/spawn.qh"
+#include "../../common/monsters/sv_monsters.qh"
+
+spawnfunc(invasion_spawnpoint)
{
if(!g_invasion) { remove(self); return; }
float invasion_PickMonster(float supermonster_count)
{
if(autocvar_g_invasion_zombies_only)
- return MON_ZOMBIE;
+ return MON_ZOMBIE.monsterid;
float i;
entity mon;
if(spawn_point == world)
{
- dprint("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations\n");
+ LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations\n");
entity e = spawn();
setsize(e, (get_monsterinfo(mon)).mins, (get_monsterinfo(mon)).maxs);
}
else
monster = spawnmonster("", ((spawn_point.monsterid) ? spawn_point.monsterid : mon), spawn_point, spawn_point, spawn_point.origin, false, false, 2);
-
+
if(spawn_point) monster.target2 = spawn_point.target2;
monster.spawnshieldtime = time;
if(spawn_point && spawn_point.target_range) monster.target_range = spawn_point.target_range;
-
+
if(teamplay)
if(spawn_point && spawn_point.team && inv_monsters_perteam[spawn_point.team] > 0)
monster.team = spawn_point.team;
if(inv_monsters_perteam[NUM_TEAM_2] > 0) RandomSelection_Add(world, NUM_TEAM_2, string_null, 1, 1);
if(invasion_teams >= 3) if(inv_monsters_perteam[NUM_TEAM_3] > 0) { RandomSelection_Add(world, NUM_TEAM_3, string_null, 1, 1); }
if(invasion_teams >= 4) if(inv_monsters_perteam[NUM_TEAM_4] > 0) { RandomSelection_Add(world, NUM_TEAM_4, string_null, 1, 1); }
-
+
monster.team = RandomSelection_chosen_float;
}
-
+
if(teamplay)
{
monster_setupcolors(monster);
-
+
if(monster.sprite)
{
WaypointSprite_UpdateTeamRadar(monster.sprite, RADARICON_DANGER, ((monster.team) ? Team_ColorRGB(monster.team) : '1 0 0'));
monster.sprite.SendFlags |= 1;
}
}
-
+
monster.monster_attack = false; // it's the player's job to kill all the monsters
if(inv_roundcnt >= inv_maxrounds)
if(round_handler_GetEndTime() > 0 && round_handler_GetEndTime() - time <= 0)
{
FOR_EACH_MONSTER(head)
- monster_remove(head);
+ Monster_Remove(head);
Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_ROUND_OVER);
Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_ROUND_OVER);
if(inv_numspawned < 1)
return 0; // nothing has spawned yet
-
+
if(teamplay)
{
if(((red_alive > 0) + (blue_alive > 0) + (yellow_alive > 0) + (pink_alive > 0)) > 1)
if(pink_alive > 0)
if(winner_team) { winner_team = 0; }
else { winner_team = NUM_TEAM_4; }
- }
+ }
else
FOR_EACH_PLAYER(head)
{
}
FOR_EACH_MONSTER(head)
- monster_remove(head);
+ Monster_Remove(head);
if(teamplay)
{
}
MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
-{
+{SELFPARAM();
if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
{
inv_numkilled += 1;
}
MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
-{
+{SELFPARAM();
if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
return true;
self.monster_skill = inv_monsterskill;
if((get_monsterinfo(self.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER)
- Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, M_NAME(self.monsterid));
+ Send_Notification(NOTIF_ALL, world, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, self.monster_name);
self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_BOTCLIP | DPCONTENTS_MONSTERCLIP;
}
MUTATOR_HOOKFUNCTION(invasion_OnEntityPreSpawn)
-{
+{SELFPARAM();
if(startsWith(self.classname, "monster_"))
if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
return true;
-
+
return false;
}
}
MUTATOR_HOOKFUNCTION(invasion_PlayerSpawn)
-{
+{SELFPARAM();
self.bot_attack = false;
return false;
}
}
MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE) // command was already handled?
return false;
MUTATOR_HOOKFUNCTION(invasion_BotShouldAttack)
{
- if(!(checkentity.flags & FL_MONSTER))
+ if(!IS_MONSTER(checkentity))
return true;
-
+
return false;
}
MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
{
- if(frag_target.flags & FL_MONSTER)
+ if(IS_MONSTER(frag_target))
return MUT_ACCADD_INVALID;
return MUT_ACCADD_INDIFFERENT;
}
invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
else
invasion_teams = 0;
-
+
independent_players = 1; // to disable extra useless scores
invasion_ScoreRules(invasion_teams);
void invasion_Initialize()
{
if(autocvar_g_invasion_zombies_only)
- MON_ACTION(MON_ZOMBIE, MR_PRECACHE);
+ MON_ACTION(MON_ZOMBIE.monsterid, MR_PRECACHE);
else
{
float i;
MON_ACTION(i, MR_PRECACHE);
}
}
-
+
InitializeEntity(world, invasion_DelayedInit, INITPRIO_GAMETYPE);
}
MUTATOR_ONREMOVE
{
- print("This is a game type and it cannot be removed at runtime.");
+ LOG_INFO("This is a game type and it cannot be removed at runtime.");
return -1;
}