X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Finvasion%2Fsv_invasion.qc;h=993eb936f4a0622d5fe7019dfda644484b33c201;hb=0514f7948727cfa572b33bd29d1bdf2c13cd866d;hp=c9670a150c38d1dac71880355f6ce712b964b5e3;hpb=16e64ff58cf65d7b3e0815aadb530580a6aa251b;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc index c9670a150..993eb936f 100644 --- a/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc +++ b/qcsrc/common/gamemodes/gamemode/invasion/sv_invasion.qc @@ -1,9 +1,12 @@ #include "sv_invasion.qh" +#include #include #include #include +#include +#include #include IntrusiveList g_invasion_roundends; @@ -72,7 +75,6 @@ spawnfunc(invasion_spawnpoint) { if(!g_invasion) { delete(this); return; } - this.classname = "invasion_spawnpoint"; IL_PUSH(g_invasion_spawns, this); } @@ -207,7 +209,7 @@ void invasion_SpawnChosenMonster(Monster mon) setsize(e, mon.m_mins, mon.m_maxs); if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256)) - monster = spawnmonster(e, tospawn, mon.monsterid, NULL, NULL, e.origin, false, false, 2); + monster = spawnmonster(e, tospawn, mon, NULL, NULL, e.origin, false, false, 2); else { delete(e); @@ -215,7 +217,7 @@ void invasion_SpawnChosenMonster(Monster mon) } } else // if spawnmob field falls through (unset), fallback to mon (relying on spawnmonster for that behaviour) - monster = spawnmonster(spawn(), ((spawn_point.spawnmob && spawn_point.spawnmob != "") ? spawn_point.spawnmob : tospawn), mon.monsterid, spawn_point, spawn_point, spawn_point.origin, false, false, 2); + monster = spawnmonster(spawn(), ((spawn_point.spawnmob && spawn_point.spawnmob != "") ? spawn_point.spawnmob : tospawn), mon, spawn_point, spawn_point, spawn_point.origin, false, false, 2); if(!monster) return; @@ -288,9 +290,9 @@ bool Invasion_CheckWinner() float total_alive_monsters = 0, supermonster_count = 0, red_alive = 0, blue_alive = 0, yellow_alive = 0, pink_alive = 0; - IL_EACH(g_monsters, GetResourceAmount(it, RESOURCE_HEALTH) > 0, + IL_EACH(g_monsters, GetResource(it, RES_HEALTH) > 0, { - if((get_monsterinfo(it.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER) + if(it.monsterdef.spawnflags & MON_FLAG_SUPERMONSTER) ++supermonster_count; ++total_alive_monsters; @@ -334,14 +336,20 @@ bool Invasion_CheckWinner() { if(red_alive > 0) { winner_team = NUM_TEAM_1; } if(blue_alive > 0) - if(winner_team) { winner_team = 0; } - else { winner_team = NUM_TEAM_2; } + { + if(winner_team) { winner_team = 0; } + else { winner_team = NUM_TEAM_2; } + } if(yellow_alive > 0) - if(winner_team) { winner_team = 0; } - else { winner_team = NUM_TEAM_3; } + { + if(winner_team) { winner_team = 0; } + else { winner_team = NUM_TEAM_3; } + } if(pink_alive > 0) - if(winner_team) { winner_team = 0; } - else { winner_team = NUM_TEAM_4; } + { + if(winner_team) { winner_team = 0; } + else { winner_team = NUM_TEAM_4; } + } } else { @@ -429,13 +437,15 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies) if(teamplay) { inv_monsters_perteam[frag_target.team] -= 1; } if(IS_PLAYER(frag_attacker)) - if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works - GameRules_scoring_add(frag_attacker, KILLS, -1); - else { - GameRules_scoring_add(frag_attacker, KILLS, +1); - if(teamplay) - TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1); + if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works + GameRules_scoring_add(frag_attacker, KILLS, -1); + else + { + GameRules_scoring_add(frag_attacker, KILLS, +1); + if(teamplay) + TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1); + } } } } @@ -459,7 +469,7 @@ MUTATOR_HOOKFUNCTION(inv, MonsterSpawn) mon.monster_skill = inv_monsterskill; - if((get_monsterinfo(mon.monsterid)).spawnflags & MON_FLAG_SUPERMONSTER) + if(mon.monsterdef.spawnflags & MON_FLAG_SUPERMONSTER) Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_INVASION_SUPERMONSTER, mon.monster_name); }