]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Survival: Started adding monsters.
authorLyberta <lyberta@lyberta.net>
Sun, 18 Feb 2018 05:36:48 +0000 (08:36 +0300)
committerLyberta <lyberta@lyberta.net>
Sun, 18 Feb 2018 05:36:48 +0000 (08:36 +0300)
qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc

index d4d33925ac375e93fefb334399cd01d1c87be2c7..5454d74d76b02b8b019504d336be1fb8ae4b4ae9 100644 (file)
@@ -1005,6 +1005,29 @@ void Surv_UpdateAliveStats()
        Surv_UpdateDefenderHealthStat();
 }
 
+/// \brief Spawns a monster.
+void Surv_SpawnMonster()
+{
+       entity spawn_point = SelectSpawnPoint(NULL, true);
+       RandomSelection_Init();
+       FOREACH(Monsters, it != MON_Null,
+       {
+               if ((it.spawnflags & MON_FLAG_HIDDEN) ||
+                       (it.spawnflags & MONSTER_TYPE_PASSIVE) ||
+                       (it.spawnflags & MONSTER_TYPE_FLY) ||
+                       (it.spawnflags & MONSTER_TYPE_SWIM) ||
+                       (it.spawnflags & MONSTER_SIZE_QUAKE))
+               {
+                       continue;
+               }
+               RandomSelection_AddEnt(it, 1, 1);
+       });
+       entity monster = spawnmonster(spawn(), RandomSelection_chosen_ent.netname,
+               RandomSelection_chosen_ent.monsterid, NULL, NULL, spawn_point.origin,
+               false, false, 2);
+       monster.team = surv_attackerteam;
+}
+
 /// \brief Updates defender health on the HUD.
 /// \return No return.
 void Surv_UpdateDefenderHealthStat()
@@ -1468,6 +1491,10 @@ void Surv_RoundStart()
                        break;
                }
        }
+       for (int i = 0; i < 8; ++i)
+       {
+               Surv_SpawnMonster();
+       }
        if (autocvar_g_surv_stealth)
        {
                return;