Add the ability to install headsets in desk bells. (#32056)

* Add the ability to install headsets in desk bells.

* Update autosay proc to allow for emoting.
This commit is contained in:
Alan
2026-06-11 00:59:44 +00:00
committed by GitHub
parent 047ce9f561
commit f0f7ccf5ba
2 changed files with 75 additions and 14 deletions
+67 -10
View File
@@ -18,6 +18,8 @@
var/ring_sound = 'sound/machines/bell.ogg'
/// The remote signaller that we're gonna activate to this bell
var/obj/item/assembly/signaler/attached_signaler
var/obj/item/radio/headset/attached_headset
var/radio_channel
new_attack_chain = TRUE
/obj/item/desk_bell/examine(mob/user)
@@ -26,6 +28,8 @@
. += SPAN_NOTICE("It's anchored in place.")
if(!isnull(attached_signaler))
. += SPAN_NOTICE("There seems to be an antenna sticking out of the base.")
if(!isnull(attached_headset))
. += SPAN_NOTICE("There's a little microphone poking out of it. You can probably use a multitool to change the channel.")
if(broken_ringer)
. += SPAN_NOTICE("The clapper looks off. You can probably screw it back in place.")
@@ -41,16 +45,24 @@
return ..()
/obj/item/desk_bell/item_interaction(mob/living/user, obj/item/used, list/modifiers)
if(!istype(used, /obj/item/assembly/signaler))
return ..()
// can only attach its on your person
if(istype(used, /obj/item/assembly/signaler))
try_attach_signaler(user, used)
return ITEM_INTERACT_COMPLETE
if(istype(used, /obj/item/radio/headset))
try_attach_headset(user, used)
return ITEM_INTERACT_COMPLETE
return ..()
/obj/item/desk_bell/proc/try_attach_signaler(mob/living/user, obj/item/assembly/signaler/signal)
if(!istype(signal))
return FALSE
// can only attach if it's on your person
if(!in_inventory)
to_chat(user, SPAN_WARNING("[src] needs to be in your inventory if you want to attach [used] to it!"))
return ITEM_INTERACT_COMPLETE
if(!isnull(attached_signaler))
to_chat(user, SPAN_NOTICE("There's already a signaler attached!"))
return ITEM_INTERACT_COMPLETE
var/obj/item/assembly/signaler/signal = used
to_chat(user, SPAN_WARNING("[src] needs to be in your inventory if you want to attach [signal] to it!"))
return FALSE
if(!isnull(attached_signaler) || !isnull(attached_headset))
to_chat(user, SPAN_NOTICE("There's already something attached!"))
return FALSE
user.transfer_item_to(signal, src)
attached_signaler = signal
if(signal.receiving)
@@ -60,7 +72,32 @@
SPAN_NOTICE("You attach [signal] to [src].")
)
add_fingerprint(user)
return ITEM_INTERACT_COMPLETE
return TRUE
/obj/item/desk_bell/proc/try_attach_headset(mob/living/user, obj/item/radio/headset/radio)
if(!istype(radio))
return FALSE
// can only attach if it's on your person
if(!in_inventory)
to_chat(user, SPAN_WARNING("[src] needs to be in your inventory if you want to attach [radio] to it!"))
return FALSE
if(!isnull(attached_signaler) || !isnull(attached_headset))
to_chat(user, SPAN_NOTICE("There's already something attached!"))
return FALSE
var/new_channel = tgui_input_list(user, "Select Radio Channel", "Desk Bell Headset", radio.channels - "Common")
if(!(new_channel && (new_channel in radio.channels)))
return FALSE
radio_channel = new_channel
user.transfer_item_to(radio, src)
attached_headset = radio
user.visible_message(
SPAN_NOTICE("[user] attaches [radio] to [src]."),
SPAN_NOTICE("You attach [radio] to [src].")
)
add_fingerprint(user)
return TRUE
/obj/item/desk_bell/proc/on_signal()
SIGNAL_HANDLER // COMSIG_ASSEMBLY_PULSED
@@ -98,6 +135,18 @@
add_fingerprint(M)
// Change radio channel
/obj/item/desk_bell/multitool_act(mob/living/user, /obj/item/tool)
if(isnull(attached_headset))
to_chat(user, SPAN_WARNING("[src] has no headset in it to adjust!"))
return FALSE
var/new_channel = tgui_input_list(user, "Select Radio Channel", "Desk Bell Headset", attached_headset.channels - "Common")
if(new_channel && (new_channel in attached_headset.channels))
radio_channel = new_channel
add_fingerprint(user)
return TRUE
return FALSE
// Fix the clapper
/obj/item/desk_bell/screwdriver_act(mob/living/user, obj/item/tool)
. = TRUE
@@ -143,6 +192,12 @@
user.put_in_hands(attached_signaler)
UnregisterSignal(attached_signaler, COMSIG_ASSEMBLY_PULSED)
attached_signaler = null
if(attached_headset)
if(!tool.use_tool(src, user, 0.5 SECONDS, volume = tool.tool_volume))
return TRUE
to_chat(user, SPAN_NOTICE("You remove [attached_headset]."))
user.put_in_hands(attached_headset)
attached_headset = null
/// Check if the clapper breaks, and if it does, break it
/obj/item/desk_bell/proc/check_clapper(mob/living/user)
@@ -162,6 +217,8 @@
flick("desk_bell_ring", src)
if(attached_signaler && !from_signaler)
attached_signaler.signal()
if(attached_headset)
attached_headset.autosay("dings!", "[name] in [get_location_name(src)]", radio_channel, is_emote = TRUE, sender_job = "Desk Bell", vname = "clear bell")
times_rang++
return TRUE