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

* Bullet sounds

* explicit lists
This commit is contained in:
ShizCalev
2017-12-21 00:09:08 -06:00
committed by CitadelStationBot
parent 408cf32ddc
commit 92b018bed7
8 changed files with 55 additions and 11 deletions
+45
View File
@@ -17,6 +17,7 @@
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/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/New()
@@ -58,3 +59,47 @@
to_chat(user, "<span class='warning'>You fail to collect anything!</span>")
else
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)))