change nth to use idr.records and pull out variables from iter

This commit is contained in:
kurokuukyo 2026-04-20 20:08:14 -04:00
parent f79b894f86
commit 5a198495c8

View file

@ -3334,15 +3334,18 @@ local function world_new(DEBUG: boolean?)
return NOOP :: () -> i53 return NOOP :: () -> i53
end end
local idr_record = idr.records[archetype_id] local nth = idr.records[archetype_id]
local nth = 0 local end_count = nth + count
local entity_idx = world.entity_index
local archetype_types = archetype.types
return function(): i53? return function(): i53?
if nth == count then if nth == end_count then
return nil return nil
end end
local target = entity_index_get_alive(world.entity_index, local target = entity_index_get_alive(entity_idx,
ECS_PAIR_SECOND(archetype.types[nth + idr_record])) ECS_PAIR_SECOND(archetype_types[nth]))
nth += 1 nth += 1
return target return target
end end