From: terencehill Date: Wed, 7 Aug 2024 23:07:56 +0000 (+0200) Subject: CTF: fix fire effect not stopped when flag returns to base X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=51167bd35ec631f4d13a1ddb30725375ddc995f8;p=xonotic%2Fxonotic-data.pk3dir.git CTF: fix fire effect not stopped when flag returns to base This bug was due to flags being improperly set as damageable by contents while standing at their own bases --- diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 74b2d4d98..39f45666d 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -376,6 +376,10 @@ void ctf_Handle_Drop(entity flag, entity player, int droptype) flag.ctf_dropper = player; flag.ctf_status = FLAG_DROPPED; + flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable; + if(flag.damagedbycontents) + IL_PUSH(g_damagedbycontents, flag); + // messages and sounds Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_NUM(flag.team, INFO_CTF_LOST), player.netname); _sound(flag, CH_TRIGGER, flag.snd_flag_dropped, VOL_BASE, ATTEN_NONE); @@ -742,6 +746,12 @@ void ctf_Handle_Pickup(entity flag, entity player, int pickuptype) flag.angles = '0 0 0'; flag.ctf_status = FLAG_CARRY; + flag.damagedbycontents = false; + if(IL_CONTAINS(g_damagedbycontents, flag)) + IL_REMOVE(g_damagedbycontents, flag); + + StatusEffects_removeall(flag, STATUSEFFECT_REMOVE_CLEAR); + switch(pickuptype) { case PICKUP_BASE: flag.ctf_pickuptime = time; break; // used for timing runs @@ -1249,6 +1259,12 @@ void ctf_RespawnFlag(entity flag) flag.angles = flag.mangle; flag.flags = FL_ITEM | FL_NOTARGET; + flag.damagedbycontents = false; + if(IL_CONTAINS(g_damagedbycontents, flag)) + IL_REMOVE(g_damagedbycontents, flag); + + StatusEffects_removeall(flag, STATUSEFFECT_REMOVE_CLEAR); + flag.ctf_status = FLAG_BASE; flag.owner = NULL; flag.pass_distance = 0; @@ -1343,9 +1359,8 @@ void ctf_FlagSetup(int teamnum, entity flag) // called when spawning a flag enti flag.teleportable = TELEPORT_NORMAL; flag.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_PLAYERCLIP; flag.damagedbytriggers = autocvar_g_ctf_flag_return_when_unreachable; - flag.damagedbycontents = autocvar_g_ctf_flag_return_when_unreachable; - if(flag.damagedbycontents) - IL_PUSH(g_damagedbycontents, flag); + flag.damagedbycontents = false; // can be damaged by contents only when dropped + flag.velocity = '0 0 0'; flag.mangle = flag.angles; flag.reset = ctf_Reset;