Confine Elevator Music to Elevators (#75464)

Refactors elevator music to originate from an abstract object rather
than the elevator control panel.
Elevator music is applied while you are within a certain radius of this
object and cuts off immediately upon exiting (largely because as far as
I know you can't obtain playing sounds to fade them out in byond).
As a side-effect of this refactor it also isn't audible to ghosts at
all.
This commit is contained in:
Jacquerel
2023-05-27 22:14:36 +01:00
committed by GitHub
parent dc64f47f98
commit 2732e96cff
20 changed files with 4409 additions and 4272 deletions
+113 -110
View File
@@ -516,6 +516,14 @@
/obj/effect/turf_decal/weather/snow/corner,
/turf/open/floor/glass/reinforced/icemoon,
/area/icemoon/surface/outdoors/nospawn)
"akZ" = (
/obj/structure/window/reinforced/spawner/directional/south,
/obj/structure/flora/bush/jungle/a/style_random,
/obj/structure/flora/bush/sparsegrass/style_random,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"alb" = (
/obj/structure/transit_tube_pod,
/obj/structure/transit_tube/station/reverse/flipped{
@@ -6786,6 +6794,14 @@
/obj/machinery/atmospherics/components/unary/vent_pump/on/layer4,
/turf/open/floor/iron/dark,
/area/station/service/chapel/office)
"ceS" = (
/obj/machinery/mech_bay_recharge_port{
dir = 1
},
/obj/structure/window/reinforced/spawner/directional/south,
/obj/effect/turf_decal/siding/white,
/turf/open/floor/iron/smooth,
/area/mine/mechbay)
"cfe" = (
/obj/structure/cable,
/obj/machinery/holopad/secure,
@@ -10359,13 +10375,6 @@
/obj/effect/mapping_helpers/airlock/access/all/security/brig,
/turf/open/floor/iron/dark/textured,
/area/station/security/execution/transfer)
"dhj" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_edge{
dir = 1
},
/area/station/command/gateway)
"dhk" = (
/obj/structure/table/reinforced,
/obj/machinery/camera{
@@ -12010,6 +12019,15 @@
/obj/effect/mapping_helpers/airlock/access/all/command/captain,
/turf/open/floor/plating,
/area/station/maintenance/central/lesser)
"dHb" = (
/obj/structure/flora/grass/jungle/b/style_random,
/obj/structure/window/reinforced/spawner/directional/west,
/obj/structure/window/reinforced/spawner/directional/south,
/obj/item/throwing_star/toy,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"dHg" = (
/obj/machinery/camera/directional/south{
c_tag = "Fore Primary Hallway - Courtroom Hallway"
@@ -12612,6 +12630,13 @@
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply,
/turf/open/floor/iron/white,
/area/station/medical/virology)
"dRD" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_edge{
dir = 1
},
/area/station/command/gateway)
"dSm" = (
/obj/effect/turf_decal/trimline/red/filled/line{
dir = 1
@@ -20459,6 +20484,14 @@
dir = 9
},
/area/station/science/research)
"gwy" = (
/obj/structure/window/reinforced/spawner/directional/south,
/obj/structure/flora/bush/sparsegrass/style_random,
/obj/machinery/light/warm/directional/north,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"gwz" = (
/obj/effect/landmark/start/hangover,
/obj/effect/turf_decal/tile/blue/opposingcorners{
@@ -24908,15 +24941,6 @@
/obj/machinery/teleport/hub,
/turf/open/floor/plating,
/area/station/ai_monitored/turret_protected/aisat_interior)
"hWs" = (
/obj/structure/flora/grass/jungle/b/style_random,
/obj/structure/window/reinforced/spawner/directional/west,
/obj/structure/window/reinforced/spawner/directional/south,
/obj/item/throwing_star/toy,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"hWu" = (
/obj/machinery/light/directional/east,
/turf/open/floor/engine,
@@ -27125,13 +27149,6 @@
},
/turf/open/floor/iron,
/area/station/command/bridge)
"iGW" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_corner{
dir = 1
},
/area/station/command/gateway)
"iHc" = (
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer2{
dir = 8
@@ -32296,6 +32313,22 @@
/obj/effect/turf_decal/tile/yellow/opposingcorners,
/turf/open/floor/iron/dark,
/area/station/engineering/atmos/project)
"koA" = (
/obj/effect/turf_decal/stripes/line{
dir = 4
},
/obj/structure/industrial_lift{
radial_travel = 0
},
/obj/effect/landmark/lift_id{
specific_lift_id = "publicElevator"
},
/obj/machinery/light/floor,
/obj/effect/abstract/elevator_music_zone{
linked_elevator_id = "publicElevator"
},
/turf/open/floor/plating/elevatorshaft,
/area/mine/storage)
"koB" = (
/obj/effect/landmark/start/hangover,
/obj/machinery/light/directional/north,
@@ -33748,20 +33781,6 @@
},
/turf/open/floor/iron/dark,
/area/station/engineering/transit_tube)
"kKE" = (
/obj/structure/window/reinforced/spawner/directional/east,
/obj/machinery/computer/mech_bay_power_console{
dir = 8
},
/obj/structure/window/reinforced/spawner/directional/south,
/obj/effect/turf_decal/siding/white{
dir = 4
},
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer2{
dir = 8
},
/turf/open/floor/iron/dark,
/area/mine/mechbay)
"kKH" = (
/obj/item/radio/intercom/directional/south,
/obj/effect/turf_decal/tile/yellow/half/contrasted,
@@ -41734,14 +41753,6 @@
},
/turf/open/floor/iron/white,
/area/station/science/explab)
"npV" = (
/obj/structure/window/reinforced/spawner/directional/south,
/obj/structure/flora/bush/sparsegrass/style_random,
/obj/machinery/light/warm/directional/north,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"nqb" = (
/obj/machinery/atmospherics/pipe/smart/simple/cyan/visible,
/turf/open/floor/plating/snowed/icemoon,
@@ -46408,6 +46419,13 @@
/obj/machinery/light/warm/directional/west,
/turf/open/floor/iron,
/area/station/security/prison/workout)
"oJT" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_corner{
dir = 1
},
/area/station/command/gateway)
"oKb" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/door/poddoor/shutters/preopen{
@@ -50686,13 +50704,6 @@
/obj/effect/mapping_helpers/broken_floor,
/turf/open/floor/plating,
/area/station/maintenance/fore)
"qdR" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_corner{
dir = 4
},
/area/station/command/gateway)
"qea" = (
/obj/structure/rack,
/obj/item/storage/toolbox/mechanical{
@@ -51240,6 +51251,11 @@
},
/turf/open/floor/plating,
/area/station/maintenance/starboard/fore)
"qoK" = (
/obj/structure/flora/rock/style_random,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/misc/asteroid/snow/icemoon,
/area/station/maintenance/port/aft)
"qoM" = (
/obj/effect/decal/cleanable/dirt,
/obj/effect/mapping_helpers/burnt_floor,
@@ -52290,11 +52306,6 @@
},
/turf/open/floor/iron,
/area/station/service/hydroponics)
"qFU" = (
/obj/structure/cable/multilayer/multiz,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/plating/snowed/icemoon,
/area/station/maintenance/port/aft)
"qFX" = (
/obj/machinery/door/airlock{
name = "Custodial Closet"
@@ -56471,14 +56482,6 @@
},
/turf/open/floor/iron/large,
/area/station/commons/storage/primary)
"rXw" = (
/obj/machinery/mech_bay_recharge_port{
dir = 1
},
/obj/structure/window/reinforced/spawner/directional/south,
/obj/effect/turf_decal/siding/white,
/turf/open/floor/iron/smooth,
/area/mine/mechbay)
"rXD" = (
/obj/machinery/button/door/directional/east{
id = "xenobio7";
@@ -58153,6 +58156,11 @@
/obj/structure/sign/poster/random/directional/east,
/turf/open/floor/wood/parquet,
/area/station/commons/lounge)
"sxY" = (
/obj/structure/cable/multilayer/multiz,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/plating/snowed/icemoon,
/area/station/maintenance/port/aft)
"sxZ" = (
/obj/structure/closet/emcloset,
/obj/effect/turf_decal/stripes/line{
@@ -58246,13 +58254,6 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron,
/area/mine/laborcamp)
"szx" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_edge{
dir = 1
},
/area/station/command/gateway)
"szz" = (
/obj/machinery/newscaster/directional/north,
/obj/effect/turf_decal/tile/red{
@@ -64221,6 +64222,20 @@
},
/turf/open/lava/plasma/ice_moon,
/area/icemoon/underground/explored)
"uwM" = (
/obj/structure/window/reinforced/spawner/directional/east,
/obj/machinery/computer/mech_bay_power_console{
dir = 8
},
/obj/structure/window/reinforced/spawner/directional/south,
/obj/effect/turf_decal/siding/white{
dir = 4
},
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer2{
dir = 8
},
/turf/open/floor/iron/dark,
/area/mine/mechbay)
"uwO" = (
/obj/machinery/door/airlock/maintenance{
name = "Custodial Maintenance"
@@ -66442,6 +66457,13 @@
/obj/effect/spawner/random/medical/two_percent_xeno_egg_spawner,
/turf/open/floor/engine,
/area/station/science/xenobiology)
"viV" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/scrubbers/hidden/layer2,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_edge{
dir = 1
},
/area/station/command/gateway)
"vjh" = (
/turf/closed/wall/r_wall,
/area/mine/laborcamp)
@@ -72834,11 +72856,6 @@
"xgy" = (
/turf/open/openspace,
/area/station/service/hydroponics)
"xgB" = (
/obj/structure/flora/rock/style_random,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/misc/asteroid/snow/icemoon,
/area/station/maintenance/port/aft)
"xgH" = (
/obj/structure/closet/crate/coffin,
/obj/effect/decal/cleanable/dirt/dust,
@@ -74014,19 +74031,6 @@
/obj/structure/cable,
/turf/open/floor/iron,
/area/mine/laborcamp/security)
"xzs" = (
/obj/effect/turf_decal/stripes/line{
dir = 4
},
/obj/structure/industrial_lift{
radial_travel = 0
},
/obj/effect/landmark/lift_id{
specific_lift_id = "publicElevator"
},
/obj/machinery/light/floor,
/turf/open/floor/plating/elevatorshaft,
/area/mine/storage)
"xzI" = (
/obj/machinery/status_display/evac/directional/north,
/obj/effect/spawner/random/vending/colavend,
@@ -74696,6 +74700,13 @@
/obj/effect/mapping_helpers/broken_floor,
/turf/open/floor/plating,
/area/station/maintenance/port/fore)
"xKb" = (
/obj/machinery/atmospherics/pipe/smart/manifold4w/supply/hidden/layer4,
/obj/structure/window/reinforced/spawner/directional/south,
/turf/open/floor/iron/dark/smooth_corner{
dir = 4
},
/area/station/command/gateway)
"xKd" = (
/obj/machinery/meter,
/obj/machinery/atmospherics/pipe/smart/simple/green/visible,
@@ -75768,14 +75779,6 @@
/obj/effect/turf_decal/bot_red,
/turf/open/floor/plating,
/area/station/maintenance/fore/lesser)
"ycj" = (
/obj/structure/window/reinforced/spawner/directional/south,
/obj/structure/flora/bush/jungle/a/style_random,
/obj/structure/flora/bush/sparsegrass/style_random,
/turf/open/misc/ashplanet/wateryrock{
initial_gas_mix = "o2=22;n2=82;TEMP=293.15"
},
/area/station/security/prison/rec)
"yco" = (
/obj/effect/turf_decal/trimline/yellow/filled/line{
dir = 1
@@ -97002,7 +97005,7 @@ ovF
uUT
hRD
nKV
kKE
uwM
dsn
iYA
nUi
@@ -97259,7 +97262,7 @@ bod
gIu
hOo
sgA
rXw
ceS
xOb
eLS
iwf
@@ -102834,7 +102837,7 @@ vVH
vVH
vVH
vVH
hWs
dHb
kqR
ugd
nNn
@@ -103091,7 +103094,7 @@ vVH
fps
usS
vVH
npV
gwy
ixw
kqR
gzV
@@ -103348,7 +103351,7 @@ eTv
dFX
nbm
vVH
ycj
akZ
pdx
uma
nNn
@@ -170225,7 +170228,7 @@ vcj
vcj
vcj
vOY
xzs
koA
uFw
vcj
aVq
@@ -229105,7 +229108,7 @@ pRj
daS
tut
qai
xgB
qoK
pXv
exy
pXv
@@ -229362,7 +229365,7 @@ ptf
daS
jSe
xcW
qFU
sxY
tFs
pRj
ptf
@@ -230338,7 +230341,7 @@ biY
biY
qhG
mQh
qdR
xKb
vMc
xMW
apI
@@ -230595,7 +230598,7 @@ biY
rcP
jXN
vVj
szx
dRD
jFf
uOj
bgF
@@ -231109,7 +231112,7 @@ biY
vVj
jXN
rcP
dhj
viV
gbd
uOj
pdW
@@ -231366,7 +231369,7 @@ biY
biY
keF
iLi
iGW
oJT
spV
gad
gAk
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1
View File
@@ -8,6 +8,7 @@
#define CHANNEL_BUZZ 1018
#define CHANNEL_TRAITOR 1017
#define CHANNEL_CHARGED_SPELL 1016
#define CHANNEL_ELEVATOR 1015
///Default range of a sound.
#define SOUND_RANGE 17
+11 -1
View File
@@ -60,6 +60,8 @@
var/skip_starting_sounds = FALSE
/// If true, plays directly to provided atoms instead of from them.
var/direct
/// Sound channel to play on, random if not provided
var/sound_channel
/datum/looping_sound/New(_parent, start_immediately = FALSE, _direct = FALSE, _skip_starting_sounds = FALSE)
if(!mid_sounds)
@@ -97,6 +99,7 @@
* * null_parent - Whether or not we should set the parent to null (useful when destroying the `looping_sound` itself). Defaults to FALSE.
*/
/datum/looping_sound/proc/stop(null_parent = FALSE)
stop_current()
if(null_parent)
set_parent(null)
if(!timer_id)
@@ -147,7 +150,7 @@
/datum/looping_sound/proc/play(soundfile, volume_override)
var/sound/sound_to_play = sound(soundfile)
if(direct)
sound_to_play.channel = SSsounds.random_available_channel()
sound_to_play.channel = sound_channel || SSsounds.random_available_channel()
sound_to_play.volume = volume_override || volume //Use volume as fallback if theres no override
SEND_SOUND(parent, sound_to_play)
else
@@ -215,6 +218,13 @@
start_wait = start_length
timer_id = addtimer(CALLBACK(src, PROC_REF(start_sound_loop)), start_wait, TIMER_CLIENT_TIME | TIMER_DELETE_ME | TIMER_STOPPABLE, SSsound_loops)
/// Stops sound playing on current channel, if specified
/datum/looping_sound/proc/stop_current()
if(!sound_channel || !ismob(parent))
return
var/mob/mob_parent = parent
mob_parent.stop_sound_channel(sound_channel)
/// Simple proc that's executed when the looping sound is stopped, so that the `end_sound` can be played, if there's one.
/datum/looping_sound/proc/on_stop()
if(end_sound && loop_started)
+4 -22
View File
@@ -1,28 +1,10 @@
/datum/looping_sound/elevator_music
start_sound = 'sound/ambience/music/elevator/elevator-01.ogg'
start_length = 7.62 SECONDS
/datum/looping_sound/local_forecast
mid_sounds = list(
'sound/ambience/music/elevator/elevator-01.ogg',
'sound/ambience/music/elevator/elevator-02.ogg',
'sound/ambience/music/elevator/elevator-03.ogg',
'sound/ambience/music/elevator/elevator-04.ogg',
'sound/ambience/music/elevator/elevator-05.ogg',
'sound/ambience/music/elevator/elevator-06.ogg',
'sound/ambience/music/elevator/elevator-07.ogg',
'sound/ambience/music/elevator/elevator-08.ogg',
'sound/ambience/music/elevator/robocop-short.ogg' = 1,
)
mid_length = 7.62 SECONDS
end_sound = 'sound/ambience/music/elevator/elevator-08.ogg'
mid_length = 61 SECONDS
volume = 20
falloff_exponent = 5
falloff_distance = 3
vary = FALSE
ignore_walls = FALSE
use_reverb = FALSE
each_once = TRUE
skip_starting_sounds = TRUE
in_order = TRUE
direct = TRUE
sound_channel = CHANNEL_ELEVATOR
@@ -83,3 +83,9 @@
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "sound_ship_ambience"
savefile_identifier = PREFERENCE_PLAYER
/// Controls hearing elevator music
/datum/preference/toggle/sound_elevator
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "sound_elevator"
savefile_identifier = PREFERENCE_PLAYER
@@ -0,0 +1,111 @@
GLOBAL_LIST_EMPTY(elevator_music)
/obj/effect/abstract/elevator_music_zone
name = "elevator music speaker"
desc = "You can't see this because it's mounted on the roof of the elevator."
anchored = TRUE
invisibility = INVISIBILITY_MAXIMUM // Setting this to ABSTRACT means it isn't moved by the lift
icon = 'icons/obj/art/musician.dmi'
icon_state = "piano"
/// What specific_lift_id do we link with?
var/linked_elevator_id = ""
/// Radius around this map helper in which to play the sound
var/range = 1
/// Sound loop type to use
var/soundloop_type = /datum/looping_sound/local_forecast
/// Proximity monitor which handles playing sounds to clients
var/datum/proximity_monitor/advanced/elevator_music_area/sound_player
/obj/effect/abstract/elevator_music_zone/Initialize(mapload)
. = ..()
if (!linked_elevator_id)
log_mapping("No elevator ID for elevator music provided at [AREACOORD(src)].")
return INITIALIZE_HINT_QDEL
GLOB.elevator_music[linked_elevator_id] = src
sound_player = new(src, range = src.range, soundloop_type = src.soundloop_type)
/obj/effect/abstract/elevator_music_zone/Destroy(force)
GLOB.elevator_music -= src
return ..()
/obj/effect/abstract/elevator_music_zone/proc/link_to_panel(atom/elevator_panel)
RegisterSignal(elevator_panel, COMSIG_MACHINERY_POWER_RESTORED, PROC_REF(on_panel_powered))
RegisterSignal(elevator_panel, COMSIG_MACHINERY_POWER_LOST, PROC_REF(on_panel_depowered))
RegisterSignal(elevator_panel, COMSIG_PARENT_QDELETING, PROC_REF(on_panel_destroyed))
/// Start sound loops when power is restored
/obj/effect/abstract/elevator_music_zone/proc/on_panel_powered()
SIGNAL_HANDLER
sound_player.turn_on()
/// Stop sound loops if power is lost
/obj/effect/abstract/elevator_music_zone/proc/on_panel_depowered()
SIGNAL_HANDLER
sound_player.turn_off()
/// Die if panel is destroyed, although currently they are invincible
/obj/effect/abstract/elevator_music_zone/proc/on_panel_destroyed()
SIGNAL_HANDLER
qdel(src)
/// Load or unload a looping sound when mobs enter or exit the area
/datum/proximity_monitor/advanced/elevator_music_area
edge_is_a_field = TRUE
/// Are we currently playing sounds?
var/enabled = TRUE
/// Looping sound datum type to play
var/soundloop_type
/// Assoc list of mobs to sound loops currently playing
var/list/tracked_mobs = list()
/datum/proximity_monitor/advanced/elevator_music_area/New(atom/_host, range, _ignore_if_not_on_turf, soundloop_type)
. = ..()
src.soundloop_type = soundloop_type
/datum/proximity_monitor/advanced/elevator_music_area/Destroy()
QDEL_LIST_ASSOC_VAL(tracked_mobs)
return ..()
/datum/proximity_monitor/advanced/elevator_music_area/field_turf_crossed(mob/entered, turf/location)
if (!istype(entered) || !entered.mind)
return
if (entered in tracked_mobs)
return
if (entered.client?.prefs.read_preference(/datum/preference/toggle/sound_elevator))
tracked_mobs[entered] = new soundloop_type(_parent = entered, _direct = TRUE, start_immediately = enabled)
else
tracked_mobs[entered] = null // Still add it to the list so we don't keep making this check
RegisterSignal(entered, COMSIG_PARENT_QDELETING, PROC_REF(mob_destroyed))
/datum/proximity_monitor/advanced/elevator_music_area/field_turf_uncrossed(mob/exited, turf/location)
if (!(exited in tracked_mobs))
return
if (exited.z == host.z && get_dist(exited, host) <= current_range)
return
qdel(tracked_mobs[exited])
tracked_mobs -= exited
UnregisterSignal(exited, COMSIG_PARENT_QDELETING)
/// Remove references on mob deletion
/datum/proximity_monitor/advanced/elevator_music_area/proc/mob_destroyed(mob/former_mob)
SIGNAL_HANDLER
if (former_mob in tracked_mobs)
qdel(tracked_mobs[former_mob])
tracked_mobs -= former_mob
/// Start sound loops playing
/datum/proximity_monitor/advanced/elevator_music_area/proc/turn_on()
enabled = TRUE
for (var/mob as anything in tracked_mobs)
var/datum/looping_sound/loop = tracked_mobs[mob]
loop.start()
/// Stop active sound loops
/datum/proximity_monitor/advanced/elevator_music_area/proc/turn_off()
enabled = FALSE
for (var/mob as anything in tracked_mobs)
var/datum/looping_sound/loop = tracked_mobs[mob]
loop.stop()
@@ -51,11 +51,6 @@
light_color = LIGHT_COLOR_DARK_BLUE
var/light_mask = "elev-light-mask"
/// The soundloop of elevator music
var/datum/looping_sound/elevator_music/elevator_music
/// Will the elevator music play?
var/elevator_music_toggle = TRUE
/obj/machinery/elevator_control_panel/Initialize(mapload)
. = ..()
@@ -69,21 +64,13 @@
// this is just here for redundancy's sake.
. = INITIALIZE_HINT_LATELOAD
if(elevator_music_toggle)
elevator_music = new(src, start_immediately = TRUE)
maploaded = mapload
// Maploaded panels link in LateInitialize...
if(mapload)
return
// And non-mapload panels link in Initialize
var/datum/lift_master/lift = get_associated_lift()
if(!lift)
return
lift_weakref = WEAKREF(lift)
populate_destinations_list(lift)
link_with_lift(log_error = FALSE)
/obj/machinery/elevator_control_panel/LateInitialize()
. = ..()
@@ -93,13 +80,21 @@
// This is exclusively for linking in mapload, just to ensure all elevator parts are created,
// and also so we can throw mapping errors to let people know if they messed up setup.
link_with_lift(log_error = TRUE)
/// Link with associated lift objects, only log failure to find a lift in LateInit because those are mapped in
/obj/machinery/elevator_control_panel/proc/link_with_lift(log_error = FALSE)
var/datum/lift_master/lift = get_associated_lift()
if(!lift)
log_mapping("Elevator control panel at [AREACOORD(src)] found no associated lift to link with, this may be a mapping error.")
if (log_error)
log_mapping("Elevator control panel at [AREACOORD(src)] found no associated lift to link with, this may be a mapping error.")
return
lift_weakref = WEAKREF(lift)
populate_destinations_list(lift)
if ((linked_elevator_id in GLOB.elevator_music))
var/obj/effect/abstract/elevator_music_zone/music = GLOB.elevator_music[linked_elevator_id]
music.link_to_panel(src)
/obj/machinery/elevator_control_panel/emag_act(mob/user, obj/item/card/emag/emag_card)
if(obj_flags & EMAGGED)
@@ -128,14 +123,6 @@
playsound(src, SFX_SPARKS, 100, TRUE, SHORT_RANGE_SOUND_EXTRARANGE)
balloon_alert(user, "safeties overridden")
/obj/machinery/elevator_control_panel/power_change()
if(machine_stat & (BROKEN|NOPOWER|EMPED))
elevator_music.stop()
else
elevator_music.start()
return ..()
/obj/machinery/elevator_control_panel/multitool_act(mob/living/user)
var/datum/lift_master/lift = lift_weakref?.resolve()
if(!lift)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
View File
@@ -3558,6 +3558,7 @@
#include "code\modules\industrial_lift\elevator\elevator_controller.dm"
#include "code\modules\industrial_lift\elevator\elevator_doors.dm"
#include "code\modules\industrial_lift\elevator\elevator_indicator.dm"
#include "code\modules\industrial_lift\elevator\elevator_music_zone.dm"
#include "code\modules\industrial_lift\elevator\elevator_panel.dm"
#include "code\modules\industrial_lift\tram\tram_doors.dm"
#include "code\modules\industrial_lift\tram\tram_floors.dm"
@@ -81,3 +81,9 @@ export const sound_ship_ambience: FeatureToggle = {
category: 'SOUND',
component: CheckboxInput,
};
export const sound_elevator: FeatureToggle = {
name: 'Enable elevator music',
category: 'SOUND',
component: CheckboxInput,
};