* Converts looping sounds from a list of play locations to just the one
* Updates all uses of looping sounds to match the new arg
* Adds an area based sound manager that hooks into looping sounds to drive the actual audio. I'll be using this to redo how weather effects handle sound
* Some structrual stuff to make everything else smoother
Timers now properly return the time left for client based timers
Weather sends global signals when it starts/stops
Looping sounds now use their timerid var for all their sound related timers, not just the main loop
* This is the painful part
Adds an area sound manager component, it handles the logic of moving into new areas potentially creating new
sound loops. We do some extra work to prevent stacking sound loops.
Adds an ash storm listener element that adds a tailored area sound manager to clients on the lavaland z level.
It's removed on logout.
Adds the ash_storm_sounds assoc list, a reference to this is passed into area sound managers, and it's modified
in a manner that doesn't break the reference in ash_storm (This is what I hate)
* Hooks ash storm listener into cliented mobs and possessed objects
* Documents the odd ref stuff, adds an ignore start var to looping sounds, fixes some errors and lint issues
* Applies kyler's review
banging
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
* Cleans up some var names, reduces the amount of looping we do in some areas
* Makes the code compile, redoes the movement listener to be more general
* fuck
* We don't need to detach on del if we're just removing signals on detach
* Should? work
* if(direct) memes
Co-authored-by: Kylerace <kylerlumpkin1@gmail.com>
Unobvious problem spot
#define BUCKET_POS(timer) (((round((timer.timeToRun - SStimer.head_offset) / world.tick_lag)+1) % BUCKET_LEN)||BUCKET_LEN)
With tick_lag equal to 0.1, 0.25, 0.5, rounding of division is normal. But at other values it may be shifted either more or less due to the specifics of floating-point storage and processing. Numbers 0.1, 0.25, 0.5 have blank mantissa, unlike others which lead to numbers such as 245.0000004 when divided.
PS: tick_lag is rounded to the first two decimal places.
Fixes
Rewrote the circular doubly linked list to a regular doubly linked list, because it could cause timers to loop infinitely.
Fixed re-creation of a bucket if the timer does not have a callback.
Added debug stat indicator RST to MC SStimer.
Added optional ability to log dump all timers on crash.
Fixed subsystem logic when a bucket position is misplaced due to division and rounding inaccuracy. The system now captures such rounding errors and restores the correct timer position.
References
[RU] SS220 Paradise port process from TGstation and fixes:
ss220-space/Paradise#5ss220-space/Paradise#10ss220-space/Paradise#26ss220-space/Paradise#32ss220-space/Paradise#37
Contributors
@semoro: fixes
@Bizzonium: port
Changelog
cl Semoro and azizonkg
fix: Ported fixes of SStimer subsystem from RU SS220 Paradise
config: Added a new config var: flag/log_timers_on_bucket_reset
/cl
* sstimer no longer delays maintenance tasks if its going over its tick.
This was leading to bugs if certain state operations happened while a task was delayed, furthermore if the timer subsystem was overloaded, the invoked timers list would bloat as it would never get cleared out, which would make all timer invocations take longer as they had to add to an ever growing list.
* Update timer.dm
* Fix error when a bucket has only one timer.
* simply timer loop logic & improve timer debug string
It would try to batch up linked list modifications and every issue we have ever had has been related to this, so now it just directly pulls the head of the linked list off, using bucketEject, rather then detect when it reaches the end of the linked list queue it will now just know because the bucket will be empty.
All bucketCount logic has been moved to bucketEject and bucketJoin(), which should also keep that more proper.
* Update timer.dm
* Update timer.dm
BINARY_INSERT used to only take typepaths like/this. Now, it expects them to be /like/this, to be more consistent with ther est of the code.
Adds documentation to COMPTYPE.
Adds a test for BINARY_INSERT.
A lot of issues happen when the tick overruns due to less important and more expensive subsystems. If timer is not ran or breaks, a lot of stuff breaks.
Makes use of the do while(FALSE) trick to give it its own context and makes it possible for the inserted value to be different from the compared value so #48747 can use it.
Before we only warned if the wait was 1 or higher to solve issues with objects settings timers on themselves while getting qdeleted, a common enough usecase to support (even if it is annoying), but then I remembered we could check for qdestroying directly.
Also fixes it so such `destory()` time timers actually run consistantly. before they would only work if called after the `..()` in `destroy()`
Because sstimer tracks timers internally in the terms of what "byond tick" they are suppose to run at; float wait values are now rounded *up* to the next Byond Tick rather then have byond round the resulting list index *down* at access time.
0 wait timers are now rounded *up* to `world.tick_lag` to avoid incompabilities with editing the current tick's bucket while it was being processed.
* Timer queuing tweaks: binary sorted inserts and rolling buckets.
Client time timers now uses a binary search algorithm for its sorted inserts.
Processing now uses a binary sorted insert, rather then sorting it with sortTim during bucket_shifts.
Buckets now automatically wrap around rather then get regenerated every minute. (Rolling queue)
* Fixes some queue management bugs.
* Fixes a Order of Operations goof up in the ticks<->ds macros.
@ninjanomnom your pain is my success
* Remove debug line
* Fixes some binary insert bugs, fixes client time timers, moved id over to GUID
* Fixes initialization-time timers fucking everything up