Skip to content

Commit

Permalink
Merge pull request #4 from Mark-Marks/jabby
Browse files Browse the repository at this point in the history
fix: Dont allow for yielding in sapphire-jecs scheduled systems
  • Loading branch information
Mark-Marks authored Nov 9, 2024
2 parents ec9fd88 + 405a205 commit 06ae2d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion crates/sapphire-jecs/lib/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,27 @@ function SapphireJecs.extension()
registered_phases["heartbeat"] = cheartbeat

local function runner(event: event): (...any) -> ()
local current_sys: (...any) -> () = nil
local current_args: {} = nil
local function call_system()
current_sys(unpack(current_args))
end

return function(...)
current_args = table.pack(...)
for _, system in runnables[event] do
local id = system.id
local system_data = jabby_scheduler.system_data[id]
if system_data.paused then
continue
end

current_sys = system.run

jabby_scheduler:_mark_system_frame_start(id)
system.run(...)
for _ in call_system :: any do
break
end
jabby_scheduler:_mark_system_frame_end(id)
end
end
Expand Down
2 changes: 1 addition & 1 deletion crates/sapphire-jecs/wally.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mark-marks/sapphire-jecs"
version = "0.2.0-rc.1"
version = "0.2.0-rc.2"
registry = "https://github.com/UpliftGames/wally-index"
realm = "shared"
license = "MIT"
Expand Down

0 comments on commit 06ae2d6

Please sign in to comment.