mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 11:12:14 +00:00
* Synthesizers and headphones can now have circuits! (#62825) About The Pull Request A circuit and shell components have been added to Synthesizers (headphones and spacepods included, though with a reduced capacity because of their size), so they can now be used for wiremod. Just like for instant cameras, no shell design here. They are meant to be found in dorms or maybe ordered from cargo. Why It's Good For The Game The station outside the sci department has plenty of USB ports stuff but is lacking when it comes to circuits shell. This is another small step toward a better and more applicable wiremod. Changelog cl expansion: Synthesizers and headphones can now have circuits installed. /cl * Synthesizers and headphones can now have circuits! Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
58 lines
2.3 KiB
Plaintext
58 lines
2.3 KiB
Plaintext
PROCESSING_SUBSYSTEM_DEF(instruments)
|
|
name = "Instruments"
|
|
wait = 0.5
|
|
init_order = INIT_ORDER_INSTRUMENTS
|
|
flags = SS_KEEP_TIMING
|
|
priority = FIRE_PRIORITY_INSTRUMENTS
|
|
/// List of all instrument data, associative id = datum
|
|
var/static/list/datum/instrument/instrument_data = list()
|
|
/// List of all song datums.
|
|
var/static/list/datum/song/songs = list()
|
|
/// Max lines in songs
|
|
var/static/musician_maxlines = 600
|
|
/// Max characters per line in songs
|
|
var/static/musician_maxlinechars = 300
|
|
/// Deciseconds between hearchecks. Too high and instruments seem to lag when people are moving around in terms of who can hear it. Too low and the server lags from this.
|
|
var/static/musician_hearcheck_mindelay = 5
|
|
/// Maximum instrument channels total instruments are allowed to use. This is so you don't have instruments deadlocking all sound channels.
|
|
var/static/max_instrument_channels = MAX_INSTRUMENT_CHANNELS
|
|
/// Current number of channels allocated for instruments
|
|
var/static/current_instrument_channels = 0
|
|
/// Single cached list for synthesizer instrument ids, so you don't have to have a new list with every synthesizer.
|
|
var/static/list/synthesizer_instrument_ids
|
|
var/static/list/note_sustain_modes = list("Linear" = SUSTAIN_LINEAR, "Exponential" = SUSTAIN_EXPONENTIAL)
|
|
|
|
/datum/controller/subsystem/processing/instruments/Initialize()
|
|
initialize_instrument_data()
|
|
synthesizer_instrument_ids = get_allowed_instrument_ids()
|
|
return ..()
|
|
|
|
/datum/controller/subsystem/processing/instruments/proc/on_song_new(datum/song/S)
|
|
songs += S
|
|
|
|
/datum/controller/subsystem/processing/instruments/proc/on_song_del(datum/song/S)
|
|
songs -= S
|
|
|
|
/datum/controller/subsystem/processing/instruments/proc/initialize_instrument_data()
|
|
for(var/path in subtypesof(/datum/instrument))
|
|
var/datum/instrument/I = path
|
|
if(initial(I.abstract_type) == path)
|
|
continue
|
|
I = new path
|
|
I.Initialize()
|
|
if(!I.id)
|
|
qdel(I)
|
|
continue
|
|
instrument_data[I.id] = I
|
|
CHECK_TICK
|
|
|
|
/datum/controller/subsystem/processing/instruments/proc/get_instrument(id_or_path)
|
|
return instrument_data["[id_or_path]"]
|
|
|
|
/datum/controller/subsystem/processing/instruments/proc/reserve_instrument_channel(datum/instrument/I)
|
|
if(current_instrument_channels > max_instrument_channels)
|
|
return
|
|
. = SSsounds.reserve_sound_channel(I)
|
|
if(!isnull(.))
|
|
current_instrument_channels++
|