Revenge Of The Instruments (#22213)

Take 2

<img width="320" height="149" alt="image"
src="https://github.com/user-attachments/assets/21e45078-ef69-4b3c-8b50-208800b82558"
/>

It somehow got even worse over time.

<img width="311" height="164" alt="image"
src="https://github.com/user-attachments/assets/882d9a8e-16f1-4172-9c7b-f741d5bede8d"
/>

And now I have finished fixing it by hand and testing to verify that my
fixes work.


https://github.com/user-attachments/assets/0106593b-4b3f-4e7d-88f0-86c4b22571ff

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
VMSolidus
2026-04-12 22:19:33 +00:00
committed by GitHub
co-authored by SleepyGemmy
parent aeee6aa3ef
commit 1a1a875bdb
7 changed files with 41 additions and 15 deletions
@@ -5,6 +5,10 @@
var/list/samples = list() // Write here however many samples, follow this syntax: "%note num%"='%sample file%' eg. "27"='synthesizer/e2.ogg'. Key must never be lower than 0 and higher than 127
var/list/datum/sample_pair/sample_map = list() // Used to modulate sounds, don't fill yourself
/datum/instrument/Destroy()
samples.Cut()
QDEL_LIST_ASSOC_VAL(sample_map)
return ..()
/datum/instrument/proc/create_full_sample_deviation_map()
// Obtain samples
@@ -203,8 +203,17 @@
/datum/real_instrument/Destroy()
if (islist(instruments))
var/list/aslist = instruments
QDEL_LIST_ASSOC_VAL(aslist)
else
QDEL_NULL(instruments)
QDEL_NULL(player)
QDEL_NULL(song_editor)
QDEL_NULL(usage_info)
owner = null
QDEL_NULL(env_editor)
QDEL_NULL(echo_editor)
return ..()
/obj/structure/synthesized_instrument
@@ -225,14 +234,9 @@
src.real_instrument = new /datum/real_instrument(src, new sound_player(src, instruments[pick(instruments)]), instruments)
/obj/structure/synthesized_instrument/Destroy()
QDEL_NULL(src.real_instrument)
if (islist(instruments))
var/list/as_list = instruments
for (var/key in as_list)
qdel(as_list[key])
instruments = null
. = ..()
QDEL_NULL(real_instrument)
QDEL_LIST(instruments)
return ..()
/obj/structure/synthesized_instrument/attack_hand(mob/user)
src.interact(user)
@@ -31,7 +31,10 @@
available_channels = GLOB.musical_config.channels_per_instrument
/datum/synthesized_song/Destroy()
playing = null
player.event_manager.deactivate()
player = null
instrument_data = null
return ..()
/datum/synthesized_song/proc/sanitize_tempo(new_tempo) // Identical to datum/song
@@ -28,12 +28,11 @@
GLOB.instrument_synchronizer.register_global(src, .proc/check_wait)
/datum/sound_player/Destroy()
src.song.playing = FALSE
src.actual_instrument = null
src.instrument = null
actual_instrument = null
instrument = null
QDEL_NULL(song)
QDEL_NULL(event_manager)
tokens = null
QDEL_LIST(tokens)
GLOB.instrument_synchronizer.unregister_global(src, .proc/check_wait)
wait = null
. = ..()
@@ -59,7 +58,7 @@
/datum/sound_player/proc/unsubscribe(datum/sound_token/instrument/oldtoken)
if(!istype(oldtoken))
CRASH("Non token type passed to unsubscribe function.")
tokens -= oldtoken
tokens.Remove(oldtoken)
/datum/sound_player/proc/apply_modifications(sound/what, note_num, which_line, which_note) // You don't need to override this
@@ -49,8 +49,8 @@
/datum/sound_token/instrument/Stop()
if(player)
player.unsubscribe(src)
player = null
. = ..()
/datum/sound_token/instrument/Destroy()
player = null
return ..()