Fixes bullets making sounds in space and water (#33672)

* Bullet sounds

* explicit lists
This commit is contained in:
ShizCalev
2017-12-21 01:08:39 -05:00
committed by Emmett Gaines
parent 987c810260
commit b539341768
8 changed files with 55 additions and 11 deletions

View File

@@ -17,6 +17,7 @@
var/delay = 0 //Delay for energy weapons var/delay = 0 //Delay for energy weapons
var/click_cooldown_override = 0 //Override this to make your gun have a faster fire rate, in tenths of a second. 4 is the default gun cooldown. var/click_cooldown_override = 0 //Override this to make your gun have a faster fire rate, in tenths of a second. 4 is the default gun cooldown.
var/firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect //the visual effect appearing when the ammo is fired. var/firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect //the visual effect appearing when the ammo is fired.
var/heavy_metal = TRUE
/obj/item/ammo_casing/Initialize() /obj/item/ammo_casing/Initialize()
@@ -58,3 +59,47 @@
to_chat(user, "<span class='warning'>You fail to collect anything!</span>") to_chat(user, "<span class='warning'>You fail to collect anything!</span>")
else else
return ..() return ..()
/obj/item/ammo_casing/throw_impact(atom/A)
if(heavy_metal)
bounce_away(FALSE, NONE)
. = ..()
/obj/item/ammo_casing/proc/bounce_away(still_warm = FALSE, delay = 3)
SpinAnimation(10, 1)
update_icon()
var/turf/T = get_turf(src)
if(still_warm && T && (is_type_in_typecache(T, GLOB.bullet_bounce_away_sizzle)))
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, src, 'sound/items/welder.ogg', 20, 1), delay)
else if(T && (!is_type_in_typecache(T, GLOB.bullet_bounce_away_blacklist)))
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, src, 'sound/weapons/bulletremove.ogg', 60, 1), delay)
GLOBAL_LIST_INIT(bullet_bounce_away_sizzle, typecacheof(list(
/turf/closed/indestructible/rock/snow,
/turf/closed/wall/ice,
/turf/closed/wall/mineral/snow,
/turf/open/floor/grass/snow,
/turf/open/floor/holofloor/snow,
/turf/open/floor/plating/asteroid/snow,
/turf/open/floor/plating/ice,
/turf/open/water)))
GLOBAL_LIST_INIT(bullet_bounce_away_blacklist, typecacheof(list(
/turf/closed/indestructible/rock/snow,
/turf/closed/indestructible/splashscreen,
/turf/closed/wall/mineral/snow,
/turf/open/chasm,
/turf/open/floor/carpet,
/turf/open/floor/grass,
/turf/open/floor/holofloor/beach,
/turf/open/floor/holofloor/carpet,
/turf/open/floor/holofloor/grass,
/turf/open/floor/holofloor/hyperspace,
/turf/open/floor/holofloor/snow,
/turf/open/floor/plating/asteroid/snow,
/turf/open/floor/plating/beach,
/turf/open/indestructible/reebe_void,
/turf/open/lava,
/turf/open/space,
/turf/open/water,
/turf/template_noop)))

View File

@@ -4,6 +4,7 @@
/obj/item/ammo_casing/caseless /obj/item/ammo_casing/caseless
desc = "A caseless bullet casing." desc = "A caseless bullet casing."
firing_effect_type = null firing_effect_type = null
heavy_metal = FALSE
/obj/item/ammo_casing/caseless/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread) /obj/item/ammo_casing/caseless/fire_casing(atom/target, mob/living/user, params, distro, quiet, zone_override, spread)
if (..()) //successfully firing if (..()) //successfully firing

View File

@@ -7,6 +7,7 @@
var/select_name = "energy" var/select_name = "energy"
fire_sound = 'sound/weapons/laser.ogg' fire_sound = 'sound/weapons/laser.ogg'
firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect/energy firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect/energy
heavy_metal = FALSE
/obj/item/ammo_casing/energy/chameleon /obj/item/ammo_casing/energy/chameleon
projectile_type = /obj/item/projectile/energy/chameleon projectile_type = /obj/item/projectile/energy/chameleon

View File

@@ -3,6 +3,7 @@
desc = "I didn't even know magic needed ammo..." desc = "I didn't even know magic needed ammo..."
projectile_type = /obj/item/projectile/magic projectile_type = /obj/item/projectile/magic
firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect/magic firing_effect_type = /obj/effect/temp_visual/dir_setting/firing_effect/magic
heavy_metal = FALSE
/obj/item/ammo_casing/magic/change /obj/item/ammo_casing/magic/change
projectile_type = /obj/item/projectile/magic/change projectile_type = /obj/item/projectile/magic/change

View File

@@ -96,9 +96,10 @@
/obj/item/ammo_box/attack_self(mob/user) /obj/item/ammo_box/attack_self(mob/user)
var/obj/item/ammo_casing/A = get_round() var/obj/item/ammo_casing/A = get_round()
if(A) if(A)
user.put_in_hands(A) if(!user.put_in_hands(A))
A.bounce_away(FALSE, NONE)
playsound(src, 'sound/weapons/bulletinsert.ogg', 60, 1)
to_chat(user, "<span class='notice'>You remove a round from \the [src]!</span>") to_chat(user, "<span class='notice'>You remove a round from \the [src]!</span>")
playsound(A, 'sound/weapons/bulletremove.ogg', 60, 1)
update_icon() update_icon()
/obj/item/ammo_box/update_icon() /obj/item/ammo_box/update_icon()

View File

@@ -31,8 +31,7 @@
if(istype(AC)) //there's a chambered round if(istype(AC)) //there's a chambered round
if(casing_ejector) if(casing_ejector)
AC.forceMove(drop_location()) //Eject casing onto ground. AC.forceMove(drop_location()) //Eject casing onto ground.
AC.SpinAnimation(10, 1) //next gen special effects AC.bounce_away(TRUE)
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, AC, 'sound/weapons/bulletremove.ogg', 60, 1), 3)
chambered = null chambered = null
else if(empty_chamber) else if(empty_chamber)
chambered = null chambered = null
@@ -125,8 +124,7 @@
to_chat(user, "<span class='notice'>You pull the magazine out of \the [src].</span>") to_chat(user, "<span class='notice'>You pull the magazine out of \the [src].</span>")
else if(chambered) else if(chambered)
AC.forceMove(drop_location()) AC.forceMove(drop_location())
AC.SpinAnimation(10, 1) AC.bounce_away()
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, AC, 'sound/weapons/bulletremove.ogg', 60, 1), 3)
chambered = null chambered = null
to_chat(user, "<span class='notice'>You unload the round from \the [src]'s chamber.</span>") to_chat(user, "<span class='notice'>You unload the round from \the [src]'s chamber.</span>")
playsound(src, "gun_slide_lock", 70, 1) playsound(src, "gun_slide_lock", 70, 1)

View File

@@ -40,9 +40,7 @@
CB = magazine.get_round(0) CB = magazine.get_round(0)
if(CB) if(CB)
CB.forceMove(drop_location()) CB.forceMove(drop_location())
CB.SpinAnimation(10, 1) CB.bounce_away(FALSE, NONE)
CB.update_icon()
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, CB, 'sound/weapons/bulletremove.ogg', 60, 1), 3)
num_unloaded++ num_unloaded++
if (num_unloaded) if (num_unloaded)
to_chat(user, "<span class='notice'>You unload [num_unloaded] shell\s from [src].</span>") to_chat(user, "<span class='notice'>You unload [num_unloaded] shell\s from [src].</span>")

View File

@@ -57,8 +57,7 @@
/obj/item/gun/ballistic/shotgun/proc/pump_unload(mob/M) /obj/item/gun/ballistic/shotgun/proc/pump_unload(mob/M)
if(chambered)//We have a shell in the chamber if(chambered)//We have a shell in the chamber
chambered.forceMove(drop_location())//Eject casing chambered.forceMove(drop_location())//Eject casing
chambered.SpinAnimation(10, 1) chambered.bounce_away()
addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, chambered, 'sound/weapons/bulletremove.ogg', 60, 1), 3)
chambered = null chambered = null
/obj/item/gun/ballistic/shotgun/proc/pump_reload(mob/M) /obj/item/gun/ballistic/shotgun/proc/pump_reload(mob/M)