From 3fa79f8d5195dbe128e12fe66a6ecf19bfa64959 Mon Sep 17 00:00:00 2001 From: Kelenius Date: Sat, 9 May 2015 17:27:19 +0300 Subject: [PATCH] Removes click cooldowns almost everywhere. Still have: doors, windoors, cameras, windows, grilles, blobs, resisting, alien stuff, mechas, spray bottles. Setting changeNextMove is now responsibility of the item being attacked. Adds a config option to eliminate click cooldowns completely. Intended to be used by devs. --- code/_onclick/ai.dm | 4 +- code/_onclick/click.dm | 99 +++++++------------ code/_onclick/cyborg.dm | 12 +-- code/_onclick/hud/screen_objects.dm | 11 +-- code/_onclick/item_attack.dm | 2 + code/_onclick/observer.dm | 4 +- code/_onclick/other_mobs.dm | 9 -- code/_onclick/telekinesis.dm | 20 ++-- code/controllers/configuration.dm | 4 + code/game/gamemodes/blob/theblob.dm | 1 + code/game/machinery/camera/camera.dm | 1 + code/game/machinery/deployable.dm | 1 + code/game/machinery/doors/door.dm | 1 + code/game/machinery/doors/windowdoor.dm | 1 + code/game/machinery/portable_turret.dm | 2 +- code/game/mecha/mecha.dm | 3 + code/game/objects/effects/aliens.dm | 3 + code/game/objects/items.dm | 1 - .../structures/crates_lockers/closets.dm | 7 +- code/game/objects/structures/grille.dm | 3 + code/game/objects/structures/window.dm | 3 + code/game/turfs/simulated/walls.dm | 2 + code/modules/mob/living/carbon/human/human.dm | 5 +- code/modules/mob/living/carbon/resist.dm | 23 ++--- code/modules/mob/living/living.dm | 6 +- .../simple_animal/borer/borer_captive.dm | 2 +- .../mob/living/simple_animal/simple_animal.dm | 2 - code/modules/mob/mob.dm | 6 +- code/modules/mob/mob_grab.dm | 4 +- code/modules/projectiles/gun.dm | 4 +- .../projectiles/guns/launcher/rocket.dm | 2 +- .../reagents/reagent_containers/spray.dm | 2 + code/setup.dm | 4 - 33 files changed, 110 insertions(+), 144 deletions(-) diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index e05cbeb9ba..4dee15388d 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -15,7 +15,6 @@ return if(control_disabled || stat) return - next_move = world.time + 9 if(ismob(A)) ai_actual_track(A) @@ -52,9 +51,8 @@ CtrlClickOn(A) return - if(world.time <= next_move) + if(!canClick()) return - next_move = world.time + 9 if(aiCamera.in_camera_mode) aiCamera.camera_mode_off() diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index b8caa45399..5169676ad4 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -4,7 +4,7 @@ */ // 1 decisecond click delay (above and beyond mob/next_move) -/mob/var/next_click = 0 +/mob/var/next_click = 0 /* Before anything else, defer these calls to a per-mobtype handler. This allows us to @@ -15,12 +15,14 @@ Note that this proc can be overridden, and is in the case of screen objects. */ -/atom/Click(location,control,params) + +/atom/Click(var/location, var/control, var/params) // This is their reaction to being clicked on (standard proc) if(src) usr.ClickOn(src, params) -/atom/DblClick(location,control,params) + +/atom/DblClick(var/location, var/control, var/params) if(src) - usr.DblClickOn(src,params) + usr.DblClickOn(src, params) /* Standard mob ClickOn() @@ -35,8 +37,8 @@ * item/afterattack(atom,user,adjacent,params) - used both ranged and adjacent * mob/RangedAttack(atom,params) - used only ranged, only used for tk and laser eyes but could be changed */ -/mob/proc/ClickOn( var/atom/A, var/params ) - if(world.time <= next_click) +/mob/proc/ClickOn(var/atom/A, var/params) + if(world.time <= next_click) // Hard check, before anything else, to avoid crashing return next_click = world.time + 1 @@ -66,16 +68,17 @@ face_atom(A) // change direction to face what you clicked on - if(next_move > world.time) // in the year 2000... + if(!canClick()) // in the year 2000... return - if(istype(loc,/obj/mecha)) - if(!locate(/turf) in list(A,A.loc)) // Prevents inventory from being drilled + if(istype(loc, /obj/mecha)) + if(!locate(/turf) in list(A, A.loc)) // Prevents inventory from being drilled return var/obj/mecha/M = loc - return M.click_action(A,src) + return M.click_action(A, src) if(restrained()) + changeNextMove(10) RestrainedClickOn(A) return @@ -83,79 +86,65 @@ throw_item(A) return - if(!istype(A,/obj/item/weapon/gun) && !isturf(A) && !istype(A,/obj/screen)) + if(!istype(A, /obj/item/weapon/gun) && !isturf(A) && !istype(A, /obj/screen)) last_target_click = world.time var/obj/item/W = get_active_hand() - if(W == A) - next_move = world.time + 6 - if(W.flags&USEDELAY) - next_move += 5 + if(W == A) // Handle attack_self W.attack_self(src) if(hand) update_inv_l_hand(0) else update_inv_r_hand(0) - return - // operate two STORAGE levels deep here (item in backpack in src; NOT item in box in backpack in src) - var/sdepth = A.storage_depth(src) - if(A == loc || (A in loc) || (sdepth != -1 && sdepth <= 1)) - - // faster access to objects already on you - if(A in contents) - next_move = world.time + 6 // on your person - else - next_move = world.time + 8 // in a box/bag or in your square - - // No adjacency needed + // A is your location but is not a turf; or is on you (backpack); or is on something on you (box in backpack); but not next to you and not in a box in a backpack on you + if(!isturf(A) && A == loc || (A in contents) || (A.loc in contents)) if(W) - if(W.flags&USEDELAY) - next_move += 5 - - var/resolved = A.attackby(W,src) + var/resolved = A.attackby(W, src) if(!resolved && A && W) - W.afterattack(A,src,1,params) // 1 indicates adjacency + W.afterattack(A, src, 1, params) // 1 indicates adjacency else + if(ismob(A)) // No instant mob attacking + changeNextMove(8) UnarmedAttack(A, 1) return 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 - // Allows you to click on a box's contents, if that box is on the ground, but no deeper than that - sdepth = A.storage_depth_turf() - if(isturf(A) || isturf(A.loc) || (sdepth != -1 && sdepth <= 1)) - next_move = world.time + 10 - + // 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) + if(isturf(A) || isturf(A.loc) || isturf(A.loc.loc)) if(A.Adjacent(src)) // see adjacent.dm if(W) - if(W.flags&USEDELAY) - next_move += 5 - - // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) - var/resolved = A.attackby(W,src) + var/resolved = A.attackby(W, src) // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) if(!resolved && A && W) - W.afterattack(A,src,1,params) // 1: clicking something Adjacent + W.afterattack(A, src, 1, params) // 1: clicking something Adjacent else + if(ismob(A)) // No instant mob attacking + changeNextMove(8) UnarmedAttack(A, 1) return else // non-adjacent click if(W) - W.afterattack(A,src,0,params) // 0: not Adjacent + W.afterattack(A, src, 0, params) // 0: not Adjacent else RangedAttack(A, params) return -/mob/proc/changeNext_move(num) +/mob/proc/changeNextMove(var/num) next_move = world.time + num -// Default behavior: ignore double clicks, consider them normal clicks instead +/mob/proc/canClick() + if(config.no_click_cooldown || next_move <= world.time) + return 1 + return 0 + +// Default behavior: ignore double clicks, the second click that makes the doubleclick call already calls for a normal click /mob/proc/DblClickOn(var/atom/A, var/params) - ClickOn(A,params) + return /* Translates into attack_hand, etc. @@ -198,17 +187,6 @@ 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(0) - ; - if(1 to 5) // not adjacent may mean blocked by window - next_move += 2 - if(5 to 7) - next_move += 5 - if(8 to tk_maxrange) - next_move += 10 - else - return A.attack_tk(src) /* Restrained ClickOn @@ -234,8 +212,7 @@ if(back) var/obj/item/weapon/rig/rig = back if(istype(rig) && rig.selected_module) - if(world.time <= next_move) return - next_move = world.time + 8 + if(!canClick()) return rig.selected_module.engage(A) return @@ -316,7 +293,7 @@ return /mob/living/LaserEyes(atom/A) - next_move = world.time + 6 + changeNextMove(4) var/turf/T = get_turf(src) var/turf/U = get_turf(A) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 5986011688..414071a964 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -35,7 +35,7 @@ if(stat || lockcharge || weakened || stunned || paralysis) return - if(next_move >= world.time) + if(!canClick()) return face_atom(A) // change direction to face what you clicked on @@ -68,9 +68,6 @@ return if(W == A) - next_move = world.time + 8 - if(W.flags&USEDELAY) - next_move += 5 W.attack_self(src) return @@ -78,9 +75,6 @@ // 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 - next_move = world.time + 8 - if(W.flags&USEDELAY) - next_move += 5 var/resolved = A.attackby(W,src) if(!resolved && A && W) @@ -93,16 +87,12 @@ // 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 - next_move = world.time + 10 - if(W.flags&USEDELAY) - next_move += 5 var/resolved = A.attackby(W, src) if(!resolved && A && W) W.afterattack(A, src, 1, params) return else - next_move = world.time + 10 W.afterattack(A, src, 0, params) return return diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 4a7d6f2acb..03f97187c3 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -48,9 +48,8 @@ /obj/screen/item_action/Click() if(!usr || !owner) return 1 - if(usr.next_move >= world.time) + if(!usr.canClick()) return - usr.next_move = world.time + 6 if(usr.stat || usr.restrained() || usr.stunned || usr.lying) return 1 @@ -85,7 +84,7 @@ name = "storage" /obj/screen/storage/Click() - if(world.time <= usr.next_move) + if(!usr.canClick()) return 1 if(usr.stat || usr.paralysis || usr.stunned || usr.weakened) return 1 @@ -95,7 +94,6 @@ var/obj/item/I = usr.get_active_hand() if(I) usr.ClickOn(master) - usr.next_move = world.time+2 return 1 /obj/screen/gun @@ -481,7 +479,7 @@ /obj/screen/inventory/Click() // At this point in client Click() code we have passed the 1/10 sec check and little else // We don't even know if it's a middle click - if(world.time <= usr.next_move) + if(!usr.canClick()) return 1 if(usr.stat || usr.paralysis || usr.stunned || usr.weakened) return 1 @@ -492,12 +490,10 @@ if(iscarbon(usr)) var/mob/living/carbon/C = usr C.activate_hand("r") - usr.next_move = world.time+2 if("l_hand") if(iscarbon(usr)) var/mob/living/carbon/C = usr C.activate_hand("l") - usr.next_move = world.time+2 if("swap") usr:swap_hand() if("hand") @@ -506,5 +502,4 @@ if(usr.attack_ui(slot_id)) usr.update_inv_l_hand(0) usr.update_inv_r_hand(0) - usr.next_move = world.time+6 return 1 diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm index 1d68fb54e8..1b548c6596 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -6,11 +6,13 @@ // No comment /atom/proc/attackby(obj/item/W, mob/user) return + /atom/movable/attackby(obj/item/W, mob/user) if(!(W.flags&NOBLUDGEON)) visible_message("[src] has been hit by [user] with [W].") /mob/living/attackby(obj/item/I, mob/user) + user.changeNextMove(8) if(istype(I) && ismob(user)) I.attack(src, user) diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 168ae47c86..585949d410 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -32,8 +32,8 @@ if(client.buildmode) build_click(src, client.buildmode, params, A) return - if(world.time <= next_move) return - next_move = world.time + 8 + if(!canClick()) return + changeNextMove(4) // You are responsible for checking config.ghost_interaction when you override this function // Not all of them require checking, see below A.attack_ghost(src) diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 477fb04b7a..f772666651 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -38,15 +38,6 @@ return else if(TK in mutations) - switch(get_dist(src,A)) - if(1 to 5) // not adjacent may mean blocked by window - next_move += 2 - if(5 to 7) - next_move += 5 - if(8 to 15) - next_move += 10 - if(16 to 128) - return A.attack_tk(src) /mob/living/RestrainedClickOn(var/atom/A) diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index ae57895cd6..920db53fa6 100644 --- a/code/_onclick/telekinesis.dm +++ b/code/_onclick/telekinesis.dm @@ -108,20 +108,12 @@ var/const/tk_maxrange = 15 return var/d = get_dist(user, target) - if(focus) d = max(d,get_dist(user,focus)) // whichever is further - switch(d) - if(0) - ; - if(1 to 5) // not adjacent may mean blocked by window - if(!proximity) - user.next_move += 2 - if(5 to 7) - user.next_move += 5 - if(8 to tk_maxrange) - user.next_move += 10 - else - user << "\blue Your mind won't reach that far." - return + if(focus) + d = max(d,get_dist(user,focus)) // whichever is further + + if(d > tk_maxrange) + user << "Your mind won't reach that far." + return if(!focus) focus_object(target, user) diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm index 171080fb32..c99ed82786 100644 --- a/code/controllers/configuration.dm +++ b/code/controllers/configuration.dm @@ -126,6 +126,7 @@ var/list/gamemode_cache = list() var/welder_vision = 1 var/generate_asteroid = 0 + var/no_click_cooldown = 0 //Used for modifying movement speed for mobs. //Unversal modifiers @@ -316,6 +317,9 @@ var/list/gamemode_cache = list() if ("generate_asteroid") config.generate_asteroid = 1 + if ("no_click_cooldown") + config.no_click_cooldown = 1 + if("allow_admin_ooccolor") config.allow_admin_ooccolor = 1 diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index 6e9c3d9b68..df3b8e5aee 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -157,6 +157,7 @@ attackby(var/obj/item/weapon/W, var/mob/user) + user.changeNextMove(8) playsound(src.loc, 'sound/effects/attackblob.ogg', 50, 1) src.visible_message("The [src.name] has been attacked with \the [W][(user ? " by [user]." : ".")]") var/damage = 0 diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 5670ef2060..e60b634ac9 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -187,6 +187,7 @@ src.bugged = 1 else if(W.damtype == BRUTE || W.damtype == BURN) //bashing cameras + user.changeNextMove(8) if (W.force >= src.toughness) visible_message("[src] has been [pick(W.attack_verb)] with [W] by [user]!") if (istype(W, /obj/item)) //is it even possible to get into attackby() with non-items? diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index e49fb26283..7a5e2706c9 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -80,6 +80,7 @@ for reference: return return else + user.changeNextMove(8) switch(W.damtype) if("fire") src.health -= W.force * 1 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index e02be363f4..7f87c65199 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -263,6 +263,7 @@ //psa to whoever coded this, there are plenty of objects that need to call attack() on doors without bludgeoning them. if(src.density && istype(I, /obj/item/weapon) && user.a_intent == I_HURT && !istype(I, /obj/item/weapon/card)) var/obj/item/weapon/W = I + user.changeNextMove(8) if(W.damtype == BRUTE || W.damtype == BURN) if(W.force < min_force) user.visible_message("\red \The [user] hits \the [src] with \the [W] with no visible effect." ) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index b91270ad60..ae4ea0214e 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -225,6 +225,7 @@ //If it's a weapon, smash windoor. Unless it's an id card, agent card, ect.. then ignore it (Cards really shouldnt damage a door anyway) if(src.density && istype(I, /obj/item/weapon) && !istype(I, /obj/item/weapon/card)) + user.changeNextMove(8) var/aforce = I.force playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) visible_message("\red [src] was hit by [I].") diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm index a056cbc0f9..3e36f080c0 100644 --- a/code/game/machinery/portable_turret.dm +++ b/code/game/machinery/portable_turret.dm @@ -331,7 +331,7 @@ else //if the turret was attacked with the intention of harming it: - user.changeNext_move(NEXT_MOVE_DELAY) + user.changeNextMove(8) take_damage(I.force * 0.5) if(I.force * 0.5 > 1) //if the force of impact dealt at least 1 damage, the turret gets pissed off if(!attacked && !emagged) diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index 479d55cb8b..5cbc013f3b 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -511,6 +511,7 @@ return /obj/mecha/attack_hand(mob/user as mob) + user.changeNextMove(8) src.log_message("Attack by hand/paw. Attacker - [user].",1) if(istype(user,/mob/living/carbon/human)) @@ -674,6 +675,7 @@ return /obj/mecha/proc/dynattackby(obj/item/weapon/W as obj, mob/user as mob) + user.changeNextMove(8) src.log_message("Attacked by [W]. Attacker - [user]") if(prob(src.deflect_chance)) user << "\red \The [W] bounces off [src.name]." @@ -1788,6 +1790,7 @@ /obj/mecha/attack_generic(var/mob/user, var/damage, var/attack_message) + user.changeNextMove(8) if(!damage) return 0 diff --git a/code/game/objects/effects/aliens.dm b/code/game/objects/effects/aliens.dm index e6b166792f..93e578d55f 100644 --- a/code/game/objects/effects/aliens.dm +++ b/code/game/objects/effects/aliens.dm @@ -103,6 +103,7 @@ return /obj/effect/alien/resin/attack_hand() + usr.changeNextMove(8) if (HULK in usr.mutations) usr << "\blue You easily destroy the [name]." for(var/mob/O in oviewers(src)) @@ -129,6 +130,7 @@ /obj/effect/alien/resin/attackby(obj/item/weapon/W as obj, mob/user as mob) + user.changeNextMove(8) var/aforce = W.force health = max(0, health - aforce) playsound(loc, 'sound/effects/attackblob.ogg', 100, 1) @@ -236,6 +238,7 @@ Alien plants should do something if theres a lot of poison return /obj/effect/alien/weeds/attackby(var/obj/item/weapon/W, var/mob/user) + user.changeNextMove(8) if(W.attack_verb.len) visible_message("\red \The [src] have been [pick(W.attack_verb)] with \the [W][(user ? " by [user]." : ".")]") else diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 1c29aa8088..500979572e 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -159,7 +159,6 @@ else if(isliving(src.loc)) return - user.next_move = max(user.next_move+2,world.time + 2) user.put_in_active_hand(src) if(src.loc == user) src.pickup(user) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5e1a551cec..d703608ea7 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -325,9 +325,12 @@ if(!req_breakout()) return + if(!escapee.canClick()) + return + + escapee.changeNextMove(100) + //okay, so the closet is either welded or locked... resist!!! - escapee.next_move = world.time + 100 - escapee.last_special = world.time + 100 escapee << "You lean on the back of \the [src] and start pushing the door open. (this will take about [breakout_time] minutes)" visible_message("The [src] begins to shake violently!") diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index b18658d4a6..eced285512 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -33,6 +33,7 @@ /obj/structure/grille/attack_hand(mob/user as mob) + user.changeNextMove(8) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) var/damage_dealt = 1 @@ -154,8 +155,10 @@ //window placing end else if(istype(W, /obj/item/weapon/shard)) + user.changeNextMove(8) health -= W.force * 0.1 else if(!shock(user, 70)) + user.changeNextMove(8) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) switch(W.damtype) if("fire") diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 36d5bcc657..5ccd7efa21 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -175,6 +175,7 @@ playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1) /obj/structure/window/attack_hand(mob/user as mob) + user.changeNextMove(8) if(HULK in user.mutations) user.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!")) user.visible_message("[user] smashes through [src]!") @@ -200,6 +201,7 @@ return /obj/structure/window/attack_generic(var/mob/user, var/damage) + user.changeNextMove(8) if(!damage) return if(damage >= 10) @@ -268,6 +270,7 @@ new glasstype(loc) qdel(src) else + user.changeNextMove(8) if(W.damtype == BRUTE || W.damtype == BURN) hit(W.force) if(health <= 7) diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index ef7dd74e8f..2d8fe8ca2b 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -272,6 +272,7 @@ //Interactions /turf/simulated/wall/attack_hand(mob/user as mob) + user.changeNextMove(8) if (HULK in user.mutations) if (prob(hulk_destroy_prob) || rotting) usr << text("\blue You smash through the wall.") @@ -298,6 +299,7 @@ return 0 /turf/simulated/wall/attack_generic(var/mob/user, var/damage, var/attack_message, var/wallbreaker) + user.changeNextMove(8) if(!damage || !wallbreaker) user << "You push the wall but nothing happens." return diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 498b46345d..1b40b9fa00 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1311,9 +1311,10 @@ set desc = "Pop a joint back into place. Extremely painful." set src in view(1) - if(!isliving(usr) || usr.next_move > world.time) + if(!isliving(usr) || !usr.canClick()) return - usr.next_move = world.time + 20 + + usr.changeNextMove(20) if(usr.stat > 0) usr << "You are unconcious and cannot do that!" diff --git a/code/modules/mob/living/carbon/resist.dm b/code/modules/mob/living/carbon/resist.dm index 95ee36b1f6..5724c11997 100644 --- a/code/modules/mob/living/carbon/resist.dm +++ b/code/modules/mob/living/carbon/resist.dm @@ -27,10 +27,10 @@ ..() /mob/living/carbon/proc/escape_handcuffs() - if(!(last_special <= world.time)) return - - next_move = world.time + 100 - last_special = world.time + 100 + if(!canClick()) + return + + changeNextMove(100) if(can_break_cuffs()) //Don't want to do a lot of logic gating here. break_handcuffs() @@ -61,10 +61,10 @@ drop_from_inventory(handcuffed) /mob/living/carbon/proc/escape_legcuffs() - if(!(last_special <= world.time)) return - - next_move = world.time + 100 - last_special = world.time + 100 + if(!canClick()) + return + + changeNextMove(100) if(can_break_cuffs()) //Don't want to do a lot of logic gating here. break_legcuffs() @@ -149,14 +149,15 @@ return ..() /mob/living/carbon/escape_buckle() + if(!canClick()) + return + + changeNextMove(100) if(!buckled) return - if(!(last_special <= world.time)) return if(!restrained()) ..() else - next_move = world.time + 100 - last_special = world.time + 100 visible_message( "[usr] attempts to unbuckle themself!", "You attempt to unbuckle yourself. (This will take around 2 minutes and you need to stand still)" diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d723cb5556..dc6923db6d 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -572,7 +572,7 @@ default behaviour is: set category = "IC" if(can_resist()) - next_move = world.time + 20 + changeNextMove(20) process_resist() /mob/living/proc/can_resist() @@ -580,7 +580,7 @@ default behaviour is: //so just check weakened instead. if(stat || weakened) return 0 - if(next_move > world.time) + if(!canClick()) return 0 return 1 @@ -605,7 +605,7 @@ default behaviour is: /mob/living/proc/escape_inventory(obj/item/weapon/holder/H) if(H != src.loc) return - + var/mob/M = H.loc //Get our mob holder (if any). if(istype(M)) diff --git a/code/modules/mob/living/simple_animal/borer/borer_captive.dm b/code/modules/mob/living/simple_animal/borer/borer_captive.dm index c0b2999b2f..e666f7ac71 100644 --- a/code/modules/mob/living/simple_animal/borer/borer_captive.dm +++ b/code/modules/mob/living/simple_animal/borer/borer_captive.dm @@ -35,7 +35,7 @@ return /mob/living/captive_brain/can_resist() - return !(stat || next_move > world.time) + return !(stat || !canClick()) /mob/living/captive_brain/process_resist() //Resisting control by an alien mind. diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 881cb2d76a..74094fcbfd 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -266,7 +266,6 @@ /mob/living/simple_animal/attackby(var/obj/item/O, var/mob/user) if(istype(O, /obj/item/stack/medical)) - user.changeNext_move(4) if(stat != DEAD) var/obj/item/stack/medical/MED = O if(health < maxHealth) @@ -284,7 +283,6 @@ if(istype(O, /obj/item/weapon/kitchenknife) || istype(O, /obj/item/weapon/butch)) harvest(user) else - user.changeNext_move(8) if(O.force > resistance) var/damage = O.force if (O.damtype == HALLOSS) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e9cae30755..d31fe2c6f6 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -241,8 +241,6 @@ if (W) W.attack_self(src) update_inv_r_hand() - if(next_move < world.time) - next_move = world.time + 2 return /* @@ -945,9 +943,9 @@ mob/proc/yank_out_object() set desc = "Remove an embedded item at the cost of bleeding and pain." set src in view(1) - if(!isliving(usr) || usr.next_move > world.time) + if(!isliving(usr) || !usr.canClick()) return - usr.next_move = world.time + 20 + usr.changeNextMove(20) if(usr.stat == 1) usr << "You are unconcious and cannot do that!" diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 73c5ee1de7..31e6ee65a0 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -120,7 +120,7 @@ return if(state == GRAB_UPGRADING) return - if(assailant.next_move > world.time) + if(!assailant.canClick()) return if(world.time < (last_upgrade + UPGRADE_COOLDOWN)) return @@ -170,7 +170,7 @@ assailant.attack_log += "\[[time_stamp()]\] Strangled (kill intent) [affecting.name] ([affecting.ckey])" msg_admin_attack("[key_name(assailant)] strangled (kill intent) [key_name(affecting)]") - assailant.next_move = world.time + 10 + affecting.changeNextMove(10) affecting.losebreath += 1 else assailant.visible_message("[assailant] was unable to tighten \his grip on [affecting]'s neck!") diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 2f17c0783d..89cda207f3 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -169,7 +169,7 @@ var/_move_delay = firemode.move_delay var/shoot_time = (_burst - 1)*_burst_delay - user.next_move = world.time + shoot_time //no clicking on things while shooting + user.changeNextMove(shoot_time) if(user.client) user.client.move_delay = world.time + shoot_time //no moving while shooting either next_fire_time = world.time + shoot_time @@ -202,7 +202,7 @@ update_held_icon() //update timing - user.next_move = world.time + 4 + user.changeNextMove(4) if(user.client) user.client.move_delay = world.time + _move_delay next_fire_time = world.time + _fire_delay diff --git a/code/modules/projectiles/guns/launcher/rocket.dm b/code/modules/projectiles/guns/launcher/rocket.dm index fd86302fb8..f468431bdd 100644 --- a/code/modules/projectiles/guns/launcher/rocket.dm +++ b/code/modules/projectiles/guns/launcher/rocket.dm @@ -7,7 +7,7 @@ throw_speed = 2 throw_range = 10 force = 5.0 - flags = CONDUCT | USEDELAY + flags = CONDUCT slot_flags = 0 origin_tech = "combat=8;materials=5" fire_sound = 'sound/effects/bang.ogg' diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 2e929c6d12..62e24b83e2 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -50,6 +50,8 @@ playsound(src.loc, 'sound/effects/spray2.ogg', 50, 1, -6) + user.changeNextMove(4) + if(reagents.has_reagent("sacid")) message_admins("[key_name_admin(user)] fired sulphuric acid from \a [src].") log_game("[key_name(user)] fired sulphuric acid from \a [src].") diff --git a/code/setup.dm b/code/setup.dm index 68c2b94c75..3e2328f596 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -190,12 +190,10 @@ // To successfully stop you taking all pressure damage you must have both a suit and head item with this flag. #define NOBLUDGEON 2 // When an item has this it produces no "X has been hit by Y with Z" message with the default handler. #define AIRTIGHT 4 // Functions with internals. -#define USEDELAY 8 // 1 second extra delay on use. (Can be used once every 2s) #define NOSHIELD 16 // Weapon not affected by shield. #define CONDUCT 32 // Conducts electricity. (metal etc.) #define ON_BORDER 64 // Item has priority to check when entering or leaving. #define NOBLOODY 512 // Used for items if they don't want to get a blood overlay. -#define NODELAY 8192 // 1 second attack-by delay skipped (Can be used once every 0.2s). Most objects have a 1s attack-by delay, which doesn't require a flag. //Use these flags to indicate if an item obscures the specified slots from view, whereas body_parts_covered seems to be used to indicate what body parts the item protects. #define GLASSESCOVERSEYES 256 @@ -865,8 +863,6 @@ var/list/be_special_flags = list( #define ALLMOBS (HUMAN|MONKEY|ALIEN|ROBOT|SLIME|SIMPLE_ANIMAL) -#define NEXT_MOVE_DELAY 8 - #define DROPLIMB_EDGE 0 #define DROPLIMB_BLUNT 1 #define DROPLIMB_BURN 2