diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index a8e2681dc9..5b26067725 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -119,7 +119,7 @@ //User itself, current loc, and user inventory if(DirectAccess(A)) if(W) - melee_item_attack_chain(src,W,A,params) + W.melee_attack_chain(src, A, params) else if(ismob(A)) changeNext_move(CLICK_CD_MELEE) @@ -133,7 +133,7 @@ //Standard reach turf to turf or reaching inside storage if(CanReach(A,W)) if(W) - melee_item_attack_chain(src,W,A,params) + W.melee_attack_chain(src, A, params) else if(ismob(A)) changeNext_move(CLICK_CD_MELEE) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index c52b3441db..3bb15c1947 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -71,7 +71,7 @@ // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc in contents) if(A == loc || (A in loc) || (A in contents)) - melee_item_attack_chain(src, W, A, params) + W.melee_attack_chain(src, A, params) return if(!isturf(loc)) @@ -80,7 +80,7 @@ // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc)) if(isturf(A) || isturf(A.loc)) if(A.Adjacent(src)) // see adjacent.dm - melee_item_attack_chain(src, W, A, params) + W.melee_attack_chain(src, A, params) return else W.afterattack(A, src, 0, params) diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 24f6559dd6..72694a434c 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -1,10 +1,10 @@ -/proc/melee_item_attack_chain(mob/user, obj/item/I, atom/target, params) - if(I.pre_attackby(target, user, params)) +/obj/item/proc/melee_attack_chain(mob/user, atom/target, params) + if(pre_attackby(target, user, params)) // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) - var/resolved = target.attackby(I,user,params) - if(!resolved && target && I) - I.afterattack(target, user, 1, params) // 1: clicking something Adjacent + var/resolved = target.attackby(src, user, params) + if(!resolved && target && !QDELETED(src)) + afterattack(target, user, 1, params) // 1: clicking something Adjacent // Called when the item is in the active hand, and clicked; alternately, there is an 'activate held object' verb or you can hit pagedown. diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index c7ad66440e..0ca0fb31a9 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -124,7 +124,8 @@ if(!isturf(target) && istype(focus,/obj/item) && target.Adjacent(focus)) apply_focus_overlay() - melee_item_attack_chain(tk_user, focus, target, params) //isn't copying the attack chain fun. we should do it more often. + var/obj/item/I = focus + I.melee_attack_chain(tk_user, target, params) //isn't copying the attack chain fun. we should do it more often. if(check_if_focusable(focus)) focus.do_attack_animation(target, null, focus) else