From f5ab9dbe013aaebd8737458f48c124bd0d307bbe Mon Sep 17 00:00:00 2001 From: ArchBTW <230859540+glue0000@users.noreply.github.com> Date: Sun, 12 Oct 2025 03:38:27 +0000 Subject: [PATCH] Fixes riot shotgun unintentional melee when point blank shooting (#93320) ## About The Pull Request Due to 'fire_delay = 8', when pump racking a riot shotgun (with a live shotgun bullet in it) it will instead melee when you try to point blank shoot at someone. This PR fixes that by blocking melee, on the condition that you pump racked the riot shotgun and it is about to be ready to fire. You still melee with LMB if you have no ammo pump racked/didn't pump rack the shotgun, and if you have ammo pump racked, you can use RMB as intended. tldr Melee combat functionality for riot shotgun remains unchanged, the PR only fixes the unintentional melee attack. ## Why It's Good For The Game The PR fixes unintentional tediousness when wanting to fire at someone point blank with a riot shotgun - It will no longer melee, which is good, because otherwise it makes arbitrarily make riot shotgun cooldown longer due to an unintentional melee attack. ## Changelog :cl: ArchBTW fix: Fixes riot shotgun unintentional melee when point blank shooting /:cl: --- code/modules/projectiles/gun.dm | 6 ++++++ code/modules/projectiles/guns/ballistic/shotgun.dm | 1 + 2 files changed, 7 insertions(+) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 8c5daeeaaeb..ca1134b2e69 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -59,6 +59,10 @@ /// If FALSE it will just try to fire at ourselves straight up. var/doafter_self_shoot = TRUE + /// If TRUE, will fire ITEM_INTERACT_BLOCKING (melee, etc) if the gun has a round already in the chamber, and is waiting to be fired (but cant, usually due to waiting on fire_delay). + /// If FALSE, nothing changed. + var/chambered_attack_block = FALSE + /// Just 'slightly' snowflakey way to modify projectile damage for projectiles fired from this gun. var/projectile_damage_multiplier = 1 @@ -302,6 +306,8 @@ /obj/item/gun/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers) if(try_fire_gun(interacting_with, user, list2params(modifiers))) return ITEM_INTERACT_SUCCESS + if(chambered_attack_block == TRUE && can_shoot() && isliving(interacting_with)) + return ITEM_INTERACT_BLOCKING // block melee (etc), usually if waiting on fire delay return NONE /obj/item/gun/interact_with_atom_secondary(atom/interacting_with, mob/living/user, list/modifiers) diff --git a/code/modules/projectiles/guns/ballistic/shotgun.dm b/code/modules/projectiles/guns/ballistic/shotgun.dm index 053f3dbf99a..12615455bec 100644 --- a/code/modules/projectiles/guns/ballistic/shotgun.dm +++ b/code/modules/projectiles/guns/ballistic/shotgun.dm @@ -50,6 +50,7 @@ accepted_magazine_type = /obj/item/ammo_box/magazine/internal/shot/riot sawn_desc = "Come with me if you want to live." can_be_sawn_off = TRUE + chambered_attack_block = TRUE // necessary for riot shotgun due to fire_delay and wanting to shoot point blank without accidental melee //component for seclight attachment /obj/item/gun/ballistic/shotgun/riot/add_seclight_point()