From 5cd4c866e43acd6a3f398bc78c531cf89bf21768 Mon Sep 17 00:00:00 2001 From: forest2001 Date: Mon, 11 Sep 2023 21:44:59 +0100 Subject: [PATCH] experiment --- code/__DEFINES/combat.dm | 1 + code/modules/mob/living/living_defines.dm | 1 + code/modules/projectiles/gun.dm | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/code/__DEFINES/combat.dm b/code/__DEFINES/combat.dm index 31df07648fc0..01eda92c7cdf 100644 --- a/code/__DEFINES/combat.dm +++ b/code/__DEFINES/combat.dm @@ -20,6 +20,7 @@ #define DEFAULT_MESSAGE_RANGE 7 #define BAYONET_DRAW_DELAY (1 SECONDS) +#define POINTBLANK_COOLDOWN_TIME (2 SECONDS) //Predator decloak multpliers based on the standard. #define DECLOAK_STANDARD (10 SECONDS) diff --git a/code/modules/mob/living/living_defines.dm b/code/modules/mob/living/living_defines.dm index 4293595e1a51..b67ea2a27518 100644 --- a/code/modules/mob/living/living_defines.dm +++ b/code/modules/mob/living/living_defines.dm @@ -58,6 +58,7 @@ var/image/attack_icon = null //the image used as overlay on the things we attack. COOLDOWN_DECLARE(zoom_cooldown) //Cooldown on using zooming items, to limit spam + COOLDOWN_DECLARE(pointblank_cooldown) //Cooldown on PB attacks in an effort to prevent bypassing delays. var/do_bump_delay = 0 // Flag to tell us to delay movement because of being bumped diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 7d5d51a05eb4..223ea9eb7f9f 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -1249,6 +1249,9 @@ and you're good to go. if(!(flags_gun_features & GUN_CAN_POINTBLANK)) // If it can't point blank, you can't suicide and such. return ..() + if(!COOLDOWN_FINISHED(user, pointblank_cooldown)) + return ..() + if(attacked_mob == user && user.zone_selected == "mouth" && ishuman(user)) var/mob/living/carbon/human/HM = user if(!able_to_fire(user)) @@ -1392,6 +1395,7 @@ and you're good to go. if(bullets_fired == 1) //First shot gives the PB message. user.visible_message(SPAN_DANGER("[user] fires [src] point blank at [attacked_mob]!"), SPAN_WARNING("You fire [src] point blank at [attacked_mob]!"), null, null, CHAT_TYPE_WEAPON_USE) + COOLDOWN_START(user, pointblank_cooldown, POINTBLANK_COOLDOWN_TIME) user.track_shot(initial(name)) apply_bullet_effects(projectile_to_fire, user, bullets_fired) //We add any damage effects that we need.