From 31932c67826f14e01302ced26f39189502ba105c Mon Sep 17 00:00:00 2001 From: retlaw34 <58402542+retlaw34@users.noreply.github.com> Date: Fri, 12 Jan 2024 11:04:52 -0800 Subject: [PATCH] Various gun gunfixes (#2599) ## About The Pull Request Various bugfixes related to guns. Fixes #603? maybe? ## Why It's Good For The Game Less bugs are great for the game. Trust me ## Changelog :cl: FleetingExpertise fix: The 'phantom round' bug with guns has been fixed fix: Ghosts can no longer toggle gun safety fix: Bulldogs no longer destroy shotgun shells from existence fix: Bows should no longer randomly break fix: A lot of jank involving the E-40 has been fixed /:cl: --- code/modules/projectiles/gun.dm | 19 ++++++++++++------- code/modules/projectiles/guns/ballistic.dm | 2 +- .../projectiles/guns/ballistic/assault.dm | 11 +++++++++-- .../projectiles/guns/ballistic/shotgun.dm | 1 + 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index d6b9e05413a9..b64e76d1f075 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -526,17 +526,22 @@ if(!has_safety) return - if(src == !user.get_active_held_item()) + if(src != user.get_active_held_item()) return - playsound(user, 'sound/weapons/gun/general/selector.ogg', 100, TRUE) + if(isliving(user) && in_range(src, user)) + toggle_safety(user) + +/obj/item/gun/proc/toggle_safety(mob/user, silent=FALSE) safety = !safety - user.visible_message( - span_notice("[user] turns the safety on [src] [safety ? "ON" : "OFF"]."), - span_notice("You turn the safety on [src] [safety ? "ON" : "OFF"]."), - vision_distance = COMBAT_MESSAGE_RANGE - ) + if(!silent) + playsound(user, 'sound/weapons/gun/general/selector.ogg', 100, TRUE) + user.visible_message( + span_notice("[user] turns the safety on [src] [safety ? "ON" : "OFF"]."), + span_notice("You turn the safety on [src] [safety ? "ON" : "OFF"]."), + ) + update_appearance() diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index a8e2a201c81a..642fcdf0c0b0 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -101,7 +101,7 @@ return if (!magazine) magazine = new mag_type(src) - chamber_round(TRUE) + chamber_round() update_appearance() /obj/item/gun/ballistic/update_icon_state() diff --git a/code/modules/projectiles/guns/ballistic/assault.dm b/code/modules/projectiles/guns/ballistic/assault.dm index 66f6699321c2..ab54f3dd247c 100644 --- a/code/modules/projectiles/guns/ballistic/assault.dm +++ b/code/modules/projectiles/guns/ballistic/assault.dm @@ -255,9 +255,10 @@ return ..() /obj/item/gun/ballistic/automatic/assault/e40/attackby(obj/item/attack_obj, mob/user, params) - if(istype(attack_obj, /obj/item/stock_parts/cell/gun) || istype(attack_obj, /obj/item/screwdriver)) - secondary.attack_self() + if(istype(attack_obj, /obj/item/stock_parts/cell/gun)) secondary.attackby(attack_obj, user, params) + if(istype(attack_obj, /obj/item/screwdriver)) + secondary.screwdriver_act(user, attack_obj,) else ..() @@ -303,6 +304,12 @@ update_icon() return + + +/obj/item/gun/ballistic/automatic/assault/e40/toggle_safety(mob/user, silent=FALSE) + . = ..() + secondary.toggle_safety(user, silent=TRUE) + //laser /obj/item/gun/energy/laser/e40_laser_secondary diff --git a/code/modules/projectiles/guns/ballistic/shotgun.dm b/code/modules/projectiles/guns/ballistic/shotgun.dm index de8b923fb967..8d4390398075 100644 --- a/code/modules/projectiles/guns/ballistic/shotgun.dm +++ b/code/modules/projectiles/guns/ballistic/shotgun.dm @@ -176,6 +176,7 @@ special_mags = TRUE semi_auto = TRUE internal_magazine = FALSE + casing_ejector = TRUE tac_reloads = TRUE pickup_sound = 'sound/items/handling/rifle_pickup.ogg' manufacturer = MANUFACTURER_SCARBOROUGH