From 8b2faaffa17b03a65fb5a82d4c4680dce9558845 Mon Sep 17 00:00:00 2001
From: FalloutFalcon <86381784+FalloutFalcon@users.noreply.github.com>
Date: Tue, 17 Sep 2024 19:35:23 -0500
Subject: [PATCH] CTF machines are only added to processing when CTF starts
(#3360)
## About The Pull Request
small optimization to reduce the size of SSmachines processing
## Why It's Good For The Game
## Changelog
:cl:
code: ctf machines now only process while ctf is running
/:cl:
---
_maps/map_files/generic/CentCom.dmm | 4 ++--
code/modules/awaymissions/capture_the_flag.dm | 3 +++
code/modules/awaymissions/mission_code/challenge.dm | 10 ++++++++++
code/modules/power/singularity/emitter.dm | 10 ----------
4 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm
index 13e075e9884d..fdfae529865d 100644
--- a/_maps/map_files/generic/CentCom.dmm
+++ b/_maps/map_files/generic/CentCom.dmm
@@ -154,7 +154,7 @@
/turf/open/floor/plating,
/area/ctf)
"agI" = (
-/obj/machinery/power/emitter/energycannon{
+/obj/machinery/power/emitter/energycannon/ctf{
active = 0
},
/turf/open/floor/plating,
@@ -163,7 +163,7 @@
/turf/open/floor/plating,
/area/ctf)
"aha" = (
-/obj/machinery/power/emitter/energycannon{
+/obj/machinery/power/emitter/energycannon/ctf{
active = 0;
dir = 1
},
diff --git a/code/modules/awaymissions/capture_the_flag.dm b/code/modules/awaymissions/capture_the_flag.dm
index 2f87eea6d2a7..42d7643fb926 100644
--- a/code/modules/awaymissions/capture_the_flag.dm
+++ b/code/modules/awaymissions/capture_the_flag.dm
@@ -171,6 +171,7 @@
icon = 'icons/obj/device.dmi'
icon_state = "syndbeacon"
resistance_flags = INDESTRUCTIBLE
+ processing_flags = START_PROCESSING_MANUALLY
var/team = WHITE_TEAM
var/team_span = ""
//Capture the Flag scoring
@@ -347,6 +348,7 @@
/obj/machinery/capture_the_flag/proc/start_ctf()
ctf_enabled = TRUE
+ START_PROCESSING(SSmachines, src)
for(var/d in dead_barricades)
var/obj/effect/ctf/dead_barricade/D = d
D.respawn()
@@ -378,6 +380,7 @@
/obj/machinery/capture_the_flag/proc/stop_ctf()
ctf_enabled = FALSE
+ STOP_PROCESSING(SSmachines, src)
arena_reset = FALSE
var/area/A = get_area(src)
for(var/i in GLOB.mob_list)
diff --git a/code/modules/awaymissions/mission_code/challenge.dm b/code/modules/awaymissions/mission_code/challenge.dm
index 05d079220151..6f8bb473b77a 100644
--- a/code/modules/awaymissions/mission_code/challenge.dm
+++ b/code/modules/awaymissions/mission_code/challenge.dm
@@ -35,3 +35,13 @@
/obj/machinery/power/emitter/energycannon/RefreshParts()
return
+
+/obj/machinery/power/emitter/energycannon/ctf
+ processing_flags = START_PROCESSING_MANUALLY
+
+/obj/machinery/power/emitter/energycannon/ctf/proc/toggle_ctf(ctf_enabled)
+ src.active = ctf_enabled
+ if(ctf_enabled)
+ START_PROCESSING(SSmachines, src)
+ else
+ STOP_PROCESSING(SSmachines, src)
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 2dcaa224a71e..73920780bef3 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -357,16 +357,6 @@
if(user)
user.visible_message("[user.name] emags [src].", "You short out the lock.")
-/obj/machinery/power/emitter/ctf
- name = "Energy Cannon"
- active = TRUE
- active_power_usage = FALSE
- idle_power_usage = FALSE
- locked = TRUE
- req_access_txt = "100"
- welded = TRUE
- use_power = FALSE
-
/obj/machinery/power/emitter/welded/Initialize()
welded = TRUE
return ..()