mirror of
https://github.com/Ukendio/jecs.git
synced 2025-04-25 01:20:04 +00:00
decouple start
This commit is contained in:
parent
5deb7e5b35
commit
adeb562baa
7 changed files with 152 additions and 150 deletions
3
.luaurc
3
.luaurc
|
@ -3,5 +3,6 @@
|
||||||
"jecs": "src",
|
"jecs": "src",
|
||||||
"testkit": "testkit",
|
"testkit": "testkit",
|
||||||
"mirror": "mirror",
|
"mirror": "mirror",
|
||||||
}
|
},
|
||||||
|
languageMode: "strict"
|
||||||
}
|
}
|
||||||
|
|
BIN
demo.rbxl
BIN
demo.rbxl
Binary file not shown.
|
@ -7,7 +7,7 @@ local Scheduler = std.Scheduler
|
||||||
local world = std.world
|
local world = std.world
|
||||||
|
|
||||||
local function start(modules)
|
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
|
for _, module in modules do
|
||||||
require(module)(scheduler)
|
require(module)(scheduler)
|
||||||
end
|
end
|
|
@ -19,7 +19,6 @@ local std = {
|
||||||
world = world :: World,
|
world = world :: World,
|
||||||
pair = jecs.pair,
|
pair = jecs.pair,
|
||||||
__ = jecs.w,
|
__ = jecs.w,
|
||||||
start = require(script.start)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std
|
return std
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local start = require(ReplicatedStorage.std.start)
|
local start = require(ReplicatedStorage.start)
|
||||||
|
|
||||||
start(script.Parent:WaitForChild("systems"):GetChildren())
|
start(script.Parent:WaitForChild("systems"):GetChildren())
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
||||||
local start = require(ReplicatedStorage.std.start)
|
local start = require(ReplicatedStorage.start)
|
||||||
|
|
||||||
start(script.Parent:WaitForChild("systems"):GetChildren())
|
start(script.Parent:WaitForChild("systems"):GetChildren())
|
||||||
|
|
|
@ -740,24 +740,25 @@ local function world_clear(world: World, entity: i53)
|
||||||
entity_move(world.entityIndex, entity, record, ROOT_ARCHETYPE)
|
entity_move(world.entityIndex, entity, record, ROOT_ARCHETYPE)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function archetype_fast_delete_last(columns: { Column },
|
local world_delete: (world: World, entity: i53) -> ()
|
||||||
|
do
|
||||||
|
local function archetype_fast_delete_last(columns: { Column },
|
||||||
column_count: number, types: { i53 }, entity: i53)
|
column_count: number, types: { i53 }, entity: i53)
|
||||||
|
|
||||||
for i, column in columns do
|
for i, column in columns do
|
||||||
column[column_count] = nil
|
column[column_count] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function archetype_fast_delete(columns: { Column },
|
local function archetype_fast_delete(columns: { Column },
|
||||||
column_count: number, row, types, entity)
|
column_count: number, row, types, entity)
|
||||||
|
|
||||||
for i, column in columns do
|
for i, column in columns do
|
||||||
column[row] = column[column_count]
|
column[row] = column[column_count]
|
||||||
column[column_count] = nil
|
column[column_count] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local function archetype_delete(world: World,
|
||||||
local function archetype_delete(world: World,
|
|
||||||
archetype: Archetype, row: number)
|
archetype: Archetype, row: number)
|
||||||
|
|
||||||
local entityIndex = world.entityIndex
|
local entityIndex = world.entityIndex
|
||||||
|
@ -885,9 +886,9 @@ local function archetype_delete(world: World,
|
||||||
end
|
end
|
||||||
component_index[o] = nil
|
component_index[o] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function world_delete(world: World, entity: i53)
|
function world_delete(world: World, entity: i53)
|
||||||
local entityIndex = world.entityIndex
|
local entityIndex = world.entityIndex
|
||||||
|
|
||||||
local record = entityIndex.sparse[entity]
|
local record = entityIndex.sparse[entity]
|
||||||
|
@ -906,6 +907,7 @@ function world_delete(world: World, entity: i53)
|
||||||
|
|
||||||
record.archetype = nil :: any
|
record.archetype = nil :: any
|
||||||
entityIndex.sparse[entity] = nil
|
entityIndex.sparse[entity] = nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function world_contains(world: World, entity): boolean
|
local function world_contains(world: World, entity): boolean
|
||||||
|
|
Loading…
Reference in a new issue