diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 059f9d518e..7e74dc0e71 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -26,7 +26,12 @@ return SEND_SIGNAL(src, COMSIG_HUMAN_MELEE_UNARMED_ATTACK, A) - A.attack_hand(src) + if(!CheckActionCooldown(A.clickdelay_attack_hand_preattack_cooldown)) + if(A.clickdelay_attack_hand_is_action && A.clickdelay_attack_hand_set_preattack) + DelayNextAction() + A.attack_hand(src) + if(A.clickdelay_attack_hand_is_action && !A.clickdelay_attack_hand_set_preattack) + DelayNextAction() //Return TRUE to cancel other attack hand effects that respect it. /atom/proc/attack_hand(mob/user) diff --git a/code/game/machinery/dna_scanner.dm b/code/game/machinery/dna_scanner.dm index fc8513d6cd..6c5ea7d518 100644 --- a/code/game/machinery/dna_scanner.dm +++ b/code/game/machinery/dna_scanner.dm @@ -76,7 +76,6 @@ if(!locked) open_machine() return - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/game/machinery/gulag_teleporter.dm b/code/game/machinery/gulag_teleporter.dm index 0fcfe382d0..da64699dd4 100644 --- a/code/game/machinery/gulag_teleporter.dm +++ b/code/game/machinery/gulag_teleporter.dm @@ -101,7 +101,6 @@ The console is located at computer/gulag_teleporter.dm if(!locked) open_machine() return - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/game/machinery/hypnochair.dm b/code/game/machinery/hypnochair.dm index ff162b7788..64d60ac778 100644 --- a/code/game/machinery/hypnochair.dm +++ b/code/game/machinery/hypnochair.dm @@ -178,7 +178,6 @@ icon_state += "_occupied" /obj/machinery/hypnochair/container_resist(mob/living/user) - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(600)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/game/machinery/suit_storage_unit.dm b/code/game/machinery/suit_storage_unit.dm index 805018efae..97b4b0eaef 100644 --- a/code/game/machinery/suit_storage_unit.dm +++ b/code/game/machinery/suit_storage_unit.dm @@ -301,7 +301,6 @@ open_machine() dump_contents() return - user.last_resist = world.time user.visible_message("You see [user] kicking against the doors of [src]!", \ "You start kicking against the doors... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a thump from [src].") diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 785e20f586..a23e6811f5 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -252,7 +252,6 @@ /obj/structure/spider/cocoon/container_resist(mob/living/user) var/breakout_time = 600 - user.last_resist = world.time to_chat(user, "You struggle against the tight bonds... (This will take about [DisplayTimeText(breakout_time)].)") visible_message("You see something struggling and writhing in \the [src]!") if(do_after(user,(breakout_time), target = src)) @@ -260,8 +259,6 @@ return qdel(src) - - /obj/structure/spider/cocoon/Destroy() var/turf/T = get_turf(src) src.visible_message("\The [src] splits open.") diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index 827999d3d1..428efe4abe 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -71,7 +71,6 @@ if(user.incapacitated()) to_chat(user, "You can't get out while you're restrained like this!") return - user.last_resist = world.time to_chat(user, "You claw at the fabric of [src], trying to tear it open...") to_chat(loc, "Someone starts trying to break free of [src]!") if(!do_after(user, 200, target = src)) diff --git a/code/game/objects/items/devices/dogborg_sleeper.dm b/code/game/objects/items/devices/dogborg_sleeper.dm index dac597e137..d8abccb336 100644 --- a/code/game/objects/items/devices/dogborg_sleeper.dm +++ b/code/game/objects/items/devices/dogborg_sleeper.dm @@ -116,7 +116,6 @@ if(!hound) go_out(user) return - user.last_resist = world.time if(user.a_intent == INTENT_HELP) return var/voracious = TRUE diff --git a/code/game/objects/items/implants/implantchair.dm b/code/game/objects/items/implants/implantchair.dm index 9e9596e8d2..b3c1f79e94 100644 --- a/code/game/objects/items/implants/implantchair.dm +++ b/code/game/objects/items/implants/implantchair.dm @@ -121,7 +121,6 @@ update_icon() /obj/machinery/implantchair/container_resist(mob/living/user) - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/game/objects/items/pet_carrier.dm b/code/game/objects/items/pet_carrier.dm index f9a5dedab0..f2994c0b97 100644 --- a/code/game/objects/items/pet_carrier.dm +++ b/code/game/objects/items/pet_carrier.dm @@ -133,7 +133,6 @@ remove_occupant(user) return - user.last_resist = world.time if(user.mob_size <= MOB_SIZE_SMALL) to_chat(user, "You begin to try escaping the [src] and start fumbling for the lock switch... (This will take some time.)") to_chat(loc, "You see [user] attempting to unlock the [src]!") diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 9b28e22028..732b4db14f 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -506,7 +506,6 @@ if(opened) return if(ismovable(loc)) - user.last_resist = world.time var/atom/movable/AM = loc AM.relay_container_resist(user, src) return @@ -515,7 +514,6 @@ return //okay, so the closet is either welded or locked... resist!!! - user.last_resist = world.time user.visible_message("[src] begins to shake violently!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear banging from [src].") diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 6b58b3d600..3c2f5ef49e 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -106,7 +106,6 @@ GLOBAL_LIST_EMPTY(bodycontainers) //Let them act as spawnpoints for revenants an if(!locked) open() return - user.last_resist = world.time user.visible_message(null, \ "You lean on the back of [src] and start pushing the tray open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm index d0c9dd93e6..cf68341b2c 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -69,7 +69,6 @@ empty_pod() return if(!moving) - user.last_resist = world.time to_chat(user, "You start trying to escape from the pod...") if(do_after(user, 600, target = src)) to_chat(user, "You manage to open the pod.") diff --git a/code/modules/antagonists/abductor/machinery/experiment.dm b/code/modules/antagonists/abductor/machinery/experiment.dm index 6d5b18d637..de350db8ab 100644 --- a/code/modules/antagonists/abductor/machinery/experiment.dm +++ b/code/modules/antagonists/abductor/machinery/experiment.dm @@ -47,7 +47,6 @@ to_chat(user, "[src]'s door won't budge!") /obj/machinery/abductor/experiment/container_resist(mob/living/user) - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index e77d553da9..ad47a111c5 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -262,7 +262,6 @@ return occupant /obj/machinery/atmospherics/components/unary/cryo_cell/container_resist(mob/living/user) - user.last_resist = world.time user.visible_message("You see [user] kicking against the glass of [src]!", \ "You struggle inside [src], kicking the release with your foot... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a thump from [src].") diff --git a/code/modules/mob/clickdelay.dm b/code/modules/mob/clickdelay.dm index 20eb72be4a..cfbfdeeb3a 100644 --- a/code/modules/mob/clickdelay.dm +++ b/code/modules/mob/clickdelay.dm @@ -61,6 +61,15 @@ /mob/proc/CheckResistCooldown() return (world.time >= (last_resist + resist_cooldown)) +/atom + // Standard clickdelay variables + /// Amount of time to check for from a mob's last attack to allow an attack_hand(). + var/clickdelay_attack_hand_preattack_cooldown = CLICK_CD_MELEE + /// Should we set last action before or after attack hand passes? + var/clickdelay_attack_hand_set_preattack = FALSE + /// Should we set last action for attack hand? + var/clickdelay_attack_hand_is_action = FALSE + /obj/item // Standard clickdelay variables /// Amount of time to check for from a mob's last attack, checked before an attack happens diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 3ec7283ccb..695ee4fa5f 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -687,10 +687,12 @@ return if(do_resist()) + last_resist = world.time changeNext_move(CLICK_CD_RESIST) /// The actual proc for resisting. Return TRUE to give clickdelay. /mob/living/proc/do_resist() + set waitfor = FALSE // some of these sleep. SEND_SIGNAL(src, COMSIG_LIVING_RESIST, src) //resisting grabs (as if it helps anyone...) // only works if you're not cuffed. diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index b8bcbedbbe..517a12029e 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -11,6 +11,8 @@ throw_speed = 3 throw_range = 7 pressure_resistance = 8 + clickdelay_attack_hand_is_action = TRUE + clickdelay_attack_hand_preattack_cooldown = CLICK_CD_MELEE var/papertype = /obj/item/paper var/total_paper = 30 var/list/papers = list() @@ -64,7 +66,6 @@ /obj/item/paper_bin/attack_hand(mob/user) if(user.lying) return - user.changeNext_move(CLICK_CD_MELEE) if(bin_pen) var/obj/item/pen/P = bin_pen P.add_fingerprint(user) diff --git a/code/modules/reagents/reagent_containers/rags.dm b/code/modules/reagents/reagent_containers/rags.dm index c6903ff7b4..1debfa7d8d 100644 --- a/code/modules/reagents/reagent_containers/rags.dm +++ b/code/modules/reagents/reagent_containers/rags.dm @@ -189,4 +189,4 @@ extinguish_efficiency = 5 action_speed = 15 damp_threshold = 0.8 - armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 20, "bio" = 20, "rad" = 20, "fire" = 50, "acid" = 50) //items don't provide armor to wearers unlike clothing yet. \ No newline at end of file + armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 20, "bio" = 20, "rad" = 20, "fire" = 50, "acid" = 50) //items don't provide armor to wearers unlike clothing yet. diff --git a/code/modules/research/nanites/nanite_chamber.dm b/code/modules/research/nanites/nanite_chamber.dm index 9beb02d6c8..01513a0b41 100644 --- a/code/modules/research/nanites/nanite_chamber.dm +++ b/code/modules/research/nanites/nanite_chamber.dm @@ -150,7 +150,6 @@ return if(busy) return - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].") diff --git a/code/modules/research/nanites/public_chamber.dm b/code/modules/research/nanites/public_chamber.dm index 8d3bcf8de5..b7a8db4080 100644 --- a/code/modules/research/nanites/public_chamber.dm +++ b/code/modules/research/nanites/public_chamber.dm @@ -130,7 +130,6 @@ return if(busy) return - user.last_resist = world.time user.visible_message("You see [user] kicking against the door of [src]!", \ "You lean on the back of [src] and start pushing the door open... (this will take about [DisplayTimeText(breakout_time)].)", \ "You hear a metallic creaking from [src].")