OpenDream
OpenDream copied to clipboard
Fixes yield proc scheduling. Turns sleeps into an opcode
The behavior is now the same for either spawn
or sleep
:
-
delay < 0
: Proc will continue immediately if nothing is scheduled in the same tick. Otherwise, same asdelay == 0
. -
delay == 0
: Proc scheduled on end of same tick. -
delay > 0
: Proc scheduled aftern
ticks.
This also fixes the ProcScheduler being able to still have queued procs when running multiple tests in serial.
Then, to fix perf issues I had to redo sleeping into an opcode:
- Remove
sleep
from DMStandard. - Two new opcodes
Sleep
andBackgroundSleep
(which is justsleep -1
, much faster than popping afloat
off for background sleeps). - Create new lightweight async proc state for sleeping.
- Compiler/runtime adjustments to handle new opcodes.
- Added
IOpenDreamGameTiming
as a wrapper aroundIGameTiming
that we can control in unit tests.
Closes #1262