decouple start

This commit is contained in:
Ukendio 2024-09-08 19:45:49 +02:00
parent 5deb7e5b35
commit adeb562baa
7 changed files with 152 additions and 150 deletions

View file

@ -3,5 +3,6 @@
"jecs": "src",
"testkit": "testkit",
"mirror": "mirror",
}
},
languageMode: "strict"
}

BIN
demo.rbxl

Binary file not shown.

View file

@ -7,7 +7,7 @@ local Scheduler = std.Scheduler
local world = std.world
local function start(modules)
local scheduler = Scheduler.new(world, ReplicatedStorage.std.components)
local scheduler = Scheduler.new(world, require(ReplicatedStorage.std.components))
for _, module in modules do
require(module)(scheduler)
end

View file

@ -19,7 +19,6 @@ local std = {
world = world :: World,
pair = jecs.pair,
__ = jecs.w,
start = require(script.start)
}
return std

View file

@ -1,4 +1,4 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local start = require(ReplicatedStorage.std.start)
local start = require(ReplicatedStorage.start)
start(script.Parent:WaitForChild("systems"):GetChildren())

View file

@ -1,4 +1,4 @@
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local start = require(ReplicatedStorage.std.start)
local start = require(ReplicatedStorage.start)
start(script.Parent:WaitForChild("systems"):GetChildren())

View file

@ -740,6 +740,8 @@ local function world_clear(world: World, entity: i53)
entity_move(world.entityIndex, entity, record, ROOT_ARCHETYPE)
end
local world_delete: (world: World, entity: i53) -> ()
do
local function archetype_fast_delete_last(columns: { Column },
column_count: number, types: { i53 }, entity: i53)
@ -756,7 +758,6 @@ local function archetype_fast_delete(columns: { Column },
column[column_count] = nil
end
end
local function archetype_delete(world: World,
archetype: Archetype, row: number)
@ -907,6 +908,7 @@ function world_delete(world: World, entity: i53)
record.archetype = nil :: any
entityIndex.sparse[entity] = nil
end
end
local function world_contains(world: World, entity): boolean
return world.entityIndex.sparse[entity] ~= nil