From a9d452a24de5b64d8f2f7604eb1c60c3f2466d62 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Mon, 30 Apr 2018 13:52:52 -0400 Subject: [PATCH 1/2] Merge pull request #37549 from ShizCalev/bounce_away-fixes Resolved var name conflict for bounce_away() --- code/game/turfs/closed.dm | 3 ++ code/game/turfs/simulated/chasm.dm | 1 + .../game/turfs/simulated/floor/fancy_floor.dm | 3 ++ .../turfs/simulated/floor/plating/asteroid.dm | 2 + .../simulated/floor/plating/misc_plating.dm | 2 + code/game/turfs/simulated/lava.dm | 1 + code/game/turfs/simulated/reebe_void.dm | 1 + .../turfs/simulated/wall/mineral_walls.dm | 2 + code/game/turfs/simulated/wall/misc_walls.dm | 1 + code/game/turfs/simulated/water.dm | 2 + code/game/turfs/space/space.dm | 1 + code/game/turfs/turf.dm | 4 ++ code/modules/holodeck/turfs.dm | 7 ++++ code/modules/mapping/reader.dm | 1 + .../projectiles/ammunition/_ammunition.dm | 42 +++---------------- 15 files changed, 37 insertions(+), 36 deletions(-) diff --git a/code/game/turfs/closed.dm b/code/game/turfs/closed.dm index c9848fb793..657bf89a34 100644 --- a/code/game/turfs/closed.dm +++ b/code/game/turfs/closed.dm @@ -44,6 +44,7 @@ icon = 'icons/blank_title.png' icon_state = "" layer = FLY_LAYER + bullet_bounce_sound = null /turf/closed/indestructible/splashscreen/New() SStitle.splash_turf = src @@ -102,6 +103,8 @@ desc = "An extremely densely-packed rock, sheeted over with centuries worth of ice and snow." icon = 'icons/turf/walls.dmi' icon_state = "snowrock" + bullet_sizzle = TRUE + bullet_bounce_sound = null /turf/closed/indestructible/rock/snow/ice name = "iced rock" diff --git a/code/game/turfs/simulated/chasm.dm b/code/game/turfs/simulated/chasm.dm index 93590e935c..0ac45562a5 100644 --- a/code/game/turfs/simulated/chasm.dm +++ b/code/game/turfs/simulated/chasm.dm @@ -8,6 +8,7 @@ icon_state = "smooth" canSmoothWith = list(/turf/open/floor/fakepit, /turf/open/chasm) density = TRUE //This will prevent hostile mobs from pathing into chasms, while the canpass override will still let it function like an open turf + bullet_bounce_sound = null //abandon all hope ye who enter /turf/open/chasm/Initialize() . = ..() diff --git a/code/game/turfs/simulated/floor/fancy_floor.dm b/code/game/turfs/simulated/floor/fancy_floor.dm index e664c62023..5d028c6403 100644 --- a/code/game/turfs/simulated/floor/fancy_floor.dm +++ b/code/game/turfs/simulated/floor/fancy_floor.dm @@ -67,6 +67,7 @@ floor_tile = /obj/item/stack/tile/grass broken_states = list("sand") flags_1 = NONE + bullet_bounce_sound = null var/ore_type = /obj/item/stack/ore/glass var/turfverb = "uproot" @@ -93,6 +94,7 @@ floor_tile = null initial_gas_mix = "o2=22;n2=82;TEMP=180" slowdown = 2 + bullet_sizzle = TRUE /turf/open/floor/grass/snow/try_replace_tile(obj/item/stack/tile/T, mob/user, params) return @@ -142,6 +144,7 @@ smooth = SMOOTH_TRUE canSmoothWith = list(/turf/open/floor/carpet) flags_1 = NONE + bullet_bounce_sound = null /turf/open/floor/carpet/examine(mob/user) ..() diff --git a/code/game/turfs/simulated/floor/plating/asteroid.dm b/code/game/turfs/simulated/floor/plating/asteroid.dm index 8cc61700d3..3877868ca2 100644 --- a/code/game/turfs/simulated/floor/plating/asteroid.dm +++ b/code/game/turfs/simulated/floor/plating/asteroid.dm @@ -279,6 +279,8 @@ planetary_atmos = TRUE archdrops = list(/obj/item/stack/sheet/mineral/snow = list(ARCH_PROB = 100, ARCH_MAXDROP = 5)) burnt_states = list("snow_dug") + bullet_sizzle = TRUE + bullet_bounce_sound = null /turf/open/floor/plating/asteroid/snow/burn_tile() if(!burnt) diff --git a/code/game/turfs/simulated/floor/plating/misc_plating.dm b/code/game/turfs/simulated/floor/plating/misc_plating.dm index 12edefb680..b21e361639 100644 --- a/code/game/turfs/simulated/floor/plating/misc_plating.dm +++ b/code/game/turfs/simulated/floor/plating/misc_plating.dm @@ -88,6 +88,7 @@ icon = 'icons/misc/beach.dmi' flags_1 = NONE attachment_holes = FALSE + bullet_bounce_sound = null /turf/open/floor/plating/beach/try_replace_tile(obj/item/stack/tile/T, mob/user, params) return @@ -144,6 +145,7 @@ baseturfs = /turf/open/floor/plating/ice slowdown = 1 attachment_holes = FALSE + bullet_sizzle = TRUE /turf/open/floor/plating/ice/Initialize() . = ..() diff --git a/code/game/turfs/simulated/lava.dm b/code/game/turfs/simulated/lava.dm index f8ab060853..316391f8de 100644 --- a/code/game/turfs/simulated/lava.dm +++ b/code/game/turfs/simulated/lava.dm @@ -10,6 +10,7 @@ light_range = 2 light_power = 0.75 light_color = LIGHT_COLOR_LAVA + bullet_bounce_sound = 'sound/items/welder2.ogg' /turf/open/lava/ex_act(severity, target) contents_explosion(severity, target) diff --git a/code/game/turfs/simulated/reebe_void.dm b/code/game/turfs/simulated/reebe_void.dm index 3e40ebed64..624525d11d 100644 --- a/code/game/turfs/simulated/reebe_void.dm +++ b/code/game/turfs/simulated/reebe_void.dm @@ -4,6 +4,7 @@ layer = SPACE_LAYER baseturfs = /turf/open/indestructible/reebe_void planetary_atmos = TRUE + bullet_bounce_sound = null //forever falling /turf/open/indestructible/reebe_void/Initialize(mapload) . = ..() diff --git a/code/game/turfs/simulated/wall/mineral_walls.dm b/code/game/turfs/simulated/wall/mineral_walls.dm index 4f85d45d58..c8ec3a5c5f 100644 --- a/code/game/turfs/simulated/wall/mineral_walls.dm +++ b/code/game/turfs/simulated/wall/mineral_walls.dm @@ -167,6 +167,8 @@ sheet_type = /obj/item/stack/sheet/mineral/snow canSmoothWith = null girder_type = null + bullet_sizzle = TRUE + bullet_bounce_sound = null /turf/closed/wall/mineral/abductor name = "alien wall" diff --git a/code/game/turfs/simulated/wall/misc_walls.dm b/code/game/turfs/simulated/wall/misc_walls.dm index 7012c5f6d8..f40f74787a 100644 --- a/code/game/turfs/simulated/wall/misc_walls.dm +++ b/code/game/turfs/simulated/wall/misc_walls.dm @@ -158,6 +158,7 @@ canSmoothWith = null hardness = 35 slicing_duration = 150 //welding through the ice+metal + bullet_sizzle = TRUE /turf/closed/wall/rust name = "rusted wall" diff --git a/code/game/turfs/simulated/water.dm b/code/game/turfs/simulated/water.dm index eb6fe8a194..3977ad1955 100644 --- a/code/game/turfs/simulated/water.dm +++ b/code/game/turfs/simulated/water.dm @@ -7,6 +7,8 @@ initial_gas_mix = LAVALAND_DEFAULT_ATMOS planetary_atmos = TRUE slowdown = 1 + bullet_sizzle = TRUE + bullet_bounce_sound = null //needs a splashing sound one day. /turf/open/water/Initialize() . = ..() diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index ed0fa395ea..8d610a962d 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -17,6 +17,7 @@ layer = SPACE_LAYER light_power = 0.25 dynamic_lighting = DYNAMIC_LIGHTING_DISABLED + bullet_bounce_sound = null /turf/open/space/basic/New() //Do not convert to Initialize diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index a40991b954..c6d2f66900 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -29,6 +29,10 @@ var/requires_activation //add to air processing after initialize? var/changing_turf = FALSE + var/bullet_bounce_sound = 'sound/weapons/bulletremove.ogg' //sound played when a shell casing is ejected ontop of the turf. + var/bullet_sizzle = FALSE //used by ammo_casing/bounce_away() to determine if the shell casing should make a sizzle sound when it's ejected over the turf + //IE if the turf is supposed to be water, set TRUE. + /turf/vv_edit_var(var_name, new_value) var/static/list/banned_edits = list("x", "y", "z") if(var_name in banned_edits) diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index a9ec1ac9f1..878026f843 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -27,11 +27,13 @@ gender = PLURAL name = "lush grass" icon_state = "grass" + bullet_bounce_sound = null /turf/open/floor/holofloor/beach name = "sand" icon = 'icons/misc/beach.dmi' icon_state = "sand" + bullet_bounce_sound = null /turf/open/floor/holofloor/beach/coast_t name = "coastline" @@ -44,6 +46,7 @@ /turf/open/floor/holofloor/beach/water name = "water" icon_state = "water" + bullet_sizzle = TRUE /turf/open/floor/holofloor/asteroid name = "asteroid" @@ -76,6 +79,7 @@ name = "hyperspace" icon = 'icons/turf/space.dmi' icon_state = "speedspace_ns_1" + bullet_bounce_sound = null /turf/open/floor/holofloor/hyperspace/Initialize() icon_state = "speedspace_ns_[(x + 5*y + (y%2+1)*7)%15+1]" @@ -93,6 +97,7 @@ floor_tile = /obj/item/stack/tile/carpet smooth = SMOOTH_TRUE canSmoothWith = null + bullet_bounce_sound = null /turf/open/floor/holofloor/carpet/Initialize() . = ..() @@ -110,6 +115,8 @@ icon = 'icons/turf/snow.dmi' icon_state = "snow" slowdown = 2 + bullet_sizzle = TRUE + bullet_bounce_sound = null /turf/open/floor/holofloor/snow/cold initial_gas_mix = "nob=7500;TEMP=2.7" diff --git a/code/modules/mapping/reader.dm b/code/modules/mapping/reader.dm index c0d9e65653..381ce4bffe 100644 --- a/code/modules/mapping/reader.dm +++ b/code/modules/mapping/reader.dm @@ -474,3 +474,4 @@ GLOBAL_DATUM_INIT(_preloader, /dmm_suite/preloader, new) /turf/template_noop name = "Turf Passthrough" icon_state = "noop" + bullet_bounce_sound = null diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index c2c477f49b..96ffbd9355 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -66,41 +66,11 @@ bounce_away(FALSE, NONE) . = ..() -/obj/item/ammo_casing/proc/bounce_away(still_warm = FALSE, delay = 3) - SpinAnimation(10, 1) +/obj/item/ammo_casing/proc/bounce_away(still_warm = FALSE, bounce_delay = 3) update_icon() + SpinAnimation(10, 1) 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))) + if(still_warm && T && T.bullet_sizzle) + addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, src, 'sound/items/welder.ogg', 20, 1), bounce_delay) //If the turf is made of water and the shell casing is still hot, make a sizzling sound when it's ejected. + else if(T && T.bullet_bounce_sound) + addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, src, T.bullet_bounce_sound, 60, 1), bounce_delay) //Soft / non-solid turfs that shouldn't make a sound when a shell casing is ejected over them.