Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: Shuttle sounds #1058

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +704 to +705
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в модуль

// 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"
56 changes: 56 additions & 0 deletions modular_bandastation/aesthetics_sounds/code/shuttle.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/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/turf/destination_turf = get_turf(destination)
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.
Loading