Merge pull request #1193 from Citadel-Station-13/upstream-merge-27659

[MIRROR] Moves attack chain proc from global to obj/item
This commit is contained in:
LetterJay
2017-05-26 23:22:42 -05:00
committed by GitHub
4 changed files with 11 additions and 10 deletions
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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)
+5 -5
View File
@@ -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.
+2 -1
View File
@@ -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