mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 17:40:02 +00:00
Add more builtin phases
This commit is contained in:
parent
cfd6d1f3d1
commit
bffbc786be
1 changed files with 10 additions and 10 deletions
|
@ -52,9 +52,12 @@ do
|
||||||
local DependsOn
|
local DependsOn
|
||||||
local Phase
|
local Phase
|
||||||
local Event
|
local Event
|
||||||
|
local Name
|
||||||
|
|
||||||
local RenderStepped
|
local RenderStepped
|
||||||
local Heartbeat
|
local Heartbeat
|
||||||
local Name
|
local PreAnimation
|
||||||
|
local PreSimulation
|
||||||
|
|
||||||
local system
|
local system
|
||||||
local dt
|
local dt
|
||||||
|
@ -69,12 +72,11 @@ do
|
||||||
end
|
end
|
||||||
local function begin(events)
|
local function begin(events)
|
||||||
local connections = {}
|
local connections = {}
|
||||||
for phase, systems in events do
|
for event, systems in events do
|
||||||
|
|
||||||
local event = world:get(phase, Event)
|
|
||||||
if not event then continue end
|
if not event then continue end
|
||||||
local event_name = tostring(event)
|
local event_name = tostring(event)
|
||||||
connections[phase] = event:Connect(function(last)
|
connections[event] = event:Connect(function(last)
|
||||||
debug.profilebegin(event_name)
|
debug.profilebegin(event_name)
|
||||||
for _, sys in systems do
|
for _, sys in systems do
|
||||||
system = sys
|
system = sys
|
||||||
|
@ -117,8 +119,8 @@ do
|
||||||
|
|
||||||
local function scheduler_collect_systems_all()
|
local function scheduler_collect_systems_all()
|
||||||
local systems = {}
|
local systems = {}
|
||||||
for phase in world:query(Phase):with(Event) do
|
for phase, event in world:query(Event):with(Phase) do
|
||||||
systems[phase] = scheduler_collect_systems_under_event(phase)
|
systems[event] = scheduler_collect_systems_under_event(phase)
|
||||||
end
|
end
|
||||||
return systems
|
return systems
|
||||||
end
|
end
|
||||||
|
@ -152,7 +154,6 @@ do
|
||||||
PreSimulation = world:component()
|
PreSimulation = world:component()
|
||||||
PreAnimation = world:component()
|
PreAnimation = world:component()
|
||||||
|
|
||||||
|
|
||||||
local RunService = game:GetService("RunService")
|
local RunService = game:GetService("RunService")
|
||||||
if RunService:IsClient() then
|
if RunService:IsClient() then
|
||||||
world:add(RenderStepped, Phase)
|
world:add(RenderStepped, Phase)
|
||||||
|
@ -163,11 +164,10 @@ do
|
||||||
world:set(Heartbeat, Event, RunService.Heartbeat)
|
world:set(Heartbeat, Event, RunService.Heartbeat)
|
||||||
|
|
||||||
world:add(PreSimulation, Phase)
|
world:add(PreSimulation, Phase)
|
||||||
world:add(PreSimulation, Event, RunService.PreSimulation)
|
world:set(PreSimulation, Event, RunService.PreSimulation)
|
||||||
|
|
||||||
world:add(PreAnimation, Phase)
|
world:add(PreAnimation, Phase)
|
||||||
world:add(PreAnimation, Event, RunService.PreAnimation)
|
world:set(PreAnimation, Event, RunService.PreAnimation)
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
phase = scheduler_phase_new,
|
phase = scheduler_phase_new,
|
||||||
|
|
Loading…
Reference in a new issue