Should be componentId not entityId

This commit is contained in:
Ukendio 2024-05-04 15:52:39 +02:00
parent fad2a21ac5
commit 75518fcdce

View file

@ -293,7 +293,7 @@ end
function World.add(world: World, entityId: i53, componentId: i53) function World.add(world: World, entityId: i53, componentId: i53)
local record = ensureRecord(world.entityIndex, entityId) local record = ensureRecord(world.entityIndex, entityId)
local from = record.archetype local from = record.archetype
local to = archetypeTraverseAdd(world, entityId, from) local to = archetypeTraverseAdd(world, componentId, from)
if from then if from then
moveEntity(world.entityIndex, entityId, record, to) moveEntity(world.entityIndex, entityId, record, to)
else else
@ -308,7 +308,7 @@ end
function World.set(world: World, entityId: i53, componentId: i53, data: unknown) function World.set(world: World, entityId: i53, componentId: i53, data: unknown)
local record = ensureRecord(world.entityIndex, entityId) local record = ensureRecord(world.entityIndex, entityId)
local from = record.archetype local from = record.archetype
local to = archetypeTraverseAdd(world, entityId, from) local to = archetypeTraverseAdd(world, componentId, from)
if from == to then if from == to then
-- If the archetypes are the same it can avoid moving the entity -- If the archetypes are the same it can avoid moving the entity