diff --git a/code/modules/synthesized_instruments/event_manager.dm b/code/modules/synthesized_instruments/event_manager.dm index fa162ef7be0..060e0c640db 100644 --- a/code/modules/synthesized_instruments/event_manager.dm +++ b/code/modules/synthesized_instruments/event_manager.dm @@ -43,6 +43,10 @@ var/active = 0 var/kill_loop = 0 +/datum/musical_event_manager/Destroy(force) + . = ..() + deactivate() + QDEL_NULL_LIST(events) /datum/musical_event_manager/proc/push_event(datum/sound_player/source, datum/sound_token/token, time, volume) if (istype(source) && istype(token) && volume >= 0 && volume <= 100) @@ -88,4 +92,4 @@ /datum/musical_event_manager/proc/is_overloaded() - return src.events.len > musical_config.max_events \ No newline at end of file + return src.events.len > musical_config.max_events diff --git a/code/modules/synthesized_instruments/song.dm b/code/modules/synthesized_instruments/song.dm index bd9f76ae879..3a2f6730564 100644 --- a/code/modules/synthesized_instruments/song.dm +++ b/code/modules/synthesized_instruments/song.dm @@ -85,7 +85,7 @@ var/delta_volume = player.volume / src.sustain_timer var/tick = duration - while ((current_volume > 0) && token) + while ((current_volume > 0) && !QDELETED(token)) var/new_volume = current_volume tick += world.tick_lag if (delta_volume <= 0) @@ -191,4 +191,4 @@ addtimer(CALLBACK(src, .proc/play_lines, user, allowed_suff, note_off_delta, lines_copy), 0) #undef CP -#undef IS_DIGIT \ No newline at end of file +#undef IS_DIGIT diff --git a/code/modules/synthesized_instruments/sound_player.dm b/code/modules/synthesized_instruments/sound_player.dm index 8f9cdeb9d7d..b04d0974a37 100644 --- a/code/modules/synthesized_instruments/sound_player.dm +++ b/code/modules/synthesized_instruments/sound_player.dm @@ -28,12 +28,12 @@ instrument_synchronizer.register_global(src, .proc/check_wait) /datum/sound_player/Destroy() - src.song.playing = 0 + src.song.playing = FALSE src.actual_instrument = null src.instrument = null QDEL_NULL(song) QDEL_NULL(event_manager) - tokens.Cut() + tokens = null instrument_synchronizer.unregister_global(src, .proc/check_wait) wait = null . = ..() @@ -79,4 +79,4 @@ if(istype(D)) return D.shouldStopPlaying(user) - return 1 //Well if you got this far you did something very wrong \ No newline at end of file + return 1 //Well if you got this far you did something very wrong diff --git a/code/modules/synthesized_instruments/sound_token.dm b/code/modules/synthesized_instruments/sound_token.dm index 385800698e4..b1eacc62138 100644 --- a/code/modules/synthesized_instruments/sound_token.dm +++ b/code/modules/synthesized_instruments/sound_token.dm @@ -52,4 +52,5 @@ /datum/sound_token/instrument/Destroy() . = ..() - player = null \ No newline at end of file + player.unsubscribe(src) + player = null diff --git a/html/changelogs/FluffyGhost-attempt_fix_soundtoken_haddels.yml b/html/changelogs/FluffyGhost-attempt_fix_soundtoken_haddels.yml new file mode 100644 index 00000000000..d7baa7c7ce2 --- /dev/null +++ b/html/changelogs/FluffyGhost-attempt_fix_soundtoken_haddels.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Attempted fix of some additional harddels with sound tokens."