diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 7ea0098661..2d264a3561 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -104,7 +104,6 @@ if(W) W.melee_attack_chain(src, A, params) else - DelayNextAction(ismob(A)? 8 : 0) UnarmedAttack(A) return @@ -117,13 +116,13 @@ if(W) W.melee_attack_chain(src, A, params) else - DelayNextAction(ismob(A)? 8 : 0) DelayNextAction(ismob(A)? 8 : 0) UnarmedAttack(A, 1) else if(W) W.ranged_attack_chain(src, A, params) else + DelayNextAction(ismob(A)? 8 : 0) RangedAttack(A,params) //Is the atom obscured by a PREVENT_CLICK_UNDER_1 object above it @@ -230,8 +229,7 @@ in human click code to allow glove touches only at melee range. */ /mob/proc/UnarmedAttack(atom/A, proximity_flag) - if(ismob(A)) - changeNext_move(CLICK_CD_MELEE) + DelayNextAction(ismob(A)? 8 : 0) return /* diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm index 1203c5a1df..0c07eb3431 100644 --- a/code/game/objects/obj_defense.dm +++ b/code/game/objects/obj_defense.dm @@ -105,9 +105,11 @@ /obj/proc/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, armor_penetration = 0) //used by attack_alien, attack_animal, and attack_slime if(SEND_SIGNAL(src, COMSIG_OBJ_ATTACK_GENERIC, user, damage_amount, damage_type, damage_flag, sound_effect, armor_penetration) & COMPONENT_STOP_GENERIC_ATTACK) return FALSE + if(!user.CheckActionCooldown(CLICK_CD_MELEE)) + return user.do_attack_animation(src) - user.changeNext_move(CLICK_CD_MELEE) - return take_damage(damage_amount, damage_type, damage_flag, sound_effect, get_dir(src, user), armor_penetration) + . = take_damage(damage_amount, damage_type, damage_flag, sound_effect, get_dir(src, user), armor_penetration) + user.DelayNextAction() /obj/attack_alien(mob/living/carbon/alien/humanoid/user) if(attack_generic(user, 60, BRUTE, "melee", 0)) diff --git a/code/game/objects/structures/manned_turret.dm b/code/game/objects/structures/manned_turret.dm index 79489e4ae6..e8fbafa42b 100644 --- a/code/game/objects/structures/manned_turret.dm +++ b/code/game/objects/structures/manned_turret.dm @@ -198,10 +198,6 @@ /obj/item/gun_control/CanItemAutoclick() return TRUE -/obj/item/gun_control/attack_obj(obj/O, mob/living/user) - user.changeNext_move(CLICK_CD_MELEE) - O.attacked_by(src, user) - /obj/item/gun_control/attack(mob/living/M, mob/living/user) M.lastattacker = user.real_name M.lastattackerckey = user.ckey diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 777be608b5..15e1bb7030 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -635,6 +635,8 @@ anchored = TRUE pass_flags = LETPASSTHROW //You can throw objects over this, despite it's density. max_integrity = 20 + clickdelay_attack_hand_is_action = TRUE + clickdelay_attack_hand_preattack_cooldown = CLICK_CD_MELEE /obj/structure/rack/examine(mob/user) . = ..() @@ -682,7 +684,6 @@ return if(CHECK_MULTIPLE_BITFIELDS(user.mobility_flags, MOBILITY_STAND|MOBILITY_MOVE) || user.get_num_legs() < 2) return - user.changeNext_move(CLICK_CD_MELEE) user.do_attack_animation(src, ATTACK_EFFECT_KICK) user.visible_message("[user] kicks [src].", null, null, COMBAT_MESSAGE_RANGE) take_damage(rand(4,8), BRUTE, "melee", 1) diff --git a/code/game/objects/structures/watercloset.dm b/code/game/objects/structures/watercloset.dm index acb88fbb1d..30c4696af3 100644 --- a/code/game/objects/structures/watercloset.dm +++ b/code/game/objects/structures/watercloset.dm @@ -13,6 +13,8 @@ var/mob/living/swirlie = null //the mob being given a swirlie var/buildstacktype = /obj/item/stack/sheet/metal //they're metal now, shut up var/buildstackamount = 1 + clickdelay_attack_hand_is_action = TRUE + clickdelay_attack_hand_preattack_cooldown = CLICK_CD_MELEE /obj/structure/toilet/Initialize() . = ..() @@ -31,13 +33,11 @@ if(.) return if(swirlie) - user.changeNext_move(CLICK_CD_MELEE) playsound(src.loc, "swing_hit", 25, 1) swirlie.visible_message("[user] slams the toilet seat onto [swirlie]'s head!", "[user] slams the toilet seat onto your head!", "You hear reverberating porcelain.") swirlie.adjustBruteLoss(5) else if(user.pulling && user.a_intent == INTENT_GRAB && isliving(user.pulling)) - user.changeNext_move(CLICK_CD_MELEE) var/mob/living/GM = user.pulling if(user.grab_state >= GRAB_AGGRESSIVE) if(GM.loc != get_turf(src)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 17031a51df..31f6df009d 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -40,6 +40,8 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup) rad_flags = RAD_PROTECT_CONTENTS flags_ricochet = RICOCHET_HARD ricochet_chance_mod = 0.4 + clickdelay_attack_hand_is_action = TRUE + clickdelay_attack_hand_preattack_cooldown = CLICK_CD_MELEE /// Electrochromatic status var/electrochromatic_status = NOT_ELECTROCHROMATIC @@ -157,7 +159,7 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup) return 1 /obj/structure/window/attack_tk(mob/user) - user.changeNext_move(CLICK_CD_MELEE) + user.DelayNextAction(CLICK_CD_MELEE) user.visible_message("Something knocks on [src].") add_fingerprint(user) playsound(src, 'sound/effects/Glassknock.ogg', 50, 1) @@ -173,7 +175,6 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup) return if(!can_be_reached(user)) return - user.changeNext_move(CLICK_CD_MELEE) user.visible_message("[user] knocks on [src].") add_fingerprint(user) playsound(src, 'sound/effects/Glassknock.ogg', 50, 1) @@ -842,7 +843,6 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup) return add_fingerprint(user) if(user.a_intent != INTENT_HARM) - user.changeNext_move(CLICK_CD_MELEE) user.visible_message("[user] knocks on [src].") playsound(src, "pageturn", 50, 1) else diff --git a/code/game/turfs/simulated/wall/reinf_walls.dm b/code/game/turfs/simulated/wall/reinf_walls.dm index a1d2c1757c..6b41f41763 100644 --- a/code/game/turfs/simulated/wall/reinf_walls.dm +++ b/code/game/turfs/simulated/wall/reinf_walls.dm @@ -36,7 +36,8 @@ new /obj/item/stack/sheet/metal(src, 2) /turf/closed/wall/r_wall/attack_animal(mob/living/simple_animal/M) - M.changeNext_move(CLICK_CD_MELEE) + if(!M.CheckActionCooldown()) + return M.do_attack_animation(src) if(!M.environment_smash) return @@ -46,6 +47,7 @@ else playsound(src, 'sound/effects/bang.ogg', 50, 1) to_chat(M, "This wall is far too strong for you to destroy.") + M.DelayNextAction() /turf/closed/wall/r_wall/try_destroy(obj/item/I, mob/user, turf/T) if(istype(I, /obj/item/pickaxe/drill/jackhammer)) diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm index d0e36394ab..cef4fb2d62 100644 --- a/code/modules/antagonists/swarmer/swarmer.dm +++ b/code/modules/antagonists/swarmer/swarmer.dm @@ -158,10 +158,11 @@ face_atom(A) if(!isturf(loc)) return - if(next_move > world.time) + if(!CheckActionCooldown()) return if(!A.Adjacent(src)) return + DelayNextAction() A.swarmer_act(src) /atom/proc/swarmer_act(mob/living/simple_animal/hostile/swarmer/S) diff --git a/code/modules/mob/living/brain/brain_item.dm b/code/modules/mob/living/brain/brain_item.dm index 4fda02317e..add379a9c1 100644 --- a/code/modules/mob/living/brain/brain_item.dm +++ b/code/modules/mob/living/brain/brain_item.dm @@ -102,7 +102,7 @@ to_chat(brainmob, "You feel slightly disoriented. That's normal when you're just a brain.") /obj/item/organ/brain/attackby(obj/item/O, mob/user, params) - user.changeNext_move(CLICK_CD_MELEE) + user.DelayNextAction(CLICK_CD_MELEE) if(brainmob) O.attack(brainmob, user) //Oh noooeeeee diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm index 3ef4ef9be9..edfabca7e7 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/blood_drunk_miner.dm @@ -70,7 +70,7 @@ Difficulty: Medium /obj/item/melee/transforming/cleaving_saw/miner/attack(mob/living/target, mob/living/carbon/human/user) target.add_stun_absorption("miner", 10, INFINITY) - ..() + . = ..() target.stun_absorption -= "miner" /obj/item/projectile/kinetic/miner diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index e33116b02c..528a3abb8b 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -103,7 +103,6 @@ did_something = TRUE if(did_something) - user.changeNext_move(CLICK_CD_MELEE) update_state() update_icon() return diff --git a/modular_citadel/code/_onclick/click.dm b/modular_citadel/code/_onclick/click.dm index b6e0afa8b6..2b48d5474a 100644 --- a/modular_citadel/code/_onclick/click.dm +++ b/modular_citadel/code/_onclick/click.dm @@ -38,8 +38,7 @@ if(W) W.rightclick_melee_attack_chain(src, A, params) else - if(ismob(A)) - changeNext_move(CLICK_CD_MELEE) + DelayNextAction(ismob(A)? 8 : 0) if(!AltUnarmedAttack(A)) UnarmedAttack(A) return @@ -53,8 +52,7 @@ if(W) W.rightclick_melee_attack_chain(src, A, params) else - if(ismob(A)) - changeNext_move(CLICK_CD_MELEE) + DelayNextAction(ismob(A)? 8 : 0) if(!AltUnarmedAttack(A,1)) UnarmedAttack(A,1) else