bool victent_present;
.bool inv_endreached;
+bool inv_warning_shown; // spammy
+
.string spawnmob;
void target_invasion_roundend_use(entity this, entity actor, entity trigger)
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()
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);
}
}
+ 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)
}
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,
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
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);
}
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.
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;