mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 16:44:43 +01:00
Fix guns without magazines loaded making no fire sounds (#76196)
## About The Pull Request Runtimed from `90 / null` here. What's the point in a `?` sanity check if you don't default it to any values? Come on guys ## Why It's Good For The Game Bugfix ## Changelog 🆑 Melbert fix: Fix shooting guns without a magazine loaded making no fire sound effect /🆑
This commit is contained in:
@@ -50,7 +50,7 @@
|
||||
///Whether the gun will spawn loaded with a magazine
|
||||
var/spawnwithmagazine = TRUE
|
||||
///Compatible magazines with the gun
|
||||
var/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info
|
||||
var/obj/item/ammo_box/magazine/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info
|
||||
///Whether the sprite has a visible magazine or not
|
||||
var/mag_display = TRUE
|
||||
///Whether the sprite has a visible ammo display or not
|
||||
@@ -151,9 +151,11 @@
|
||||
AddElement(/datum/element/weapon_description, attached_proc = PROC_REF(add_notes_ballistic))
|
||||
|
||||
/obj/item/gun/ballistic/fire_sounds()
|
||||
var/frequency_to_use = sin((90/magazine?.max_ammo) * get_ammo())
|
||||
var/max_ammo = magazine?.max_ammo || initial(mag_type.max_ammo)
|
||||
var/current_ammo = get_ammo()
|
||||
var/frequency_to_use = sin((90 / max_ammo) * current_ammo)
|
||||
var/click_frequency_to_use = 1 - frequency_to_use * 0.75
|
||||
var/play_click = round(sqrt(magazine?.max_ammo * 2)) > get_ammo()
|
||||
var/play_click = round(sqrt(max_ammo * 2)) > current_ammo
|
||||
if(suppressed)
|
||||
playsound(src, suppressed_sound, suppressed_volume, vary_fire_sound, ignore_walls = FALSE, extrarange = SILENCED_SOUND_EXTRARANGE, falloff_distance = 0)
|
||||
if(play_click && click_on_low_ammo)
|
||||
|
||||
Reference in New Issue
Block a user