Skip to content

Commit

Permalink
Various gun gunfixes (#2599)
Browse files Browse the repository at this point in the history
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may
not be viewable. -->
<!-- You can view Contributing.MD for a detailed description of the pull
request process. -->

## 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:
  • Loading branch information
rye-rice authored Jan 12, 2024
1 parent 48ac326 commit 31932c6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
19 changes: 12 additions & 7 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "<span class='green'>ON</span>" : "<span class='red'>OFF</span>"]."),
span_notice("You turn the safety on [src] [safety ? "<span class='green'>ON</span>" : "<span class='red'>OFF</span>"]."),
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 ? "<span class='green'>ON</span>" : "<span class='red'>OFF</span>"]."),
span_notice("You turn the safety on [src] [safety ? "<span class='green'>ON</span>" : "<span class='red'>OFF</span>"]."),
)

update_appearance()


Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
11 changes: 9 additions & 2 deletions code/modules/projectiles/guns/ballistic/assault.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
..()

Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/modules/projectiles/guns/ballistic/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 31932c6

Please sign in to comment.