Adds a "params" parameter to attackby(), so it keeps track of pixel_x and pixel_y among other things

This commit is contained in:
Markolie
2015-02-22 22:12:11 +01:00
parent aee4626ed9
commit 672305e034
456 changed files with 714 additions and 1182 deletions
+2 -2
View File
@@ -118,8 +118,8 @@
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
if(A.Adjacent(src)) // see adjacent.dm
if(W)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = A.attackby(W,src)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example, params)
var/resolved = A.attackby(W,src,params)
if(!resolved && A && W)
W.afterattack(A,src,1,params) // 1: clicking something Adjacent
else
+2 -2
View File
@@ -78,7 +78,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))
// No adjacency checks
var/resolved = A.attackby(W,src)
var/resolved = A.attackby(W,src,params, params)
if(!resolved && A && W)
W.afterattack(A,src,1,params)
return
@@ -89,7 +89,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
var/resolved = A.attackby(W, src)
var/resolved = A.attackby(W, src, params, params)
if(!resolved && A && W)
W.afterattack(A, src, 1, params)
return
+2 -2
View File
@@ -86,7 +86,7 @@
/obj/screen/storage
name = "storage"
/obj/screen/storage/Click()
/obj/screen/storage/Click(location, control, params)
if(world.time <= usr.next_move)
return 1
if(usr.stat || usr.paralysis || usr.stunned || usr.weakened)
@@ -96,7 +96,7 @@
if(master)
var/obj/item/I = usr.get_active_hand()
if(I)
master.attackby(I, usr)
master.attackby(I, usr, params, params)
return 1
/obj/screen/gun
+3 -3
View File
@@ -4,15 +4,15 @@
return
// No comment
/atom/proc/attackby(obj/item/W, mob/living/user)
/atom/proc/attackby(obj/item/W, mob/living/user, params)
return
/atom/movable/attackby(obj/item/W, mob/living/user)
/atom/movable/attackby(obj/item/W, mob/living/user, params)
user.changeNext_move(CLICK_CD_MELEE)
user.do_attack_animation(src)
if(!(W.flags&NOBLUDGEON))
visible_message("<span class='danger'>[src] has been hit by [user] with [W].</span>")
/mob/living/attackby(obj/item/I, mob/user)
/mob/living/attackby(obj/item/I, mob/user, params)
user.changeNext_move(CLICK_CD_MELEE)
if(istype(I) && ismob(user))
I.attack(src, user)
+2 -2
View File
@@ -270,7 +270,7 @@
// ------- YOU HAVE AN ITEM IN YOUR HAND - HANDLE ATTACKBY AND AFTERATTACK -------
var/ignoreAA = 0 //Ignore afterattack(). Surgery uses this.
if (t5)
ignoreAA = src.attackby(W, usr)
ignoreAA = src.attackby(W, usr, params)
if (W && !ignoreAA)
W.afterattack(src, usr, (t5 ? 1 : 0), params)
@@ -326,7 +326,7 @@
// ------- YOU ARE NOT RESTRAINED -------
if ((W && !( istype(src, /obj/screen) )))
// ------- IT SHOULD NEVER GET TO HERE, DUE TO THE ISTYPE(SRC, /OBJ/SCREEN) FROM PREVIOUS IF-S - I TESTED IT WITH A DEBUG OUTPUT AND I COULDN'T GET THIST TO SHOW UP. -------
src.attackby(W, usr)
src.attackby(W, usr, params)
if (W)
W.afterattack(src, usr,, params)
else
+3 -3
View File
@@ -56,7 +56,7 @@ var/const/tk_maxrange = 15
TK Grab Item (the workhorse of old TK)
* If you have not grabbed something, do a normal tk attack
* If you have something, throw it at the target. If it is already adjacent, do a normal attackby()
* If you have something, throw it at the target. If it is already adjacent, do a normal attackby(, params)
* If you click what you are holding, or attack_self(), do an attack_self_tk() on it.
* Deletes itself if it is ever not in your hand, or if you should have no access to TK.
*/
@@ -95,7 +95,7 @@ var/const/tk_maxrange = 15
if(focus)
focus.attack_self_tk(user)
afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity)//TODO: go over this
afterattack(atom/target as mob|obj|turf|area, mob/living/user as mob|obj, proximity, params)//TODO: go over this
if(!target || !user) return
if(last_throw+3 > world.time) return
if(!host || host != user)
@@ -125,7 +125,7 @@ var/const/tk_maxrange = 15
if(!istype(target, /turf) && istype(focus,/obj/item) && target.Adjacent(focus))
var/obj/item/I = focus
var/resolved = target.attackby(I, user, user:get_organ_target())
var/resolved = target.attackby(I, user, params)
if(!resolved && target && I)
I.afterattack(target,user,1) // for splashing with beakers