Skip to content

Commit

Permalink
A few little things
Browse files Browse the repository at this point in the history
  • Loading branch information
morrowwolf committed Oct 20, 2023
1 parent 2774d32 commit 5263ece
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions code/datums/ammo/ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
/// The flicker that plays when a bullet hits a target. Usually red. Can be nulled so it doesn't show up at all.
var/hit_effect_color = "#FF0000"

/// currently responsible for increasing firing sound volume ONLY
var/special = FALSE
/// Changes the freq of firing sound based on ammo type
var/firing_freq_offset = FALSE

/datum/ammo/New()
set_bullet_traits()
Expand Down
4 changes: 2 additions & 2 deletions code/datums/ammo/bullet/shotgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
damage = 140
penetration = ARMOR_PENETRATION_TIER_4
bonus_projectiles_amount = EXTRA_PROJECTILES_TIER_6
special = TRUE
firing_freq_offset = SOUND_FREQ_LOW

//buckshot variant only used by the masterkey shotgun attachment.
/datum/ammo/bullet/shotgun/buckshot/masterkey
Expand Down Expand Up @@ -197,7 +197,7 @@
max_range = 8
damage = 140
penetration = ARMOR_PENETRATION_TIER_4
special = TRUE
firing_freq_offset = SOUND_FREQ_LOW

/*
8 GAUGE SHOTGUN AMMO
Expand Down
1 change: 1 addition & 0 deletions code/datums/skills/uscm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ COMMAND STAFF
SKILL_VEHICLE = SKILL_VEHICLE_SMALL,
SKILL_JTAC = SKILL_JTAC_EXPERT,
SKILL_INTEL = SKILL_INTEL_TRAINED,
SKILL_SURGERY = SKILL_SURGERY_NOVICE,
)

/datum/skills/SEA
Expand Down
20 changes: 9 additions & 11 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1677,9 +1677,12 @@ not all weapons use normal magazines etc. load_into_chamber() itself is designed

projectile_to_fire.shot_from = src

return 1
if(user)
projectile_to_fire.firer = user
if(isliving(user))
projectile_to_fire.def_zone = user.zone_selected

#define SPECIAL_AMMUNITION_FIRING_VOLUME 100
return 1

/obj/item/weapon/gun/proc/play_firing_sounds(obj/projectile/projectile_to_fire, mob/user)
if(!user) //The gun only messages when fired by a user.
Expand All @@ -1692,13 +1695,10 @@ not all weapons use normal magazines etc. load_into_chamber() itself is designed
if(projectile_to_fire.ammo && projectile_to_fire.ammo.sound_override)
actual_sound = projectile_to_fire.ammo.sound_override

projectile_to_fire.firer = user
if(isliving(user))
projectile_to_fire.def_zone = user.zone_selected

//Guns with low ammo have their firing sound
var/firing_sndfreq = (current_mag && (current_mag.current_rounds / current_mag.max_rounds) > GUN_LOW_AMMO_PERCENTAGE) ? FALSE : SOUND_FREQ_HIGH
var/sound_volume = in_chamber.ammo.special ? SPECIAL_AMMUNITION_FIRING_VOLUME : firesound_volume

firing_sndfreq = in_chamber.ammo.firing_freq_offset ? in_chamber.ammo.firing_freq_offset : firing_sndfreq

//firing from an attachment
if(active_attachable && active_attachable.flags_attach_features & ATTACH_PROJECTILE)
Expand All @@ -1707,14 +1707,12 @@ not all weapons use normal magazines etc. load_into_chamber() itself is designed
else
if(!(flags_gun_features & GUN_SILENCED))
if (firing_sndfreq && fire_rattle)
playsound(user, fire_rattle, sound_volume, FALSE)//if the gun has a unique 'mag rattle' SFX play that instead of pitch shifting.
playsound(user, fire_rattle, firesound_volume, FALSE) //if the gun has a unique 'mag rattle' SFX play that instead of pitch shifting.
else
playsound(user, actual_sound, sound_volume, firing_sndfreq)
playsound(user, actual_sound, firesound_volume, firing_sndfreq)
else
playsound(user, actual_sound, 25, firing_sndfreq)

#undef SPECIAL_AMMUNITION_FIRING_VOLUME

/obj/item/weapon/gun/proc/simulate_scatter(obj/projectile/projectile_to_fire, atom/target, turf/curloc, turf/targloc, mob/user, bullets_fired = 1)
var/fire_angle = Get_Angle(curloc, targloc)
var/total_scatter_angle = projectile_to_fire.scatter
Expand Down

0 comments on commit 5263ece

Please sign in to comment.