// A receptionist's bell /obj/item/desk_bell name = "desk bell" desc = "The cornerstone of any customer service job. You feel an unending urge to ring it. It looks like it can be wrenched or screwdrivered." icon = 'icons/obj/bureaucracy.dmi' icon_state = "desk_bell" materials = list(MAT_METAL = 4000) /// The amount of times this bell has been rang, used to check the chance it breaks var/times_rang = 0 /// Is this bell broken? var/broken_ringer = FALSE /// Holds the time that the bell can next be rang. var/ring_cooldown = 0 /// The length of the cooldown. Setting it to 0 will skip all cooldowns alltogether. var/ring_cooldown_length = 0.5 SECONDS // This is here to protect against tinnitus. /// The sound the bell makes 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) . = ..() if(anchored) . += 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.") /obj/item/desk_bell/Destroy() if(!isnull(attached_signaler)) var/turf/cur_turf = get_turf(src) if(cur_turf) forceMove(attached_signaler, get_turf(src)) else qdel(attached_signaler) UnregisterSignal(attached_signaler, COMSIG_ASSEMBLY_PULSED) attached_signaler = null return ..() /obj/item/desk_bell/item_interaction(mob/living/user, obj/item/used, list/modifiers) 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 [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) RegisterSignal(attached_signaler, COMSIG_ASSEMBLY_PULSED, PROC_REF(on_signal)) user.visible_message( SPAN_NOTICE("[user] attaches [signal] to [src]."), SPAN_NOTICE("You attach [signal] to [src].") ) add_fingerprint(user) 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 INVOKE_ASYNC(src, PROC_REF(try_ring), null, TRUE) /obj/item/desk_bell/proc/try_ring(mob/user, from_signaler = FALSE) if(ring_cooldown > world.time || !anchored) return TRUE if(!ring_bell(user, from_signaler) && user) to_chat(user, SPAN_NOTICE("[src] is silent. Some idiot broke it.")) ring_cooldown = world.time + ring_cooldown_length add_fingerprint(user) return TRUE /obj/item/desk_bell/attack_hand(mob/living/user) if(in_inventory && ishuman(user)) if(!user.get_active_hand()) user.put_in_hands(src) add_fingerprint(user) return TRUE return try_ring(user) /obj/item/desk_bell/MouseDrop(atom/over_object) var/mob/M = usr if(HAS_TRAIT(M, TRAIT_HANDS_BLOCKED) || !Adjacent(M) || anchored) return if(!ishuman(M)) return if(over_object == M) if(!remove_item_from_storage(M)) M.unequip(src) M.put_in_hands(src) anchored = FALSE 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 if(broken_ringer) visible_message(SPAN_NOTICE("[user] begins repairing [src]..."), SPAN_NOTICE("You begin repairing [src]...")) tool.play_tool_sound(src) if(tool.use_tool(src, user, 5 SECONDS)) user.visible_message(SPAN_NOTICE("[user] repairs [src]."), SPAN_NOTICE("You repair [src].")) playsound(user, 'sound/items/change_drill.ogg', 50, vary = TRUE) broken_ringer = FALSE times_rang = 0 return TRUE return FALSE // Deconstruct and Anchor /obj/item/desk_bell/wrench_act(mob/living/user, obj/item/tool) . = TRUE if(user.a_intent == INTENT_HARM && !in_inventory) visible_message(SPAN_NOTICE("[user] begins taking apart [src]..."), SPAN_NOTICE("You begin taking apart [src]...")) if(tool.use_tool(src, user, 5 SECONDS, volume = tool.tool_volume)) visible_message(SPAN_NOTICE("[user] takes apart [src]."), SPAN_NOTICE("You take apart [src].")) playsound(user, 'sound/items/deconstruct.ogg', 50, vary = TRUE) new /obj/item/stack/sheet/metal(drop_location(), 2) qdel(src) return TRUE if(!in_inventory) if(!anchored) user.visible_message("[user] begins securing [src]...", "You begin securing [src]...") if(!tool.use_tool(src, user, 3 SECONDS, volume = tool.tool_volume)) return anchored = TRUE else user.visible_message("[user] begins unsecuring [src]...", "You begin unsecuring [src]...") if(!tool.use_tool(src, user, 3 SECONDS, volume = tool.tool_volume)) return anchored = FALSE return if(attached_signaler) // in inventory if(!tool.use_tool(src, user, 0.5 SECONDS, volume = tool.tool_volume)) return TRUE to_chat(user, SPAN_NOTICE("You remove [attached_signaler].")) 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) if(prob(times_rang / 50) && ring_cooldown_length) audible_message(SPAN_NOTICE("You hear [src]'s clapper fall off its hinge.")) if(user) to_chat(user, SPAN_WARNING("Nice job, you broke it.")) broken_ringer = TRUE /// Ring the bell /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 && !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 /obj/item/desk_bell/get_spooked() if(broken_ringer) return playsound(src, ring_sound, 70, vary = broken_ringer, extrarange = SHORT_RANGE_SOUND_EXTRARANGE) flick("desk_bell_ring", src) return TRUE