From 69f035c1e2197669221e2a7a2c93fc9db335d8fb Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 27 Nov 2014 13:20:38 +1100 Subject: [PATCH] Fix flags falling through clips and often into unreachable areas, add an option to disable oneflag even on maps that support it, allow toggling flags on/off even if there isn't another flag available on the map (fixes repeaters) --- gamemodes.cfg | 1 + qcsrc/server/mutators/gamemode_ctf.qc | 27 ++++++--------------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/gamemodes.cfg b/gamemodes.cfg index b569cd0f4..974e03e24 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -241,6 +241,7 @@ set g_ca_teams 0 // capture the flag // ================== set g_ctf 0 "Capture The Flag: take the enemy flag and bring it to yours at your base to score" +set g_ctf_oneflag 1 "Allow oneflag CTF mode on maps that support it" set g_ctf_flag_return 1 "auto return the flag to base when touched by a teammate" set g_ctf_flag_return_carried_radius 100 "allow flags to be returned by carrier if base is within this radius" set g_ctf_flag_return_time 15 diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 0e49615a1..8243bcc6e 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -438,11 +438,11 @@ void ctf_Handle_Capture(entity flag, entity toucher, float capturetype) break; } + nades_GiveBonus(player, autocvar_g_nades_bonus_score_high ); + player.throw_prevtime = time; player.throw_count = 0; - nades_GiveBonus(player, autocvar_g_nades_bonus_score_high ); - // messages and sounds Send_Notification(NOTIF_ONE, player, MSG_CENTER, ((enemy_flag.team) ? APP_TEAM_ENT_4(enemy_flag, CENTER_CTF_CAPTURE_) : CENTER_CTF_CAPTURE_NEUTRAL)); ctf_CaptureRecord(enemy_flag, player); @@ -915,6 +915,7 @@ void ctf_FlagTouch() { if(gameover) { return; } if(self.active != ACTIVE_ACTIVE) { return; } + if(trace_dphitcontents & (DPCONTENTS_PLAYERCLIP | DPCONTENTS_MONSTERCLIP)) { return; } entity toucher = other, tmp_entity; float is_not_monster = (!(toucher.flags & FL_MONSTER)), num_perteam = 0; @@ -1069,27 +1070,9 @@ void ctf_Reset() void ctf_Use() { if(self.ctf_status != FLAG_BASE) { return; } - - entity flag; - float flag_cnt = 0; - - for(flag = ctf_worldflaglist; flag; flag = flag.ctf_worldflagnext) - { - if(flag != self) - if(SAME_TEAM(flag, self)) - if(flag.active == ACTIVE_ACTIVE) - ++flag_cnt; - } - - if(self.active == ACTIVE_ACTIVE) - if(flag_cnt < 1) - { - dprint("ctf_Use: Unable to deactivate flag (not enough active flags on the map)\n"); - return; - } self.active = ((self.active) ? ACTIVE_NOT : ACTIVE_ACTIVE); - + if(self.active == ACTIVE_ACTIVE) WaypointSprite_Ping(self.wps_flagbase); } @@ -1151,6 +1134,7 @@ void ctf_FlagSetup(float teamnumber, entity flag) // called when spawning a flag flag.event_damage = ctf_FlagDamage; flag.pushable = TRUE; flag.teleportable = TELEPORT_NORMAL; + flag.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable; flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable; flag.velocity = '0 0 0'; @@ -2404,6 +2388,7 @@ Keys: void spawnfunc_item_flag_neutral() { if(!g_ctf) { remove(self); return; } + if(!cvar("g_ctf_oneflag")) { remove(self); return; } ctf_FlagSetup(0, self); } -- 2.39.2