From 12cb55d4f8ceed6ae5eff1927e1cfb529d110acf Mon Sep 17 00:00:00 2001
From: DGamerL <108773801+DGamerL@users.noreply.github.com>
Date: Mon, 4 Nov 2024 20:26:36 +0100
Subject: [PATCH] [s] Fixes flayers borking radios sometimes (#27293)
* Fixes flayers borking radios sometimes
* Typo
---
.../objects/items/devices/radio/radio_objects.dm | 2 ++
code/game/objects/items/weapons/stunbaton.dm | 12 ++++++------
code/modules/mob/living/living_defines.dm | 3 ---
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/code/game/objects/items/devices/radio/radio_objects.dm b/code/game/objects/items/devices/radio/radio_objects.dm
index 307c2e0f87f..a12c35c1a2d 100644
--- a/code/game/objects/items/devices/radio/radio_objects.dm
+++ b/code/game/objects/items/devices/radio/radio_objects.dm
@@ -82,6 +82,8 @@ GLOBAL_LIST_EMPTY(deadsay_radio_systems)
var/requires_tcomms = FALSE // Does this device require tcomms to work.If TRUE it wont function at all without tcomms. If FALSE, it will work without tcomms, just slowly
var/instant = FALSE // Should this device instantly communicate if there isnt tcomms
+ /// A timer that, when going off, will turn this radio on again
+ var/radio_enable_timer
/obj/item/radio/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm
index 012ed2e4e14..2b0976e3af5 100644
--- a/code/game/objects/items/weapons/stunbaton.dm
+++ b/code/game/objects/items/weapons/stunbaton.dm
@@ -373,23 +373,23 @@
/obj/item/melee/baton/flayerprod/baton_stun(mob/living/L, mob/user, skip_cooldown, ignore_shield_check = FALSE)
if(..())
disable_radio(L)
- L.radio_enable_timer = addtimer(CALLBACK(src, PROC_REF(enable_radio), L), radio_disable_time, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE | TIMER_DELETE_ME)
return TRUE
return FALSE
/obj/item/melee/baton/flayerprod/proc/disable_radio(mob/living/L)
var/list/all_items = L.GetAllContents()
for(var/obj/item/radio/R in all_items)
+ R.radio_enable_timer = addtimer(CALLBACK(src, PROC_REF(enable_radio), R), radio_disable_time, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE | TIMER_DELETE_ME)
R.on = FALSE
R.listening = FALSE
R.broadcasting = FALSE
L.visible_message("[R] buzzes loudly as it short circuits!", blind_message = "You hear a loud, electronic buzzing.")
-/obj/item/melee/baton/flayerprod/proc/enable_radio(mob/living/L)
- var/list/all_items = L.GetAllContents()
- for(var/obj/item/radio/R in all_items)
- R.on = TRUE
- R.listening = TRUE
+/obj/item/melee/baton/flayerprod/proc/enable_radio(obj/item/radio/R)
+ if(QDELETED(R))
+ return
+ R.on = TRUE
+ R.listening = TRUE
/obj/item/melee/baton/flayerprod/deductcharge(amount)
if(cell.charge < hitcost)
diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm
index 36acc6b6407..8bccc0b57c2 100644
--- a/code/modules/mob/living/living_defines.dm
+++ b/code/modules/mob/living/living_defines.dm
@@ -117,6 +117,3 @@
var/last_taste_text
///If a creature gets to be super special and have extra range on their chat messages
var/extra_message_range = 0
-
- /// A timer that, when going off, will enable all the mob's radios again
- var/radio_enable_timer