mirror of
https://github.com/Ukendio/jecs.git
synced 2025-08-04 19:29:18 +00:00
Compare commits
No commits in common. "d99088ea1eadeccbd89058cc5934e2c7f4d76b7a" and "ebc39c8b28082f4290c6077d8475079bc8314582" have entirely different histories.
d99088ea1e
...
ebc39c8b28
4 changed files with 11 additions and 30 deletions
20
jecs.luau
20
jecs.luau
|
@ -714,12 +714,12 @@ local function id_record_ensure(world: World, id: Entity): ComponentRecord
|
||||||
if world_has_one_inline(world, relation, EcsExclusive) then
|
if world_has_one_inline(world, relation, EcsExclusive) then
|
||||||
is_exclusive = true
|
is_exclusive = true
|
||||||
end
|
end
|
||||||
end
|
else
|
||||||
|
local cleanup_policy = world_target(world, relation, EcsOnDelete, 0)
|
||||||
|
|
||||||
local cleanup_policy = world_target(world, relation, EcsOnDelete, 0)
|
if cleanup_policy == EcsDelete then
|
||||||
|
has_delete = true
|
||||||
if cleanup_policy == EcsDelete then
|
end
|
||||||
has_delete = true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local on_add, on_change, on_remove = world_get(world,
|
local on_add, on_change, on_remove = world_get(world,
|
||||||
|
@ -2766,7 +2766,7 @@ local function world_new()
|
||||||
|
|
||||||
if idr then
|
if idr then
|
||||||
local flags = idr.flags
|
local flags = idr.flags
|
||||||
if (bit32.btest(flags, ECS_ID_DELETE) == true) then
|
if bit32.btest(flags, ECS_ID_DELETE) then
|
||||||
for archetype_id in idr.records do
|
for archetype_id in idr.records do
|
||||||
local idr_archetype = archetypes[archetype_id]
|
local idr_archetype = archetypes[archetype_id]
|
||||||
|
|
||||||
|
@ -2873,8 +2873,7 @@ local function world_new()
|
||||||
if idr_r then
|
if idr_r then
|
||||||
local archetype_ids = idr_r.records
|
local archetype_ids = idr_r.records
|
||||||
local flags = idr_r.flags
|
local flags = idr_r.flags
|
||||||
local has_delete_policy = bit32.btest(flags, ECS_ID_DELETE)
|
if bit32.btest(flags, ECS_ID_DELETE) then
|
||||||
if has_delete_policy then
|
|
||||||
for archetype_id in archetype_ids do
|
for archetype_id in archetype_ids do
|
||||||
local idr_r_archetype = archetypes[archetype_id]
|
local idr_r_archetype = archetypes[archetype_id]
|
||||||
local entities = idr_r_archetype.entities
|
local entities = idr_r_archetype.entities
|
||||||
|
@ -3004,10 +3003,8 @@ local function world_new()
|
||||||
inner_world_set(world, EcsWildcard, EcsName, "jecs.Wildcard")
|
inner_world_set(world, EcsWildcard, EcsName, "jecs.Wildcard")
|
||||||
inner_world_set(world, EcsChildOf, EcsName, "jecs.ChildOf")
|
inner_world_set(world, EcsChildOf, EcsName, "jecs.ChildOf")
|
||||||
inner_world_set(world, EcsComponent, EcsName, "jecs.Component")
|
inner_world_set(world, EcsComponent, EcsName, "jecs.Component")
|
||||||
|
|
||||||
inner_world_set(world, EcsOnDelete, EcsName, "jecs.OnDelete")
|
inner_world_set(world, EcsOnDelete, EcsName, "jecs.OnDelete")
|
||||||
inner_world_set(world, EcsOnDeleteTarget, EcsName, "jecs.OnDeleteTarget")
|
inner_world_set(world, EcsOnDeleteTarget, EcsName, "jecs.OnDeleteTarget")
|
||||||
|
|
||||||
inner_world_set(world, EcsDelete, EcsName, "jecs.Delete")
|
inner_world_set(world, EcsDelete, EcsName, "jecs.Delete")
|
||||||
inner_world_set(world, EcsRemove, EcsName, "jecs.Remove")
|
inner_world_set(world, EcsRemove, EcsName, "jecs.Remove")
|
||||||
inner_world_set(world, EcsName, EcsName, "jecs.Name")
|
inner_world_set(world, EcsName, EcsName, "jecs.Name")
|
||||||
|
@ -3016,9 +3013,6 @@ local function world_new()
|
||||||
inner_world_add(world, EcsChildOf, ECS_PAIR(EcsOnDeleteTarget, EcsDelete))
|
inner_world_add(world, EcsChildOf, ECS_PAIR(EcsOnDeleteTarget, EcsDelete))
|
||||||
inner_world_add(world, EcsChildOf, EcsExclusive)
|
inner_world_add(world, EcsChildOf, EcsExclusive)
|
||||||
|
|
||||||
inner_world_add(world, EcsOnDelete, EcsExclusive)
|
|
||||||
inner_world_add(world, EcsOnDeleteTarget, EcsExclusive)
|
|
||||||
|
|
||||||
for i = EcsRest + 1, ecs_max_tag_id do
|
for i = EcsRest + 1, ecs_max_tag_id do
|
||||||
entity_index_new_id(entity_index)
|
entity_index_new_id(entity_index)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@rbxts/jecs",
|
"name": "@rbxts/jecs",
|
||||||
"version": "0.9.0-rc.2",
|
"version": "0.9.0-rc.0",
|
||||||
"description": "Stupidly fast Entity Component System",
|
"description": "Stupidly fast Entity Component System",
|
||||||
"main": "jecs.luau",
|
"main": "jecs.luau",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -24,19 +24,6 @@ type Id<T=unknown> = jecs.Id<T>
|
||||||
local entity_visualiser = require("@tools/entity_visualiser")
|
local entity_visualiser = require("@tools/entity_visualiser")
|
||||||
local dwi = entity_visualiser.stringify
|
local dwi = entity_visualiser.stringify
|
||||||
|
|
||||||
TEST("ardi", function()
|
|
||||||
local world = jecs.world()
|
|
||||||
local r = world:entity()
|
|
||||||
world:add(r, jecs.pair(jecs.OnDelete, jecs.Delete))
|
|
||||||
|
|
||||||
local e = world:entity()
|
|
||||||
local e1 = world:entity()
|
|
||||||
world:add(e, jecs.pair(r, e1))
|
|
||||||
|
|
||||||
world:delete(r)
|
|
||||||
CHECK(not world:contains(e))
|
|
||||||
end)
|
|
||||||
|
|
||||||
TEST("dai", function()
|
TEST("dai", function()
|
||||||
local world = jecs.world()
|
local world = jecs.world()
|
||||||
local C = world:component()
|
local C = world:component()
|
||||||
|
@ -634,9 +621,9 @@ TEST("world:delete()", function()
|
||||||
world:add(e1, ct)
|
world:add(e1, ct)
|
||||||
world:add(e2, jecs.pair(ct, dummy))
|
world:add(e2, jecs.pair(ct, dummy))
|
||||||
|
|
||||||
-- world:delete(dummy)
|
world:delete(dummy)
|
||||||
|
|
||||||
-- CHECK(world:contains(e2))
|
CHECK(world:contains(e2))
|
||||||
|
|
||||||
world:delete(ct)
|
world:delete(ct)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "ukendio/jecs"
|
name = "ukendio/jecs"
|
||||||
version = "0.9.0-rc.2"
|
version = "0.9.0-rc.0"
|
||||||
registry = "https://github.com/UpliftGames/wally-index"
|
registry = "https://github.com/UpliftGames/wally-index"
|
||||||
realm = "shared"
|
realm = "shared"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
Loading…
Reference in a new issue