Attempted fix of some additional harddels with sound tokens (#17174)

* Atomization

* Attempted fix of some additional harddels with sound tokens

* Stray Newline

---------

Co-authored-by: FluffyGhost <FluffyGhost>
Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
This commit is contained in:
Fluffy
2023-08-30 22:36:31 +00:00
committed by GitHub
co-authored by FluffyGhost <FluffyGhost> SleepyGemmy
parent d462df9cd5
commit 9c8636917c
5 changed files with 53 additions and 7 deletions
@@ -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
return src.events.len > musical_config.max_events
+2 -2
View File
@@ -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
#undef IS_DIGIT
@@ -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
return 1 //Well if you got this far you did something very wrong
@@ -52,4 +52,5 @@
/datum/sound_token/instrument/Destroy()
. = ..()
player = null
player.unsubscribe(src)
player = null