X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_invasion.qc;h=777b1b1e97f68bbed062d9f05dcc888523d2a079;hb=fbd313c7ceb26a09310d8062926f4ac2468623a8;hp=51e8459d82476b4f8e7d4ef7bb0bc995a04593cd;hpb=0f2e3cd6c6554bda254111dee0746fea05aac047;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/mutators/mutator/gamemode_invasion.qc b/qcsrc/server/mutators/mutator/gamemode_invasion.qc index 51e8459d8..777b1b1e9 100644 --- a/qcsrc/server/mutators/mutator/gamemode_invasion.qc +++ b/qcsrc/server/mutators/mutator/gamemode_invasion.qc @@ -6,13 +6,14 @@ #include IntrusiveList g_invasion_roundends; -STATIC_INIT(g_invasion_roundends) { g_invasion_roundends = IL_NEW(); } - IntrusiveList g_invasion_waves; -STATIC_INIT(g_invasion_waves) { g_invasion_waves = IL_NEW(); } - IntrusiveList g_invasion_spawns; -STATIC_INIT(g_invasion_spawns) { g_invasion_spawns = IL_NEW(); } +STATIC_INIT(g_invasion) +{ + g_invasion_roundends = IL_NEW(); + g_invasion_waves = IL_NEW(); + g_invasion_spawns = IL_NEW(); +} float autocvar_g_invasion_round_timelimit; float autocvar_g_invasion_spawnpoint_spawn_delay; @@ -24,6 +25,8 @@ float autocvar_g_invasion_spawn_delay; bool victent_present; .bool inv_endreached; +bool inv_warning_shown; // spammy + .string spawnmob; void target_invasion_roundend_use(entity this, entity actor, entity trigger) @@ -74,6 +77,8 @@ spawnfunc(invasion_spawnpoint) IL_PUSH(g_invasion_spawns, this); } +void ClearWinners(); + // Invasion stage mode winning condition: If the attackers triggered a round end (by fulfilling all objectives) // they win. int WinningCondition_Invasion() @@ -194,9 +199,13 @@ void invasion_SpawnChosenMonster(Monster mon) if(spawn_point == NULL) { - LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations"); + if(!inv_warning_shown) + { + inv_warning_shown = true; + LOG_TRACE("Warning: couldn't find any invasion_spawnpoint spawnpoints, attempting to spawn monsters in random locations"); + } entity e = spawn(); - setsize(e, mon.mins, mon.maxs); + 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); @@ -247,6 +256,8 @@ void invasion_SpawnChosenMonster(Monster mon) } } + if(monster.monster_attack) + IL_REMOVE(g_monster_targets, monster); monster.monster_attack = false; // it's the player's job to kill all the monsters if(inv_roundcnt >= inv_maxrounds) @@ -335,14 +346,14 @@ bool Invasion_CheckWinner() } else { - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( - float cs = PlayerScore_Add(it, SP_KILLS, 0); + FOREACH_CLIENT(IS_PLAYER(it), { + float cs = GameRules_scoring_add(it, KILLS, 0); if(cs > winning_score) { winning_score = cs; winner = it; } - )); + }); } IL_EACH(g_monsters, true, @@ -378,10 +389,10 @@ bool Invasion_CheckPlayers() void Invasion_RoundStart() { int numplayers = 0; - FOREACH_CLIENT(IS_PLAYER(it), LAMBDA( + FOREACH_CLIENT(IS_PLAYER(it), { it.player_blocked = false; ++numplayers; - )); + }); if(inv_roundcnt < inv_maxrounds) inv_roundcnt += 1; // a limiter to stop crazy counts @@ -420,10 +431,10 @@ MUTATOR_HOOKFUNCTION(inv, MonsterDies) if(IS_PLAYER(frag_attacker)) if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works - PlayerScore_Add(frag_attacker, SP_KILLS, -1); + GameRules_scoring_add(frag_attacker, KILLS, -1); else { - PlayerScore_Add(frag_attacker, SP_KILLS, +1); + GameRules_scoring_add(frag_attacker, KILLS, +1); if(teamplay) TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1); } @@ -550,10 +561,13 @@ MUTATOR_HOOKFUNCTION(inv, AllowMobButcher) void invasion_ScoreRules(int inv_teams) { if(inv_teams) { CheckAllowedTeams(NULL); } - ScoreRules_basics(inv_teams, 0, 0, false); - if(inv_teams) ScoreInfo_SetLabel_TeamScore(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY); - ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY)); - ScoreRules_basics_end(); + GameRules_score_enabled(false); + GameRules_scoring(inv_teams, 0, 0, { + if (inv_teams) { + field_team(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY); + } + field(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY)); + }); } void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up. @@ -563,14 +577,7 @@ void invasion_DelayedInit(entity this) // Do this check with a delay so we can w if(autocvar_g_invasion_teams) { - invasion_teams = bound(2, autocvar_g_invasion_teams, 4); - int teams = 0; - if(invasion_teams >= 1) teams |= BIT(0); - if(invasion_teams >= 2) teams |= BIT(1); - if(invasion_teams >= 3) teams |= BIT(2); - if(invasion_teams >= 4) teams |= BIT(3); - - invasion_teams = teams; // now set it? + invasion_teams = BITS(bound(2, autocvar_g_invasion_teams, 4)); } else invasion_teams = 0;