mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 11:19:17 +00:00
Compare commits
2 commits
6a52ad6cec
...
42278ce414
Author | SHA1 | Date | |
---|---|---|---|
|
42278ce414 | ||
|
f912866fcb |
1 changed files with 14 additions and 0 deletions
14
jecs.luau
14
jecs.luau
|
@ -118,6 +118,8 @@ type world = {
|
||||||
|
|
||||||
max_component_id: number,
|
max_component_id: number,
|
||||||
max_archetype_id: number,
|
max_archetype_id: number,
|
||||||
|
start_component_id: number,
|
||||||
|
start_tag_id: number,
|
||||||
|
|
||||||
observable: Map<i53, Map<i53, { Observer }>>,
|
observable: Map<i53, Map<i53, { Observer }>>,
|
||||||
|
|
||||||
|
@ -155,6 +157,8 @@ export type World = {
|
||||||
|
|
||||||
max_component_id: number,
|
max_component_id: number,
|
||||||
max_archetype_id: number,
|
max_archetype_id: number,
|
||||||
|
start_component_id: number,
|
||||||
|
start_tag_id: number,
|
||||||
|
|
||||||
observable: Map<Id, Map<Id, { Observer }>>,
|
observable: Map<Id, Map<Id, { Observer }>>,
|
||||||
|
|
||||||
|
@ -752,6 +756,12 @@ local function ECS_ID_IS_WILDCARD(e: i53): boolean
|
||||||
return first == EcsWildcard or second == EcsWildcard
|
return first == EcsWildcard or second == EcsWildcard
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function get_max_ids_difference(world: World): (number, number)
|
||||||
|
local diff_components = world.start_component_id - ecs_max_component_id
|
||||||
|
local diff_tags = world.start_tag_id - ecs_max_tag_id
|
||||||
|
return diff_components, diff_tags
|
||||||
|
end
|
||||||
|
|
||||||
local function id_record_get(world: World, id: Entity): ComponentRecord?
|
local function id_record_get(world: World, id: Entity): ComponentRecord?
|
||||||
local component_index = world.component_index
|
local component_index = world.component_index
|
||||||
local idr: ComponentRecord = component_index[id]
|
local idr: ComponentRecord = component_index[id]
|
||||||
|
@ -2250,6 +2260,9 @@ local function world_new()
|
||||||
max_archetype_id = 0,
|
max_archetype_id = 0,
|
||||||
max_component_id = ecs_max_component_id,
|
max_component_id = ecs_max_component_id,
|
||||||
|
|
||||||
|
start_component_id = ecs_max_component_id,
|
||||||
|
start_tag_id = ecs_max_tag_id,
|
||||||
|
|
||||||
observable = observable,
|
observable = observable,
|
||||||
signals = signals,
|
signals = signals,
|
||||||
} :: world
|
} :: world
|
||||||
|
@ -3313,6 +3326,7 @@ return {
|
||||||
pair_first = ecs_pair_first :: <P, O>(world: World, pair: Pair<P, O>) -> Id<P>,
|
pair_first = ecs_pair_first :: <P, O>(world: World, pair: Pair<P, O>) -> Id<P>,
|
||||||
pair_second = ecs_pair_second :: <P, O>(world: World, pair: Pair<P, O>) -> Id<O>,
|
pair_second = ecs_pair_second :: <P, O>(world: World, pair: Pair<P, O>) -> Id<O>,
|
||||||
entity_index_get_alive = entity_index_get_alive,
|
entity_index_get_alive = entity_index_get_alive,
|
||||||
|
get_max_ids_difference = get_max_ids_difference,
|
||||||
|
|
||||||
archetype_append_to_records = archetype_append_to_records,
|
archetype_append_to_records = archetype_append_to_records,
|
||||||
id_record_ensure = id_record_ensure :: (World, Id) -> ComponentRecord,
|
id_record_ensure = id_record_ensure :: (World, Id) -> ComponentRecord,
|
||||||
|
|
Loading…
Reference in a new issue