diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 528caa875aa..3db6e30fa52 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -9,7 +9,7 @@ #define NOBLUDGEON 4 // when an item has this it produces no "X has been hit by Y with Z" message in the default attackby() #define MASKINTERNALS 8 // mask allows internals //#define SUITSPACE 8 // suit protects against space -#define USEDELAY 16 // For adding extra delay to heavy items, not currently used +//#define USEDELAY 16 // For adding extra delay to heavy items, not currently used #define NOSHIELD 32 // weapon not affected by shield #define CONDUCT 64 // conducts electricity (metal etc.) #define ABSTRACT 128 // for all things that are technically items but used for various different stuff, made it 128 because it could conflict with other flags other way diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index 8e1d42c1926..0b78c6622f7 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) @@ -51,7 +50,6 @@ if(world.time <= next_move) 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 8dedc4bbcd5..fd155417821 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -71,7 +71,7 @@ return M.click_action(A,src) if(restrained()) - next_move = world.time + 10 //Doing shit in cuffs shall be vey slow + changeNext_move(10) //Doing shit in cuffs shall be vey slow RestrainedClickOn(A) return @@ -83,34 +83,23 @@ if(W == A) - next_move = world.time + 6 - if(W.flags&USEDELAY) - next_move += 5 W.attack_self(src) if(hand) update_inv_l_hand(0) else update_inv_r_hand(0) - return // operate two levels deep here (item in backpack in src; NOT item in box in backpack in src) if(!isturf(A) && A == loc || (A in contents) || (A.loc in contents)) - // 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 if(W) - if(W.flags&USEDELAY) - next_move += 5 - var/resolved = A.attackby(W,src) if(!resolved && A && W) W.afterattack(A,src,1,params) // 1 indicates adjacency else + if(ismob(A)) + changeNext_move(8) UnarmedAttack(A) return @@ -119,11 +108,8 @@ // Allows you to click on a box's contents, if that box is on the ground, but no deeper than that if(isturf(A) || isturf(A.loc) || (A.loc && isturf(A.loc.loc))) - next_move = world.time + 10 if(A.Adjacent(src)) // see adjacent.dm if(W) - if(W.flags&USEDELAY) - next_move += 5 if(W.preattack(A,src,1,params)) //Weapon attack override,return 1 to exit return // Return 1 in attackby() to prevent afterattack() effects (when safely moving items for example) @@ -131,6 +117,8 @@ if(!resolved && A && W) W.afterattack(A,src,1,params) // 1: clicking something Adjacent else + if(ismob(A)) + changeNext_move(8) UnarmedAttack(A, 1) return else // non-adjacent click @@ -143,9 +131,12 @@ return -// Default behavior: ignore double clicks, consider them normal clicks instead +/mob/proc/changeNext_move(num) + next_move = world.time + num + +// 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 /* @@ -159,6 +150,8 @@ in human click code to allow glove touches only at melee range. */ /mob/proc/UnarmedAttack(var/atom/A, var/proximity_flag) + if(ismob(A)) + changeNext_move(8) return /* @@ -173,19 +166,9 @@ if(!mutations.len) return if((LASER in mutations) && a_intent == "harm") 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) + else + if(TK in mutations) + A.attack_tk(src) /* Restrained ClickOn @@ -269,7 +252,7 @@ return /mob/living/LaserEyes(atom/A) - next_move = world.time + 6 + changeNext_move(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 14291469c77..aefd8747cdc 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -56,20 +56,12 @@ return if(W == A) - next_move = world.time + 8 - if(W.flags&USEDELAY) - next_move += 5 - W.attack_self(src) return // 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) W.afterattack(A,src,1,params) @@ -81,16 +73,11 @@ // 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 0b43b498a37..4f6d57e8a5e 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -46,7 +46,6 @@ return 1 if(usr.next_move >= world.time) return - usr.next_move = world.time + 6 if(usr.stat || usr.restrained() || usr.stunned || usr.lying) return 1 @@ -91,7 +90,6 @@ var/obj/item/I = usr.get_active_hand() if(I) master.attackby(I, usr) - usr.next_move = world.time+2 return 1 /obj/screen/zone_sel @@ -297,6 +295,7 @@ // We don't even know if it's a middle click if(world.time <= usr.next_move) return 1 + if(usr.stat || usr.paralysis || usr.stunned || usr.weakened) return 1 if (istype(usr.loc,/obj/mecha)) // stops inventory actions in a mech @@ -306,12 +305,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") @@ -320,5 +317,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 c7d5dd24352..d42b1c311c8 100644 --- a/code/_onclick/item_attack.dm +++ b/code/_onclick/item_attack.dm @@ -11,6 +11,7 @@ visible_message("[src] has been hit by [user] with [W].") /mob/living/attackby(obj/item/I, mob/user) + user.changeNext_move(8) I.attack(src, user) /mob/living/proc/attacked_by(var/obj/item/I, var/mob/living/user, var/def_zone) diff --git a/code/_onclick/observer.dm b/code/_onclick/observer.dm index 44e9c5bca21..5c81116661e 100644 --- a/code/_onclick/observer.dm +++ b/code/_onclick/observer.dm @@ -46,8 +46,8 @@ CtrlClickOn(A) return - if(world.time <= next_move) return - next_move = world.time + 8 + if(world.time <= next_move) + return // 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 5c4b32a2ce3..ba8e3d6850a 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -35,15 +35,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) /* diff --git a/code/_onclick/telekinesis.dm b/code/_onclick/telekinesis.dm index 5df04e9312e..7939841a5d7 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/game/dna.dm b/code/game/dna.dm index f4c6530b7b8..ca11d0f0d8b 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -378,7 +378,7 @@ if(open || !locked) //Open and unlocked, no need to escape open = 1 return - user.next_move = world.time + 100 + user.changeNext_move(100) user.last_special = world.time + 100 user << "You lean on the back of [src] and start pushing the door open. (this will take about [breakout_time] minutes.)" user.visible_message("You hear a metallic creaking from [src]!") diff --git a/code/game/gamemodes/blob/theblob.dm b/code/game/gamemodes/blob/theblob.dm index c288eca5c88..6b7947ae253 100644 --- a/code/game/gamemodes/blob/theblob.dm +++ b/code/game/gamemodes/blob/theblob.dm @@ -150,6 +150,7 @@ /obj/effect/blob/attackby(var/obj/item/weapon/W, var/mob/user) + user.changeNext_move(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 @@ -166,6 +167,7 @@ return /obj/effect/blob/attack_animal(mob/living/simple_animal/M as mob) + M.changeNext_move(8) playsound(src.loc, 'sound/effects/attackblob.ogg', 50, 1) src.visible_message("The [src.name] has been attacked by \the [M]!") var/damage = rand(M.melee_damage_lower, M.melee_damage_upper) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index a8cb4bd6c6a..c1f556da1d7 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -157,6 +157,7 @@ if(istype(user, /mob/living/carbon/alien/humanoid) || istype(user, /mob/living/carbon/slime/)) if(src.operating) return + user.changeNext_move(8) src.health = max(0, src.health - 25) playsound(src.loc, 'sound/effects/Glasshit.ogg', 75, 1) visible_message("\red [user] smashes against the [src.name].") @@ -196,6 +197,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.changeNext_move(8) var/aforce = I.force if(I.damtype == BRUTE || I.damtype == BURN) src.health = max(0, src.health - aforce) diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index d61307589bf..d08ce1730ae 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -432,7 +432,7 @@ /obj/machinery/suit_storage_unit/container_resist() var/mob/living/user = usr if(islocked) - user.next_move = world.time + 100 + user.changeNext_move(100) user.last_special = world.time + 100 var/breakout_time = 2 user << "You start kicking against the doors to escape! (This will take about [breakout_time] minutes.)" diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index fe249a1b72e..724e988d10d 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -197,7 +197,7 @@ /obj/effect/spider/cocoon/container_resist() var/mob/living/user = usr var/breakout_time = 2 - user.next_move = world.time + 100 + user.changeNext_move(100) user.last_special = world.time + 100 user << "You struggle against the tight bonds! (This will take about [breakout_time] minutes.)" visible_message("You see something struggling and writhing in the [src]!") diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 96a4a7a1ef2..a6c8d1a9f1e 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -138,7 +138,6 @@ else if(isliving(loc)) return - user.next_move = max(user.next_move+2,world.time + 2) pickup(user) add_fingerprint(user) user.put_in_active_hand(src) @@ -160,7 +159,6 @@ if(istype(src.loc, /mob/living)) return src.pickup(user) - user.next_move = max(user.next_move+2,world.time + 2) user.put_in_active_hand(src) return diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index ca7e061a4e8..5083689c6c4 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -310,7 +310,7 @@ return //Door's open, not locked or welded, no point in resisting. //okay, so the closet is either welded or locked... resist!!! - user.next_move = world.time + 100 + user.changeNext_move(100) user.last_special = world.time + 100 user << "You lean on the back of [src] and start pushing the door open. (this will take about [breakout_time] minutes.)" for(var/mob/O in viewers(src)) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index cb41a309e97..45fd12f3c32 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -30,6 +30,7 @@ attack_hand(user) /obj/structure/grille/attack_hand(mob/user as mob) + user.changeNext_move(8) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] kicks [src].", \ "You kick [src].", \ @@ -45,7 +46,7 @@ /obj/structure/grille/attack_alien(mob/user as mob) if(istype(user, /mob/living/carbon/alien/larva)) return - + user.changeNext_move(8) playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) user.visible_message("[user] mangles [src].", \ "You mangle [src].", \ @@ -57,6 +58,7 @@ return /obj/structure/grille/attack_slime(mob/living/carbon/slime/user as mob) + user.changeNext_move(8) if(!user.is_adult) return playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) @@ -69,6 +71,7 @@ return /obj/structure/grille/attack_animal(var/mob/living/simple_animal/M as mob) + M.changeNext_move(8) if(M.melee_damage_upper == 0) return playsound(loc, 'sound/effects/grillehit.ogg', 80, 1) @@ -101,6 +104,7 @@ return /obj/structure/grille/attackby(obj/item/weapon/W as obj, mob/user as mob) + user.changeNext_move(8) if(istype(W, /obj/item/weapon/wirecutters)) if(!shock(user, 100)) playsound(loc, 'sound/items/Wirecutter.ogg', 100, 1) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index f4e1f28739b..9b4191a5282 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -114,6 +114,7 @@ R.add_fingerprint(user) qdel(src) else + user.changeNext_move(8) user.visible_message("[user] knocks on [src].") add_fingerprint(user) playsound(loc, 'sound/effects/Glasshit.ogg', 50, 1) @@ -126,6 +127,7 @@ /obj/structure/window/proc/attack_generic(mob/user as mob, damage = 0) //used by attack_alien, attack_animal, and attack_slime if(!can_be_reached(user)) return + user.changeNext_move(8) health -= damage if(health <= 0) user.visible_message("[user] smashes through [src]!") @@ -193,6 +195,7 @@ qdel(src) else if(I.damtype == BRUTE || I.damtype == BURN) + user.changeNext_move(8) hit(I.force) if(health <= 7) anchored = 0 diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 3fffc37ea3e..a8333d377b6 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -89,6 +89,7 @@ dismantle_wall() /turf/simulated/wall/attack_paw(mob/user as mob) + user.changeNext_move(8) if ((HULK in user.mutations)) if (prob(hardness)) usr << text("\blue You smash through the wall.") @@ -102,6 +103,7 @@ return src.attack_hand(user) /turf/simulated/wall/attack_animal(var/mob/living/simple_animal/M) + M.changeNext_move(8) if(M.environment_smash >= 2) if(istype(src, /turf/simulated/wall/r_wall)) if(M.environment_smash == 3) @@ -115,6 +117,7 @@ return /turf/simulated/wall/attack_hand(mob/user as mob) + user.changeNext_move(8) if (HULK in user.mutations) if (prob(hardness)) usr << text("\blue You smash through the wall.") @@ -132,7 +135,7 @@ return /turf/simulated/wall/attackby(obj/item/weapon/W as obj, mob/user as mob) - + user.changeNext_move(8) if (!(istype(user, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey") user << "You don't have the dexterity to do this!" return diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index f46e52a0aa5..1f8c48fdb40 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -428,7 +428,7 @@ if(!isliving(usr) || usr.next_move > world.time) return - usr.next_move = world.time + 20 + usr.changeNext_move(20) var/mob/living/L = usr @@ -461,7 +461,7 @@ if(iscarbon(L)) var/mob/living/carbon/C = L if(C.handcuffed) - C.next_move = world.time + 100 + C.changeNext_move(100) C.last_special = world.time + 100 C.visible_message("[usr] attempts to unbuckle themself!", \ "You attempt to unbuckle yourself. (This will take around one minute and you need to stay still.)") @@ -497,7 +497,7 @@ ExtinguishMob() return if(CM.handcuffed && CM.canmove && (CM.last_special <= world.time)) - CM.next_move = world.time + 100 + CM.changeNext_move(100) CM.last_special = world.time + 100 if(isalienadult(CM) || (HULK in usr.mutations))//Don't want to do a lot of logic gating here. CM.visible_message("[CM] is trying to break [CM.handcuffed]!", \ @@ -531,7 +531,7 @@ CM.handcuffed = null CM.update_inv_handcuffed(0) else if(CM.legcuffed && CM.canmove && (CM.last_special <= world.time)) - CM.next_move = world.time + 100 + CM.changeNext_move(100) CM.last_special = world.time + 100 if(isalienadult(CM) || (HULK in usr.mutations))//Don't want to do a lot of logic gating here. CM.visible_message("[CM] is trying to break [CM.legcuffed]!", \ diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 64ac3a4cc00..fbdd70e9c72 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -268,8 +268,6 @@ var/list/slot_equipment_priority = list( \ if (W) W.attack_self(src) update_inv_r_hand(0) - if(next_move < world.time) - next_move = world.time + 2 return /* diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 8f7c703591f..48b279a587d 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -163,7 +163,7 @@ assailant.visible_message("[assailant] has tightened \his grip on [affecting]'s neck!") add_logs(assailant, affecting, "strangled") - assailant.next_move = world.time + 10 + assailant.changeNext_move(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/firing.dm b/code/modules/projectiles/firing.dm index ed755495b46..4e056555929 100644 --- a/code/modules/projectiles/firing.dm +++ b/code/modules/projectiles/firing.dm @@ -10,7 +10,7 @@ return 0 if(i > 1) newshot() - user.next_move = world.time + 4 + user.changeNext_move(4) update_icon() return 1