Adds move cooldown for inventory management, clicking on adjacent atoms

This commit is contained in:
mwerezak
2015-07-05 12:51:55 -04:00
parent 06000a6984
commit 9468508226
2 changed files with 22 additions and 3 deletions

View File

@@ -99,9 +99,16 @@
update_inv_r_hand(0) update_inv_r_hand(0)
return return
// A is your location but is not a turf; or is on you (backpack); or is on something on you (box in backpack); sdepth is needed here because webbings and coat pockets are hacky //Atoms on your person
// A is your location but is not a turf; or is on you (backpack); or is on something on you (box in backpack); sdepth is needed here because contents depth does not equate inventory storage depth.
var/sdepth = A.storage_depth(src) var/sdepth = A.storage_depth(src)
if(!isturf(A) && A == loc || (sdepth != -1 && sdepth <= 1)) if((!isturf(A) && A == loc) || (sdepth != -1 && sdepth <= 1))
// faster access to objects already on you
if(A in contents)
setMoveCooldown(5) //taking an item off of an inventory slot
else
setMoveCooldown(10) //getting something out of a backpack
if(W) if(W)
var/resolved = W.resolve_attackby(A, src) var/resolved = W.resolve_attackby(A, src)
if(!resolved && A && W) if(!resolved && A && W)
@@ -115,10 +122,13 @@
if(!isturf(loc)) // This is going to stop you from telekinesing from inside a closet, but I don't shed many tears for that if(!isturf(loc)) // This is going to stop you from telekinesing from inside a closet, but I don't shed many tears for that
return return
//Atoms on turfs (not on your person)
// A is a turf or is on a turf, or in something on a turf (pen in a box); but not something in something on a turf (pen in a box in a backpack) // A is a turf or is on a turf, or in something on a turf (pen in a box); but not something in something on a turf (pen in a box in a backpack)
sdepth = A.storage_depth_turf() sdepth = A.storage_depth_turf()
if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1)) if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1))
if(A.Adjacent(src)) // see adjacent.dm if(A.Adjacent(src)) // see adjacent.dm
setMoveCooldown(10)
if(W) if(W)
// Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example)
var/resolved = W.resolve_attackby(A,src) var/resolved = W.resolve_attackby(A,src)
@@ -190,6 +200,15 @@
if((LASER in mutations) && a_intent == I_HURT) if((LASER in mutations) && a_intent == I_HURT)
LaserEyes(A) // moved into a proc below LaserEyes(A) // moved into a proc below
else if(TK in mutations) else if(TK in mutations)
switch(get_dist(src,A))
if(1 to 5) // not adjacent may mean blocked by window
setMoveCooldown(2)
if(5 to 7)
setMoveCooldown(5)
if(8 to tk_maxrange)
setMoveCooldown(10)
else
return
A.attack_tk(src) A.attack_tk(src)
/* /*
Restrained ClickOn Restrained ClickOn

View File

@@ -10,7 +10,7 @@
return (!mover.density || !density || lying) return (!mover.density || !density || lying)
return return
/mob/setMoveCooldown(var/timeout) /mob/proc/setMoveCooldown(var/timeout)
if(client) if(client)
client.move_delay = max(world.time + timeout, client.move_delay) client.move_delay = max(world.time + timeout, client.move_delay)