From 64de8f16a9a63ec83c4812b85ac31e38e1b0678c Mon Sep 17 00:00:00 2001
From: silicons <2003111+silicons@users.noreply.github.com>
Date: Thu, 23 Jul 2020 16:59:27 -0700
Subject: [PATCH] fixes
---
code/_onclick/other_mobs.dm | 11 ++++++++---
code/game/objects/obj_defense.dm | 2 ++
code/game/objects/structures/window.dm | 1 +
code/modules/mob/living/carbon/human/human_defense.dm | 3 +++
code/modules/mob/living/living_defense.dm | 9 +++++++--
5 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm
index 9578b909cb..bca8280a89 100644
--- a/code/_onclick/other_mobs.dm
+++ b/code/_onclick/other_mobs.dm
@@ -130,7 +130,9 @@
Monkeys
*/
/mob/living/carbon/monkey/UnarmedAttack(atom/A, proximity, intent = a_intent, flags = NONE)
- return A.attack_paw(src, intent, flags)
+ if(!CheckActionCooldown(CLICK_CD_MELEE))
+ return
+ return !isnull(A.attack_paw(src, intent, flags))
/atom/proc/attack_paw(mob/user)
if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_PAW, user) & COMPONENT_NO_ATTACK_HAND)
@@ -151,6 +153,8 @@
return
if(is_muzzled())
return
+ if(!CheckActionCooldown(CLICK_CD_MELEE))
+ return
var/mob/living/carbon/ML = A
if(istype(ML))
var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
@@ -170,6 +174,7 @@
ML.ForceContractDisease(D)
else
ML.visible_message("[src] has attempted to bite [ML]!")
+ DelayNextAction()
/*
Aliens
@@ -250,9 +255,9 @@
/mob/living/simple_animal/hostile/UnarmedAttack(atom/A, proximity, intent = a_intent, flags = NONE)
target = A
if(dextrous && !ismob(A))
- ..()
+ return ..()
else
- AttackingTarget()
+ return AttackingTarget()
/*
New Players:
diff --git a/code/game/objects/obj_defense.dm b/code/game/objects/obj_defense.dm
index 0c07eb3431..14017ffb2d 100644
--- a/code/game/objects/obj_defense.dm
+++ b/code/game/objects/obj_defense.dm
@@ -116,6 +116,8 @@
playsound(src.loc, 'sound/weapons/slash.ogg', 100, 1)
/obj/attack_animal(mob/living/simple_animal/M)
+ if(!M.CheckActionCooldown(CLICK_CD_MELEE))
+ return
if(!M.melee_damage_upper && !M.obj_damage)
M.emote("custom", message = "[M.friendly_verb_continuous] [src].")
return 0
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 88e7cab798..6aae4955f1 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -177,6 +177,7 @@ GLOBAL_LIST_EMPTY(electrochromatic_window_lookup)
playsound(src, 'sound/effects/Glassknock.ogg', 50, 1)
/obj/structure/window/attack_paw(mob/user)
+ user.DelayNextAction()
return attack_hand(user)
/obj/structure/window/attack_generic(mob/user, damage_amount = 0, damage_type = BRUTE, damage_flag = 0, sound_effect = 1) //used by attack_alien, attack_animal, and attack_slime
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index dc62ed20e5..1673c57a80 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -131,6 +131,9 @@
dna.species.spec_attack_hand(H, src, null, act_intent, unarmed_attack_flags)
/mob/living/carbon/human/attack_paw(mob/living/carbon/monkey/M)
+ if(!M.CheckActionCooldown(CLICK_CD_MELEE))
+ return
+ M.DelayNextAction()
var/dam_zone = pick(BODY_ZONE_CHEST, BODY_ZONE_PRECISE_L_HAND, BODY_ZONE_PRECISE_R_HAND, BODY_ZONE_L_LEG, BODY_ZONE_R_LEG)
var/obj/item/bodypart/affecting = get_bodypart(ran_zone(dam_zone))
if(!affecting)
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index e5d1c8cbe3..216670a7d3 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -323,6 +323,9 @@
/mob/living/attack_animal(mob/living/simple_animal/M)
M.face_atom(src)
+ if(!M.CheckActionCooldown(CLICK_CD_MELEE))
+ return
+ M.DelayNextAction()
if(M.melee_damage_upper == 0)
M.visible_message("\The [M] [M.friendly_verb_continuous] [src]!",
"You [M.friendly_verb_simple] [src]!", target = src,
@@ -338,7 +341,7 @@
return 0
damage = block_calculate_resultant_damage(damage, return_list)
if(M.attack_sound)
- playsound(loc, M.attack_sound, 50, 1, 1)
+ playsound(src, M.attack_sound, 50, 1, 1)
M.do_attack_animation(src)
visible_message("\The [M] [M.attack_verb_continuous] [src]!", \
"\The [M] [M.attack_verb_continuous] you!", null, COMBAT_MESSAGE_RANGE, null,
@@ -347,6 +350,9 @@
return damage
/mob/living/attack_paw(mob/living/carbon/monkey/M)
+ if(!M.CheckActionCooldown(CLICK_CD_MELEE))
+ return
+ M.DelayNextAction()
if (M.a_intent == INTENT_HARM)
if(HAS_TRAIT(M, TRAIT_PACIFISM))
to_chat(M, "You don't want to hurt anyone!")
@@ -357,7 +363,6 @@
if(mob_run_block(M, 0, "the [M.name]", ATTACK_TYPE_MELEE | ATTACK_TYPE_UNARMED, 0, M, check_zone(M.zone_selected), null) & BLOCK_SUCCESS)
return FALSE
M.do_attack_animation(src, ATTACK_EFFECT_BITE)
- M.DelayNextAction()
if (prob(75))
log_combat(M, src, "attacked")
playsound(loc, 'sound/weapons/bite.ogg', 50, 1, -1)