mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Fix Desk Bell Bugs (#26388)
* Fix Desk Bell Bugs Fixes a bug where a desk bell with a receiving signaler and another receiving signaler ended up in an infinite loop. Fixes door bells not unregistering (code) signal handlers for removed (item) signalers * remove superfluous comment Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Signed-off-by: Kenionatus <kenionatus@techie.com> * Update code/modules/paperwork/desk_bell.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com> --------- Signed-off-by: Kenionatus <kenionatus@techie.com> Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com>
This commit is contained in:
co-authored by
Luc
DGamerL
Burzah
parent
5a4cf2279a
commit
6032712fab
@@ -57,12 +57,12 @@
|
||||
|
||||
/obj/item/desk_bell/proc/on_signal()
|
||||
SIGNAL_HANDLER // COMSIG_ASSEMBLY_PULSED
|
||||
INVOKE_ASYNC(src, PROC_REF(try_ring))
|
||||
INVOKE_ASYNC(src, PROC_REF(try_ring), null, TRUE)
|
||||
|
||||
/obj/item/desk_bell/proc/try_ring(mob/user)
|
||||
/obj/item/desk_bell/proc/try_ring(mob/user, from_signaler = FALSE)
|
||||
if(ring_cooldown > world.time || !anchored)
|
||||
return TRUE
|
||||
if(!ring_bell(user) && user)
|
||||
if(!ring_bell(user, from_signaler) && user)
|
||||
to_chat(user, "<span class='notice'>[src] is silent. Some idiot broke it.</span>")
|
||||
ring_cooldown = world.time + ring_cooldown_length
|
||||
return TRUE
|
||||
@@ -132,6 +132,7 @@
|
||||
return TRUE
|
||||
to_chat(user, "<span class='notice'>You remove [attached_signaler].</span>")
|
||||
user.put_in_hands(attached_signaler)
|
||||
UnregisterSignal(attached_signaler, COMSIG_ASSEMBLY_PULSED)
|
||||
attached_signaler = null
|
||||
|
||||
/// Check if the clapper breaks, and if it does, break it
|
||||
@@ -143,14 +144,14 @@
|
||||
broken_ringer = TRUE
|
||||
|
||||
/// Ring the bell
|
||||
/obj/item/desk_bell/proc/ring_bell(mob/living/user)
|
||||
/obj/item/desk_bell/proc/ring_bell(mob/living/user, from_signaler = FALSE)
|
||||
if(broken_ringer)
|
||||
return FALSE
|
||||
check_clapper(user)
|
||||
// The lack of varying is intentional. The only variance occurs on the strike the bell breaks.
|
||||
playsound(src, ring_sound, 70, vary = broken_ringer, extrarange = SHORT_RANGE_SOUND_EXTRARANGE)
|
||||
flick("desk_bell_ring", src)
|
||||
if(attached_signaler)
|
||||
if(attached_signaler && !from_signaler)
|
||||
attached_signaler.signal()
|
||||
times_rang++
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user