mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-19 22:23:11 +00:00
## About The Pull Request <details> - renamed ai folder to announcer -- announcer -- - moved vox_fem to announcer - moved approachingTG to announcer - separated the ambience folder into ambience and instrumental -- ambience -- - created holy folder moved all related sounds there - created engineering folder and moved all related sounds there - created security folder and moved ambidet there - created general folder and moved ambigen there - created icemoon folder and moved all icebox-related ambience there - created medical folder and moved all medbay-related ambi there - created ruin folder and moves all ruins ambi there - created beach folder and moved seag and shore there - created lavaland folder and moved related ambi there - created aurora_caelus folder and placed its ambi there - created misc folder and moved the rest of the files that don't have a specific category into it -- instrumental -- - moved traitor folder here - created lobby_music folder and placed our songs there (title0 not used anywhere? - server-side modification?) -- items -- - moved secdeath to hailer - moved surgery to handling -- effects -- - moved chemistry into effects - moved hallucinations into effects - moved health into effects - moved magic into effects -- vehicles -- - moved mecha into vehicles created mobs folder -- mobs -- - moved creatures folder into mobs - moved voice into mobs renamed creatures to non-humanoids renamed voice to humanoids -- non-humanoids-- created cyborg folder created hiss folder moved harmalarm.ogg to cyborg -- humanoids -- -- misc -- moved ghostwhisper to misc moved insane_low_laugh to misc I give up trying to document this. </details> - [X] ambience - [x] announcer - [x] effects - [X] instrumental - [x] items - [x] machines - [x] misc - [X] mobs - [X] runtime - [X] vehicles - [ ] attributions ## Why It's Good For The Game This folder is so disorganized that it's vomit inducing, will make it easier to find and add new sounds, providng a minor structure to the sound folder. ## Changelog 🆑 grungussuss refactor: the sound folder in the source code has been reorganized, please report any oddities with sounds playing or not playing server: lobby music has been repathed to sound/music/lobby_music /🆑
138 lines
4.9 KiB
Plaintext
138 lines
4.9 KiB
Plaintext
/// The subsystem used to play ambience to users every now and then, makes them real excited.
|
|
SUBSYSTEM_DEF(ambience)
|
|
name = "Ambience"
|
|
flags = SS_BACKGROUND|SS_NO_INIT
|
|
priority = FIRE_PRIORITY_AMBIENCE
|
|
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
|
|
wait = 1 SECONDS
|
|
///Assoc list of listening client - next ambience time
|
|
var/list/ambience_listening_clients = list()
|
|
var/list/client_old_areas = list()
|
|
///Cache for sanic speed :D
|
|
var/list/currentrun = list()
|
|
|
|
/datum/controller/subsystem/ambience/fire(resumed)
|
|
if(!resumed)
|
|
currentrun = ambience_listening_clients.Copy()
|
|
var/list/cached_clients = currentrun
|
|
|
|
while(cached_clients.len)
|
|
var/client/client_iterator = cached_clients[cached_clients.len]
|
|
cached_clients.len--
|
|
|
|
//Check to see if the client exists and isn't held by a new player
|
|
var/mob/client_mob = client_iterator?.mob
|
|
if(isnull(client_iterator) || !client_mob || isnewplayer(client_mob))
|
|
ambience_listening_clients -= client_iterator
|
|
client_old_areas -= client_iterator
|
|
continue
|
|
|
|
if(!client_mob.can_hear()) //WHAT? I CAN'T HEAR YOU
|
|
continue
|
|
|
|
//Check to see if the client-mob is in a valid area
|
|
var/area/current_area = get_area(client_mob)
|
|
if(!current_area) //Something's gone horribly wrong
|
|
stack_trace("[key_name(client_mob)] has somehow ended up in nullspace. WTF did you do")
|
|
ambience_listening_clients -= client_iterator
|
|
continue
|
|
|
|
if(ambience_listening_clients[client_iterator] > world.time)
|
|
if(!(current_area.forced_ambience && (client_old_areas?[client_iterator] != current_area) && prob(5)))
|
|
continue
|
|
|
|
//Run play_ambience() on the client-mob and set a cooldown
|
|
ambience_listening_clients[client_iterator] = world.time + current_area.play_ambience(client_mob)
|
|
|
|
//We REALLY don't want runtimes in SSambience
|
|
if(client_iterator)
|
|
client_old_areas[client_iterator] = current_area
|
|
|
|
if(MC_TICK_CHECK)
|
|
return
|
|
|
|
///Attempts to play an ambient sound to a mob, returning the cooldown in deciseconds
|
|
/area/proc/play_ambience(mob/M, sound/override_sound, volume = 27)
|
|
var/sound/new_sound = override_sound || pick(ambientsounds)
|
|
new_sound = sound(new_sound, repeat = 0, wait = 0, volume = volume, channel = CHANNEL_AMBIENCE)
|
|
SEND_SOUND(M, new_sound)
|
|
|
|
return rand(min_ambience_cooldown, max_ambience_cooldown)
|
|
|
|
/datum/controller/subsystem/ambience/proc/remove_ambience_client(client/to_remove)
|
|
ambience_listening_clients -= to_remove
|
|
client_old_areas -= to_remove
|
|
currentrun -= to_remove
|
|
|
|
/area/station/maintenance
|
|
min_ambience_cooldown = 20 SECONDS
|
|
max_ambience_cooldown = 35 SECONDS
|
|
|
|
///A list of rare sound effects to fuck with players. No, it does not contain actual minecraft sounds anymore.
|
|
var/static/list/minecraft_cave_noises = list(
|
|
'sound/machines/airlock/airlock.ogg',
|
|
'sound/effects/snap.ogg',
|
|
'sound/effects/footstep/clownstep1.ogg',
|
|
'sound/effects/footstep/clownstep2.ogg',
|
|
'sound/items/tools/welder.ogg',
|
|
'sound/items/tools/welder2.ogg',
|
|
'sound/items/tools/crowbar.ogg',
|
|
'sound/items/deconstruct.ogg',
|
|
'sound/ambience/misc/source_holehit3.ogg',
|
|
'sound/ambience//misc/cavesound3.ogg',
|
|
)
|
|
|
|
/area/station/maintenance/play_ambience(mob/M, sound/override_sound, volume)
|
|
if(!M.has_light_nearby() && prob(0.5))
|
|
return ..(M, pick(minecraft_cave_noises))
|
|
return ..()
|
|
|
|
/**
|
|
* Ambience buzz handling called by either area/Enter() or refresh_looping_ambience()
|
|
*/
|
|
|
|
/mob/proc/update_ambience_area(area/new_area)
|
|
|
|
var/old_tracked_area = ambience_tracked_area
|
|
if(old_tracked_area)
|
|
UnregisterSignal(old_tracked_area, COMSIG_AREA_POWER_CHANGE)
|
|
ambience_tracked_area = null
|
|
if(!client)
|
|
return
|
|
if(new_area)
|
|
ambience_tracked_area = new_area
|
|
RegisterSignal(ambience_tracked_area, COMSIG_AREA_POWER_CHANGE, PROC_REF(refresh_looping_ambience), TRUE)
|
|
|
|
refresh_looping_ambience()
|
|
|
|
/mob/proc/refresh_looping_ambience()
|
|
SIGNAL_HANDLER
|
|
|
|
if(!client) // If a tree falls in the woods.
|
|
return
|
|
|
|
var/area/my_area = get_area(src)
|
|
var/sound_to_use = my_area.ambient_buzz
|
|
|
|
if(!sound_to_use || !(client.prefs.read_preference(/datum/preference/toggle/sound_ship_ambience)))
|
|
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
|
|
client.current_ambient_sound = null
|
|
return
|
|
|
|
if(!can_hear()) // Can the mob hear?
|
|
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
|
|
client.current_ambient_sound = null
|
|
return
|
|
|
|
//Station ambience is dependent on a functioning and charged APC with environment power enabled.
|
|
if(!is_mining_level(my_area.z) && ((!my_area.apc || !my_area.apc.operating || !my_area.apc.cell?.charge && my_area.requires_power || !my_area.power_environ)))
|
|
SEND_SOUND(src, sound(null, repeat = 0, wait = 0, channel = CHANNEL_BUZZ))
|
|
client.current_ambient_sound = null
|
|
return
|
|
else
|
|
if(sound_to_use == client.current_ambient_sound) // Don't reset current loops
|
|
return
|
|
|
|
client.current_ambient_sound = sound_to_use
|
|
SEND_SOUND(src, sound(my_area.ambient_buzz, repeat = 1, wait = 0, volume = my_area.ambient_buzz_vol, channel = CHANNEL_BUZZ))
|