X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Fonslaught%2Fsv_onslaught.qc;h=ea07659e340a078927c60ee163bb5f043fe57468;hb=80a32d528fa31f7cb88b04b099612e705c700308;hp=f9011c7d90dfa702f1cfd157594b0d06e1bbfb18;hpb=6c4bdd5eeea06db69a457997de24bef84b4eaf93;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index f9011c7d9..ea07659e3 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -3,6 +3,7 @@ #include "sv_generator.qh" #include +#include #include #include #include @@ -554,6 +555,7 @@ void ons_ControlPoint_Icon_BuildThink(entity this) sound(this, CH_TRIGGER, SND_ONS_CONTROLPOINT_BUILT, VOL_BASE, ATTEN_NORM); this.owner.iscaptured = true; this.solid = SOLID_BBOX; + setorigin(this, this.origin); // setorigin after change to solid field to ensure area grid linking Send_Effect(EFFECT_CAP(this.owner.team), this.owner.origin, '0 0 0', 1); @@ -600,13 +602,13 @@ void ons_ControlPoint_Icon_Spawn(entity cp, entity player) { entity e = new(onslaught_controlpoint_icon); + e.solid = SOLID_NOT; // before setsize/setorigin to prevent area grid linking setsize(e, CPICON_MIN, CPICON_MAX); setorigin(e, cp.origin + CPICON_OFFSET); e.owner = cp; e.max_health = autocvar_g_onslaught_cp_health; SetResourceExplicit(e, RES_HEALTH, autocvar_g_onslaught_cp_buildhealth); - e.solid = SOLID_NOT; e.takedamage = DAMAGE_AIM; e.bot_attack = true; IL_PUSH(g_bot_targets, e); @@ -1076,7 +1078,6 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o ons_worldgeneratorlist = gen; gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum)); - gen.classname = "onslaught_generator"; gen.solid = SOLID_BBOX; gen.team_saved = teamnum; IL_PUSH(g_saved_team, gen); @@ -1126,7 +1127,7 @@ void Onslaught_count_generators() total_generators = 0; for (int i = 1; i <= NUM_TEAMS; ++i) { - Team_SetNumberOfControlPoints(Team_GetTeamFromIndex(i), 0); + Team_SetNumberOfOwnedItems(Team_GetTeamFromIndex(i), 0); } for(e = ons_worldgeneratorlist; e; e = e.ons_worldgeneratornext) { @@ -1136,37 +1137,12 @@ void Onslaught_count_generators() continue; } entity team_ = Entity_GetTeam(e); - int num_control_points = Team_GetNumberOfControlPoints(team_); - ++num_control_points; - Team_SetNumberOfControlPoints(team_, num_control_points); + int num_generators = Team_GetNumberOfOwnedItems(team_); + ++num_generators; + Team_SetNumberOfOwnedItems(team_, num_generators); } } -int Onslaught_GetWinnerTeam() -{ - int winner_team = 0; - if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(1)) >= 1) - { - winner_team = NUM_TEAM_1; - } - for (int i = 2; i <= NUM_TEAMS; ++i) - { - if (Team_GetNumberOfControlPoints(Team_GetTeamFromIndex(i)) >= 1) - { - if (winner_team != 0) - { - return 0; - } - winner_team = Team_IndexToTeam(i); - } - } - if (winner_team) - { - return winner_team; - } - return -1; // no generators left? -} - void nades_Clear(entity e); bool Onslaught_CheckWinner() @@ -1213,13 +1189,9 @@ bool Onslaught_CheckWinner() else { wpforenemy_announced = false; ons_stalemate = false; } Onslaught_count_generators(); - - if (Team_GetNumberOfTeamsWithControlPoints() > 1) - { + int winner_team = Team_GetWinnerTeam_WithOwnedItems(1); + if (!winner_team) return 0; - } - - int winner_team = Onslaught_GetWinnerTeam(); if(winner_team > 0) { @@ -2180,6 +2152,7 @@ void ons_DelayedInit(entity this) // Do this check with a delay so we can wait f void ons_Initialize() { g_onslaught = true; + g_onsshields = IL_NEW(); ons_captureshield_force = autocvar_g_onslaught_shield_force; cam = new(objective_camera);