From 67cfd000fe8ce783e096b9eb903abfe1c4a7edce Mon Sep 17 00:00:00 2001 From: SandPoot Date: Thu, 16 Dec 2021 12:57:21 -0300 Subject: [PATCH] Upload files --- code/game/objects/items.dm | 8 ++++++++ code/modules/assembly/assembly.dm | 20 ++++++++++++-------- code/modules/assembly/holder.dm | 6 +++--- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 96fd32401a..b320db0a20 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -331,6 +331,9 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb return ..() /obj/item/on_attack_hand(mob/user, act_intent = user.a_intent, unarmed_attack_flags) + . = ..() + if(.) + return if(!user) return if(anchored) @@ -340,6 +343,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb to_chat(user, "You are unable to unequip that while wearing other garments over it!") return FALSE + . = TRUE + if(resistance_flags & ON_FIRE) var/mob/living/carbon/C = user var/can_handle_hot = FALSE @@ -374,6 +379,8 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb //If the item is in a storage item, take it out SEND_SIGNAL(loc, COMSIG_TRY_STORAGE_TAKE, src, user.loc, TRUE) + if(QDELETED(src)) //moving it out of the storage to the floor destroyed it. + return if(throwing) throwing.finalize(FALSE) @@ -386,6 +393,7 @@ GLOBAL_VAR_INIT(embedpocalypse, FALSE) // if true, all items will be able to emb add_fingerprint(user) if(!user.put_in_active_hand(src, FALSE, FALSE)) user.dropItemToGround(src) + return TRUE /obj/item/proc/allow_attack_hand_drop(mob/user) return TRUE diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index c50ca2f187..67844d50bf 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -34,14 +34,16 @@ /obj/item/assembly/proc/on_attach() -/obj/item/assembly/proc/on_detach() //call this when detaching it from a device. handles any special functions that need to be updated ex post facto +///Call this when detaching it from a device. handles any special functions that need to be updated ex post facto +/obj/item/assembly/proc/on_detach() if(!holder) return FALSE forceMove(holder.drop_location()) holder = null return TRUE -/obj/item/assembly/proc/holder_movement() //Called when the holder is moved +///Called when the holder is moved +/obj/item/assembly/proc/holder_movement() if(!holder) return FALSE setDir(holder.dir) @@ -53,7 +55,6 @@ return FALSE return TRUE - //Called when another assembly acts on this one, var/radio will determine where it came from for wire calcs /obj/item/assembly/proc/pulsed(radio = FALSE) if(wire_type & WIRE_RECEIVE) @@ -62,7 +63,6 @@ INVOKE_ASYNC(src, .proc/activate) return TRUE - //Called when this device attempts to act on another device, var/radio determines if it was sent via radio or direct /obj/item/assembly/proc/pulse(radio = FALSE) if(connected && wire_type) @@ -74,7 +74,6 @@ holder.process_activation(src, 0, 1) return TRUE - // What the device does when turned on /obj/item/assembly/proc/activate() if(QDELETED(src) || !secured || (next_activate > world.time)) @@ -82,13 +81,11 @@ next_activate = world.time + activate_cooldown return TRUE - /obj/item/assembly/proc/toggle_secure() secured = !secured update_icon() return secured - /obj/item/assembly/attackby(obj/item/W, mob/user, params) if(isassembly(W)) var/obj/item/assembly/A = W @@ -115,7 +112,6 @@ . = ..() . += "\The [src] [secured? "is secured and ready to be used!" : "can be attached to other things."]" - /obj/item/assembly/attack_self(mob/user) if(!user) return FALSE @@ -125,3 +121,11 @@ /obj/item/assembly/interact(mob/user) return ui_interact(user) + +/obj/item/assembly/ui_host(mob/user) + if(holder) + return holder + return src + +/obj/item/assembly/ui_state(mob/user) + return GLOB.hands_state diff --git a/code/modules/assembly/holder.dm b/code/modules/assembly/holder.dm index 84e70bbbb3..113964d68e 100644 --- a/code/modules/assembly/holder.dm +++ b/code/modules/assembly/holder.dm @@ -88,14 +88,14 @@ if(a_right) a_right.dropped(user) -/obj/item/assembly_holder/on_attack_hand()//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess +/obj/item/assembly_holder/on_attack_hand(user, act_intent)//Perhapse this should be a holder_pickup proc instead, can add if needbe I guess . = ..() if(.) return if(a_left) - a_left.attack_hand() + a_left.attack_hand(user, act_intent) if(a_right) - a_right.attack_hand() + a_right.attack_hand(user, act_intent) /obj/item/assembly_holder/screwdriver_act(mob/user, obj/item/tool) if(..())