Add components parameters

This commit is contained in:
Ukendio 2024-09-06 15:17:59 +02:00
parent c844012816
commit 9af08c0553
2 changed files with 7 additions and 8 deletions

View file

@ -3,7 +3,6 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ReplicatedStorage = game:GetService("ReplicatedStorage")
local jabby = require(ReplicatedStorage.Packages.jabby) local jabby = require(ReplicatedStorage.Packages.jabby)
local jecs = require(ReplicatedStorage.ecs) local jecs = require(ReplicatedStorage.ecs)
local components = require(ReplicatedStorage.std.components)
local pair = jecs.pair local pair = jecs.pair
type World = jecs.World type World = jecs.World
type Entity<T=nil> = jecs.Entity<T> type Entity<T=nil> = jecs.Entity<T>
@ -47,7 +46,7 @@ export type Scheduler = {
phase: (after: Entity) -> Entity phase: (after: Entity) -> Entity
} }
local scheduler_new: (w: World) -> Scheduler local scheduler_new: (w: World, components: { [string]: Entity }) -> Scheduler
do do
@ -166,7 +165,7 @@ do
return system return system
end end
function scheduler_new(w) function scheduler_new(w: World, components: { [string]: Entity })
world = w world = w
Disabled = world:component() Disabled = world:component()
System = world:component() System = world:component()
@ -243,7 +242,6 @@ do
end end
end end
return { return {
new = scheduler_new new = scheduler_new
} }

View file

@ -2,11 +2,12 @@ local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService") local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage") local ReplicatedStorage = game:GetService("ReplicatedStorage")
local jabby = require(ReplicatedStorage.Packages.jabby) local jabby = require(ReplicatedStorage.Packages.jabby)
local Scheduler = require(ReplicatedStorage.std.scheduler) local std = require(ReplicatedStorage.std)
local world = require(ReplicatedStorage.std.world) local Scheduler = std.Scheduler
local world = std.world
local function start(modules) local function start(modules)
local scheduler = Scheduler.new(world) local scheduler = Scheduler.new(world, ReplicatedStorage.std.components)
for _, module in modules do for _, module in modules do
require(module)(scheduler) require(module)(scheduler)
end end
@ -26,7 +27,7 @@ local function start(modules)
end end
dtor = client.spawn_app(client.apps.home) dtor = client.spawn_app(client.apps.home)
end end
end ) end)
end end
end end