mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 19:29:18 +00:00
Compare commits
No commits in common. "53f705ac2ea4dbff71c677fc8fd1bb6d2c0bb99e" and "9b57189c3add7e303a6a4ec64ff70134c6db94df" have entirely different histories.
53f705ac2e
...
9b57189c3a
4 changed files with 1187 additions and 1411 deletions
|
@ -5,7 +5,8 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
|||
local jecs = require(ReplicatedStorage.Lib:Clone())
|
||||
local ecs = jecs.world()
|
||||
local mirror = require(ReplicatedStorage.mirror:Clone())
|
||||
local mcs = mirror.world()
|
||||
local mcs = mirror.World.new()
|
||||
|
||||
|
||||
local C1 = ecs:component()
|
||||
local C2 = ecs:component()
|
||||
|
|
|
@ -8,7 +8,7 @@ local jecs = require(ReplicatedStorage.Lib)
|
|||
local pair = jecs.pair
|
||||
local ecs = jecs.world()
|
||||
local mirror = require(ReplicatedStorage.mirror)
|
||||
local mcs = mirror.world()
|
||||
local mcs = mirror.World.new()
|
||||
|
||||
local C1 = ecs:component()
|
||||
local C2 = ecs:entity()
|
||||
|
@ -32,7 +32,7 @@ return {
|
|||
Functions = {
|
||||
Mirror = function()
|
||||
local m = mcs:entity()
|
||||
for i = 1, 1000 do
|
||||
for i = 1, 100 do
|
||||
mcs:add(m, E3)
|
||||
mcs:remove(m, E3)
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ return {
|
|||
|
||||
Jecs = function()
|
||||
local j = ecs:entity()
|
||||
for i = 1, 1000 do
|
||||
for i = 1, 100 do
|
||||
ecs:add(j, C3)
|
||||
ecs:remove(j, C3)
|
||||
end
|
||||
|
|
12
jecs.luau
12
jecs.luau
|
@ -755,7 +755,7 @@ local function archetype_register(world: World, archetype: Archetype)
|
|||
local columns = archetype.columns
|
||||
for i, component_id in archetype.types do
|
||||
local idr = id_record_ensure(world, component_id)
|
||||
local is_tag = bit32.btest(idr.flags, ECS_ID_IS_TAG)
|
||||
local is_tag = bit32.band(idr.flags, ECS_ID_IS_TAG) ~= 0
|
||||
local column = if is_tag then NULL_ARRAY else {}
|
||||
columns[i] = column
|
||||
|
||||
|
@ -2583,7 +2583,7 @@ local function world_new()
|
|||
|
||||
if idr then
|
||||
local flags = idr.flags
|
||||
if bit32.btest(flags, ECS_ID_DELETE) then
|
||||
if bit32.band(flags, ECS_ID_DELETE) ~= 0 then
|
||||
for archetype_id in idr.records do
|
||||
local idr_archetype = archetypes[archetype_id]
|
||||
|
||||
|
@ -2658,8 +2658,8 @@ local function world_new()
|
|||
end
|
||||
local id_record = component_index[id]
|
||||
local flags = id_record.flags
|
||||
local flags_delete_mask = bit32.btest(flags, ECS_ID_DELETE)
|
||||
if flags_delete_mask then
|
||||
local flags_delete_mask: number = bit32.band(flags, ECS_ID_DELETE)
|
||||
if flags_delete_mask ~= 0 then
|
||||
for i = #entities, 1, -1 do
|
||||
local child = entities[i]
|
||||
inner_world_delete(world, child)
|
||||
|
@ -2701,7 +2701,7 @@ local function world_new()
|
|||
if idr_r then
|
||||
local archetype_ids = idr_r.records
|
||||
local flags = idr_r.flags
|
||||
if bit32.btest(flags, ECS_ID_DELETE) then
|
||||
if (bit32.band(flags, ECS_ID_DELETE) :: number) ~= 0 then
|
||||
for archetype_id in archetype_ids do
|
||||
local idr_r_archetype = archetypes[archetype_id]
|
||||
local entities = idr_r_archetype.entities
|
||||
|
@ -2879,7 +2879,7 @@ end
|
|||
local function ecs_is_tag(world: World, entity: Entity): boolean
|
||||
local idr = world.component_index[entity]
|
||||
if idr then
|
||||
return bit32.btest(idr.flags, ECS_ID_IS_TAG)
|
||||
return bit32.band(idr.flags, ECS_ID_IS_TAG) ~= 0
|
||||
end
|
||||
return not world_has_one_inline(world, entity, EcsComponent)
|
||||
end
|
||||
|
|
2577
mirror.luau
2577
mirror.luau
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue