From e2985915255f0b0bea39b9acd7a99b60fc8ccdf9 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 4 Aug 2021 16:07:42 +0200 Subject: [PATCH] [MIRROR] Fixes CTF completely breaking on restart (#7377) * Fixes CTF completely breaking on restart (#60662) Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * Fixes CTF completely breaking on restart Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> --- code/modules/capture_the_flag/ctf_game.dm | 14 +++++++++++++- .../capture_the_flag/medieval_sim/medisim_game.dm | 4 ++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/code/modules/capture_the_flag/ctf_game.dm b/code/modules/capture_the_flag/ctf_game.dm index 81d0b282c98..6dbe4a74f16 100644 --- a/code/modules/capture_the_flag/ctf_game.dm +++ b/code/modules/capture_the_flag/ctf_game.dm @@ -231,9 +231,17 @@ var/static/list/people_who_want_to_play = list() var/game_area = /area/ctf + /// This variable is needed because of ctf shitcode + we need to make sure we're deleting the current ctf landmark that spawned us in and not a new one. + var/obj/effect/landmark/ctf/ctf_landmark + /obj/machinery/capture_the_flag/Initialize() . = ..() AddElement(/datum/element/point_of_interest) + ctf_landmark = GLOB.ctf_spawner + +/obj/machinery/capture_the_flag/Destroy() + ctf_landmark = null + return ..() /obj/machinery/capture_the_flag/process(delta_time) for(var/i in spawned_mobs) @@ -453,7 +461,11 @@ notify_ghosts("[name] has been activated!", source = src, action=NOTIFY_ORBIT, header = "CTF has been activated") /obj/machinery/capture_the_flag/proc/reset_the_arena() - new /obj/effect/landmark/ctf(get_turf(GLOB.ctf_spawner)) + if(!ctf_landmark) + return + + if(ctf_landmark == GLOB.ctf_spawner) + new /obj/effect/landmark/ctf(get_turf(GLOB.ctf_spawner)) /obj/machinery/capture_the_flag/proc/stop_ctf() diff --git a/code/modules/capture_the_flag/medieval_sim/medisim_game.dm b/code/modules/capture_the_flag/medieval_sim/medisim_game.dm index 8b9215dd8b6..e2dcc0cd445 100644 --- a/code/modules/capture_the_flag/medieval_sim/medisim_game.dm +++ b/code/modules/capture_the_flag/medieval_sim/medisim_game.dm @@ -18,6 +18,10 @@ . = ..() toggle_id_ctf(null, game_id, automated = TRUE)//only one machine runs the victory proc, start_ctf proc would break the other machine +// We don't clean up for the medisim. +/obj/machinery/capture_the_flag/medisim/reset_the_arena() + return + /obj/machinery/capture_the_flag/medisim/spawn_team_member(client/new_team_member) . = ..() if(!.)