diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 3cb1af15965..7e1912a46a6 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -344,6 +344,8 @@ #define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" ///from base of /mob/throw_item(): (atom/target) #define COMSIG_MOB_THROW "mob_throw" +///called when a user willingly drops something (i.e. keybind, or UI action) +#define COMSIG_MOB_WILLINGLY_DROP "mob_willingly_drop" ///from base of /mob/verb/examinate(): (atom/target) #define COMSIG_MOB_EXAMINATE "mob_examinate" ///from base of /mob/update_sight(): () diff --git a/code/datums/keybindings/mob.dm b/code/datums/keybindings/mob.dm index 631f8515a6c..4eca61522be 100644 --- a/code/datums/keybindings/mob.dm +++ b/code/datums/keybindings/mob.dm @@ -25,8 +25,9 @@ /datum/keybinding/mob/drop_held_object/down(client/C) . = ..() var/obj/item/I = C.mob.get_active_hand() + SEND_SIGNAL(C.mob, COMSIG_MOB_WILLINGLY_DROP) if(I) - C.mob.drop_item(I) + C.mob.drop_item() else to_chat(C, "You have nothing to drop in your hand!") diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index cd74120329a..42cc2acc509 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -248,15 +248,15 @@ name = "photon projector" desc = "A high-powered photon projector implant normally used for lighting purposes, but also doubles as a flashbulb weapon. Self-repair protocols fix the flashbulb if it ever burns out." cooldown_duration = 2 SECONDS - var/obj/item/organ/internal/cyberimp/arm/flash/I = null + var/obj/item/organ/internal/cyberimp/arm/implant = null /obj/item/flash/armimplant/burn_out() - if(I && I.owner) - to_chat(I.owner, "Your [name] implant overheats and deactivates!") - I.Retract() + if(implant?.owner) + to_chat(implant.owner, "Your [name] implant overheats and deactivates!") + implant.Retract() /obj/item/flash/armimplant/Destroy() - I = null + implant = null return ..() /obj/item/flash/synthetic //just a regular flash now diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index f845e95dc40..3a287ee3b71 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -103,6 +103,7 @@ /mob/proc/drop_item_v() //this is dumb. if(stat == CONSCIOUS && isturf(loc)) + SEND_SIGNAL(usr, COMSIG_MOB_WILLINGLY_DROP) return drop_item() return 0 @@ -125,10 +126,10 @@ /mob/proc/canUnEquip(obj/item/I, force) if(!I) - return 1 + return TRUE if((I.flags & NODROP) && !force) - return 0 - return 1 + return FALSE + return TRUE /mob/proc/unEquip(obj/item/I, force, silent = FALSE) //Force overrides NODROP for things like wizarditis and admin undress. if(!I) //If there's nothing to drop, the drop is automatically succesfull. If(unEquip) should generally be used to check for NODROP. diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 278e424fcbb..3d128502f52 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -44,6 +44,7 @@ var/memory = "" var/next_move = null var/notransform = FALSE //Carbon + /// True for left hand active, otherwise for right hand active var/hand = null var/real_name = null var/flavor_text = "" diff --git a/code/modules/surgery/organs/augments_arms.dm b/code/modules/surgery/organs/augments_arms.dm index 49c46c6cbf8..a6b4fbfcf37 100644 --- a/code/modules/surgery/organs/augments_arms.dm +++ b/code/modules/surgery/organs/augments_arms.dm @@ -45,6 +45,9 @@ to_chat(user, "You modify [src] to be installed on the [parent_organ == "r_arm" ? "right" : "left"] arm.") update_icon(UPDATE_ICON_STATE) +/obj/item/organ/internal/cyberimp/arm/insert(mob/living/carbon/M, special, dont_remove_slot) + . = ..() + RegisterSignal(M, COMSIG_MOB_WILLINGLY_DROP, PROC_REF(retract_to_linked_implant)) /obj/item/organ/internal/cyberimp/arm/remove(mob/living/carbon/M, special = 0) Retract() @@ -62,6 +65,16 @@ Retract() ..() +/obj/item/organ/internal/cyberimp/arm/proc/retract_to_linked_implant() + SIGNAL_HANDLER + if(holder && holder == owner.get_active_hand()) + INVOKE_ASYNC(src, PROC_REF(retract_and_show_radial)) + +/obj/item/organ/internal/cyberimp/arm/proc/retract_and_show_radial() + Retract() + if(length(items_list) != 1) + radial_menu(owner) + /obj/item/organ/internal/cyberimp/arm/proc/check_cuffs() if(owner.handcuffed) to_chat(owner, "The handcuffs interfere with [src]!") @@ -253,7 +266,7 @@ ..() if(locate(/obj/item/flash/armimplant) in items_list) var/obj/item/flash/armimplant/F = locate(/obj/item/flash/armimplant) in items_list - F.I = src + F.implant = src /obj/item/organ/internal/cyberimp/arm/baton name = "arm electrification implant" @@ -271,7 +284,7 @@ ..() if(locate(/obj/item/flash/armimplant) in items_list) var/obj/item/flash/armimplant/F = locate(/obj/item/flash/armimplant) in items_list - F.I = src + F.implant = src /obj/item/organ/internal/cyberimp/arm/combat/centcom name = "NT specops cybernetics implant"