diff --git a/.gitignore b/.gitignore index 9143a00..a43fa5f 100644 --- a/.gitignore +++ b/.gitignore @@ -50,6 +50,3 @@ WallyPatches roblox.toml sourcemap.json drafts/*.lua - -*.code-workspace -roblox.yml diff --git a/README.md b/README.md index 96f82a8..0386756 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@

- + +

[![License: Apache 2.0](https://img.shields.io/badge/License-Apache-blue.svg?style=for-the-badge)](LICENSE-APACHE) diff --git a/jecs_darkmode.svg b/jecs_darkmode.svg new file mode 100644 index 0000000..f64b173 --- /dev/null +++ b/jecs_darkmode.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/jecs_lightmode.svg b/jecs_lightmode.svg new file mode 100644 index 0000000..dbcd08c --- /dev/null +++ b/jecs_lightmode.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/a.lua b/lib/a.lua new file mode 100644 index 0000000..68b844c --- /dev/null +++ b/lib/a.lua @@ -0,0 +1,5 @@ +local test = { + ez = "godo" +} + + test.ez = "good" \ No newline at end of file diff --git a/lib/init.spec.lua b/lib/init.spec.lua index 98f485b..553c9a4 100644 --- a/lib/init.spec.lua +++ b/lib/init.spec.lua @@ -176,22 +176,6 @@ return function() expect(added).to.equal(0) end) - it("track changes", function() - local Position = world:entity() - - local moving = world:entity() - world:set(moving, Position, Vector3.new(1, 2, 3)) - - local count = 0 - - for e, position in world:observer(Position).event(jecs.ON_ADD) do - count += 1 - expect(e).to.equal(moving) - expect(position).to.equal(Vector3.new(1, 2, 3)) - end - expect(count).to.equal(1) - end) - it("should query all matching entities", function() local world = jecs.World.new() diff --git a/logo.png b/logo_old.png similarity index 100% rename from logo.png rename to logo_old.png diff --git a/tests/world.lua b/tests/world.lua index 3da2a0d..30e5558 100644 --- a/tests/world.lua +++ b/tests/world.lua @@ -75,14 +75,17 @@ TEST("world", function() local world = jecs.World.new() local A = world:component() local B = world:component() + local C = world:component() local entities = {} for i = 1, N do local id = world:entity() - world:set(id, A, true) + -- specifically put them in disorder to track regression + -- https://github.com/Ukendio/jecs/pull/15 world:set(id, B, true) - if i > 5 then world:remove(id, B, true) end + world:set(id, A, true) + if i > 5 then world:remove(id, B) end entities[i] = id end @@ -157,6 +160,20 @@ TEST("world", function() end + do CASE "show allow remove that doesn't exist on entity" + local world = jecs.World.new() + + local Health = world:entity() + local Poison = world:component() + + local id = world:entity() + world:set(id, Health, 50) + world:remove(id, Poison) + + CHECK(world:get(id, Poison) == nil) + CHECK(world:get(id, Health) == 50) + end + do CASE "should increment generation" local world = jecs.World.new() local e = world:entity()