]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_invasion.qc
Merge branch 'master' into TimePath/unified_weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_invasion.qc
index 9870c8801f5ccb6750244d23cffd7b2929ac6814..5209b225f1084629f085a6cf65b9cc0b86ef7a22 100644 (file)
@@ -6,21 +6,23 @@
 #include "../../common/monsters/spawn.qh"
 #include "../../common/monsters/sv_monsters.qh"
 
-void spawnfunc_invasion_spawnpoint()
+spawnfunc(invasion_spawnpoint)
 {
        if(!g_invasion) { remove(self); return; }
 
        self.classname = "invasion_spawnpoint";
 
        if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already
-       if(self.monsterid)
-               MON_ACTION(self.monsterid, MR_PRECACHE);
+       if(self.monsterid) {
+               Monster mon = get_monsterinfo(self.monsterid);
+               mon.mr_precache(mon);
+       }
 }
 
 float invasion_PickMonster(float supermonster_count)
 {
        if(autocvar_g_invasion_zombies_only)
-               return MON_ZOMBIE;
+               return MON_ZOMBIE.monsterid;
 
        float i;
        entity mon;
@@ -62,7 +64,7 @@ void invasion_SpawnChosenMonster(float 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);
 
@@ -261,7 +263,7 @@ void Invasion_RoundStart()
 }
 
 MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
-{
+{SELFPARAM();
        if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
        {
                inv_numkilled += 1;
@@ -283,7 +285,7 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
 }
 
 MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
-{
+{SELFPARAM();
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
                return true;
 
@@ -304,7 +306,7 @@ MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(invasion_OnEntityPreSpawn)
-{
+{SELFPARAM();
        if(startsWith(self.classname, "monster_"))
        if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
                return true;
@@ -327,7 +329,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerRegen)
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerSpawn)
-{
+{SELFPARAM();
        self.bot_attack = false;
        return false;
 }
@@ -344,7 +346,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerDamage)
 }
 
 MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
-{
+{SELFPARAM();
        if(MUTATOR_RETURNVALUE) // command was already handled?
                return false;
 
@@ -366,7 +368,7 @@ MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
 
 MUTATOR_HOOKFUNCTION(invasion_BotShouldAttack)
 {
-       if(!(checkentity.flags & FL_MONSTER))
+       if(!IS_MONSTER(checkentity))
                return true;
 
        return false;
@@ -382,7 +384,7 @@ MUTATOR_HOOKFUNCTION(invasion_SetStartItems)
 
 MUTATOR_HOOKFUNCTION(invasion_AccuracyTargetValid)
 {
-       if(frag_target.flags & FL_MONSTER)
+       if(IS_MONSTER(frag_target))
                return MUT_ACCADD_INVALID;
        return MUT_ACCADD_INDIFFERENT;
 }
@@ -430,9 +432,10 @@ void invasion_DelayedInit() // Do this check with a delay so we can wait for tea
 
 void invasion_Initialize()
 {
-       if(autocvar_g_invasion_zombies_only)
-               MON_ACTION(MON_ZOMBIE, MR_PRECACHE);
-       else
+       if(autocvar_g_invasion_zombies_only) {
+               Monster mon = MON_ZOMBIE;
+               mon.mr_precache(mon);
+       } else
        {
                float i;
                entity mon;
@@ -442,7 +445,7 @@ void invasion_Initialize()
                        if((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM))
                                continue; // flying/swimming monsters not yet supported
 
-                       MON_ACTION(i, MR_PRECACHE);
+                       mon.mr_precache(mon);
                }
        }
 
@@ -483,7 +486,7 @@ MUTATOR_DEFINITION(gamemode_invasion)
 
        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;
        }