From 7236995b0e4f29a7bf3d6a8fe4cac63c46444dce Mon Sep 17 00:00:00 2001 From: Walter0o Date: Thu, 14 Aug 2014 11:13:12 +0200 Subject: [PATCH] fixes #5693 --- .../living/silicon/robot/drone/drone_items.dm | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm index dfe1a9db29..15300c1165 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -69,9 +69,9 @@ /obj/item/weapon/gripper/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) return -/obj/item/weapon/gripper/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag, params) +/obj/item/weapon/gripper/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity, params) - if(!target || !flag) //Target is invalid or we are not adjacent. + if(!target || !proximity) //Target is invalid or we are not adjacent. return //There's some weirdness with items being lost inside the arm. Trying to fix all cases. ~Z @@ -80,25 +80,23 @@ wrapped = thing break - if(wrapped) //Already have an item. - + if(wrapped) //Already have an item. + + // temporary put the item into user so attackby checks pass wrapped.loc = user - //Pass the attack on to the target. + + //Pass the attack on to the target. this might delete/relocate wrapped target.attackby(wrapped,user) - - if(wrapped && src && wrapped.loc == user) + + // if the item did not get put into target or deleted, put it back into src + if(wrapped && user && (wrapped.loc == user)) wrapped.loc = src - //Sanity/item use checks. - - if(!wrapped || !user) - return - - if(wrapped.loc != src.loc) + else wrapped = null return - if(istype(target,/obj/item)) //Check that we're not pocketing a mob. + else if(istype(target,/obj/item)) //Check that we're not pocketing a mob. //...and that the item is not in a container. if(!isturf(target.loc)) @@ -158,9 +156,9 @@ /obj/item/weapon/matter_decompiler/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob) return -/obj/item/weapon/matter_decompiler/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, flag, params) +/obj/item/weapon/matter_decompiler/afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity, params) - if(!flag) return //Not adjacent. + if(!proximity) return //Not adjacent. //We only want to deal with using this on turfs. Specific items aren't important. var/turf/T = get_turf(target) @@ -357,4 +355,4 @@ stack = stack_plastic stack.amount++ - decompiler.stored_comms[type]--; \ No newline at end of file + decompiler.stored_comms[type]--;