You can put defib paddles back into defibs using hotkeys (#94375)

Co-authored-by: Fghj240 <fakeemail@notrealemail.com>
This commit is contained in:
Fghj240
2025-12-09 09:45:44 +01:00
committed by GitHub
co-authored by Fghj240
parent 0cc7144f90
commit ca2e8dd8b2
3 changed files with 18 additions and 0 deletions
@@ -187,3 +187,8 @@
/// From /mob/living/carbon/proc/can_defib() : ()
/// Return a defib result flag to override default defib brain check
#define COMSIG_CARBON_DEFIB_BRAIN_CHECK "carbon_defib_brain_check"
/// From /mob/living/carbon/human/proc/smart_equip_targeted(): (mob/living/carbon/human/user, obj/item/possible_container)
#define COMSIG_HUMAN_NON_STORAGE_HOTKEY "human_storage_hotkey"
/// Return to prevent the storage fail message
#define COMPONENT_STORAGE_HOTKEY_HANDLED (1<<0)
+8
View File
@@ -340,6 +340,7 @@
. = ..()
AddElement(/datum/element/update_icon_updates_onmob, ITEM_SLOT_BACK)
AddComponent(/datum/component/two_handed, force_unwielded=8, force_wielded=12)
RegisterSignal(src, COMSIG_HUMAN_NON_STORAGE_HOTKEY, PROC_REF(on_non_storage_hotkey))
/obj/item/shockpaddles/Destroy()
defib = null
@@ -668,6 +669,13 @@
/obj/item/shockpaddles/proc/is_wielded()
return HAS_TRAIT(src, TRAIT_WIELDED)
/obj/item/shockpaddles/proc/on_non_storage_hotkey(datum/source, mob/living/carbon/human/user, obj/item/possible_storage)
SIGNAL_HANDLER
if(possible_storage == defib)
user.dropItemToGround(src)
return COMPONENT_STORAGE_HOTKEY_HANDLED
return NONE
/obj/item/shockpaddles/cyborg
name = "cyborg defibrillator paddles"
icon = 'icons/obj/medical/defib.dmi'
@@ -358,6 +358,9 @@
return
var/obj/item/thing = get_active_held_item()
var/obj/item/equipped_item = get_item_by_slot(slot_type)
var/thing_reject = NONE
if(thing)
thing_reject = SEND_SIGNAL(thing, COMSIG_HUMAN_NON_STORAGE_HOTKEY, src, equipped_item)
if(!equipped_item) // We also let you equip an item like this
if(!thing)
to_chat(src, span_warning("You have no [slot_item_name] to take something out of!"))
@@ -370,6 +373,8 @@
if(!thing)
equipped_item.attack_hand(src)
else
if(thing_reject & COMPONENT_STORAGE_HOTKEY_HANDLED)
return
to_chat(src, span_warning("You can't fit [thing] into your [equipped_item.name]!"))
return
if(!storage.supports_smart_equip)