should be good

This commit is contained in:
HowManySmall 2024-05-04 15:29:32 -06:00
parent f1dc668214
commit 1e53fdc955
2 changed files with 32 additions and 27 deletions

View file

@ -2,41 +2,37 @@
--!native
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local rgb = require(ReplicatedStorage.rgb)
local Matter = require(ReplicatedStorage.DevPackages.Matter)
local jecs = require(ReplicatedStorage.Lib)
local ecr = require(ReplicatedStorage.DevPackages.ecr)
local jecs = require(ReplicatedStorage.Lib)
local rgb = require(ReplicatedStorage.rgb)
local newWorld = Matter.World.new()
local ecs = jecs.World.new()
return {
ParameterGenerator = function()
local registry2 = ecr.registry()
local registry2 = ecr.registry()
return registry2
end,
end;
Functions = {
Matter = function()
for i = 1, 1000 do
newWorld:spawn()
end
end,
Matter = function()
for i = 1, 1000 do
newWorld:spawn()
end
end;
ECR = function(_, registry2)
for i = 1, 1000 do
registry2.create()
end
end;
ECR = function(_, registry2)
for i = 1, 1000 do
registry2.create()
end
end,
Jecs = function()
for i = 1, 1000 do
ecs:entity()
end
end
},
Jecs = function()
for i = 1, 1000 do
ecs:entity()
end
end;
};
}

View file

@ -470,9 +470,10 @@ function World.query(world: World, ...: i53): Query
local withoutComponents = {...}
for index = #compatibleArchetypes, 1, -1 do
local archetype = compatibleArchetypes[index][1]
local records = archetype.records
local shouldRemove = false
for _, componentId in withoutComponents do
if archetype.records[componentId] then
if records[componentId] then
shouldRemove = true
break
end
@ -634,15 +635,23 @@ function World.observer(world: World, ...)
end
local queryOutput = {}
local length = 0
local row = change.offset
local archetype = change.archetype
local columns = archetype.columns
local archetypeRecords = archetype.records
for _, id in componentIds do
table.insert(queryOutput, columns[archetypeRecords[id]][row])
local value = columns[archetypeRecords[id]][row]
if value == nil then
continue
end
length += 1
queryOutput[length] = value
end
return archetype.entities[row], unpack(queryOutput, 1, #queryOutput)
return archetype.entities[row], unpack(queryOutput, 1, length)
end
end;
}