Skip to content

Commit

Permalink
Add: Shuttle sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-34 committed Jan 23, 2025
1 parent 6926460 commit b831056
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 1 deletion.
22 changes: 21 additions & 1 deletion code/modules/shuttle/mobile_port/mobile_port.dm
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,14 @@
// This previously was played from each door at max volume, and was one of the worst things I had ever seen.
// Now it's instead played from the nearest engine if close, or the first engine in the list if far since it doesn't really matter.
// Or a door if for some reason the shuttle has no engine, fuck oh hi daniel fuck it

// BANDASTATION ADDITION START - Allow shuttles to override the default sound paths
var/custom_sound = get_custom_sound(phase)
var/original_selected_sound = selected_sound
if(custom_sound)
selected_sound = custom_sound
// BANDASTATION ADDITION END - Allow shuttles to override the default sound paths

var/range = (engine_coeff * max(width, height))
var/long_range = range * 2.5
var/atom/distant_source
Expand All @@ -671,6 +679,7 @@
for(var/mob/zlevel_mobs as anything in SSmobs.clients_by_zlevel[z])
var/dist_far = get_dist(zlevel_mobs, distant_source)
if(dist_far <= long_range && dist_far > range)
selected_sound = original_selected_sound // BANDASTATION ADDITION - Allow shuttles to override the default sound paths
zlevel_mobs.playsound_local(distant_source, "sound/runtime/hyperspace/[selected_sound]_distance.ogg", 100)
else if(dist_far <= range)
var/source
Expand All @@ -683,7 +692,18 @@
if(dist_near < closest_dist)
source = engines
closest_dist = dist_near
zlevel_mobs.playsound_local(source, "sound/runtime/hyperspace/[selected_sound].ogg", 100)

// BANDASTATION ADDITION START - Allow shuttles to override the default sound paths
if(custom_sound)
zlevel_mobs.playsound_local(source, selected_sound, 100)
else
zlevel_mobs.playsound_local(source, "sound/runtime/hyperspace/[selected_sound].ogg", 100)
// BANDASTATION ADDITION END - Allow shuttles to override the default sound paths

// BANDASTATION ADDITION START - Allow shuttles to override the default sound paths
/obj/docking_port/mobile/proc/get_custom_sound(phase)
return null
// BANDASTATION ADDITION END - Allow shuttles to override the default sound paths

// Losing all initial engines should get you 2
// Adding another set of engines at 0.5 time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

#include "code/antagonists_intro.dm"
#include "code/closet.dm"
#include "code/shuttle.dm"
55 changes: 55 additions & 0 deletions modular_bandastation/aesthetics_sounds/code/shuttle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/obj/docking_port/mobile
/// Tracks whether the hyperspace warmup sound has been played during the shuttle's ignition phase
var/sound_played_start = FALSE
/// Tracks whether the hyperspace end sound has been played during the shuttle's call or landing phase
var/sound_played_end = FALSE
/// Custom sound for shuttle's HYPERSPACE_WARMUP. Doesn't include emergency & arrival shuttles
var/custom_hyperspace_warmup_sound = 'modular_bandastation/aesthetics_sounds/sound/shuttle/hyperspace_mini.ogg'
/// Custom sound for shuttle's HYPERSPACE_END. Doesn't include emergency & arrival shuttles
var/custom_hyperspace_end_sound = 'modular_bandastation/aesthetics_sounds/sound/shuttle/hyperspace_end_new.ogg'

/obj/docking_port/mobile/get_custom_sound(phase)
if(shuttle_id != "emergency" && shuttle_id != "arrival")
switch(phase)
if(HYPERSPACE_WARMUP)
return custom_hyperspace_warmup_sound
if(HYPERSPACE_END)
return custom_hyperspace_end_sound
return ..()

/obj/docking_port/mobile/check()
. = ..()
// We already have in core sounds for emergency & arrival shuttles
if(shuttle_id != "emergency" && shuttle_id != "arrival")
switch(mode)
if(SHUTTLE_IGNITING)
if(!sound_played_start)
var/list/areas = list()
for(var/area/shuttle/S in shuttle_areas)
areas += S
// Check if there are 2 seconds or less left before SHUTTLE_IGNITING ends
if(timeLeft(1) <= 3 SECONDS)
sound_played_start = TRUE
hyperspace_sound(HYPERSPACE_WARMUP, areas)

if(SHUTTLE_CALL)
if(!sound_played_end)
var/list/areas = list()
for(var/area/shuttle/S in shuttle_areas)
areas += S
// Check if there are 2 seconds or less left before SHUTTLE_CALL ends
if(timeLeft(1) <= 2 SECONDS)
sound_played_end = TRUE
hyperspace_sound(HYPERSPACE_END, areas)
// Call shuttle arrival sound on destination (docking) point
if(!destination_turf)
stack_trace("Destination turf is invalid. Sound not played.")
return
playsound(destination_turf, 'modular_bandastation/aesthetics_sounds/sound/shuttle/hyperspace_end_new.ogg', vol = 100, vary = TRUE, pressure_affected = FALSE)

if(SHUTTLE_IDLE)
// Our sounds should be played once
if(sound_played_start)
sound_played_start = FALSE
if(sound_played_end)
sound_played_end = FALSE
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit b831056

Please sign in to comment.