From 94685082268d69ec2981a7ac2dcc5bb16d4a852c Mon Sep 17 00:00:00 2001 From: mwerezak Date: Sun, 5 Jul 2015 12:51:55 -0400 Subject: [PATCH] Adds move cooldown for inventory management, clicking on adjacent atoms --- code/_onclick/click.dm | 23 +++++++++++++++++++++-- code/modules/mob/mob_movement.dm | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index a250b12e436..763ee91f8da 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -99,9 +99,16 @@ update_inv_r_hand(0) 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) - 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) var/resolved = W.resolve_attackby(A, src) 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 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) sdepth = A.storage_depth_turf() if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1)) if(A.Adjacent(src)) // see adjacent.dm + setMoveCooldown(10) + if(W) // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) var/resolved = W.resolve_attackby(A,src) @@ -190,6 +200,15 @@ if((LASER in mutations) && a_intent == I_HURT) LaserEyes(A) // moved into a proc below 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) /* Restrained ClickOn diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index b37192ed762..7da4f731e8b 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -10,7 +10,7 @@ return (!mover.density || !density || lying) return -/mob/setMoveCooldown(var/timeout) +/mob/proc/setMoveCooldown(var/timeout) if(client) client.move_delay = max(world.time + timeout, client.move_delay)