Ukendio / jecs

A fast, portable Entity Component System for Luau
https://ukendio.github.io/jecs/
MIT License
146 stars 26 forks source link

Fix typo with `archetype_traverse_remove` #135

Closed vnnh closed 1 month ago

vnnh commented 1 month ago

Fixes typo that passed in from.node.add instead of from.node.remove to archetype_ensure_edge. This caused a hidden bug where setting a component on an archetype that already had the component would make world:remove not work, as it would use the edge to add.

Reproduction of issue:

local jecs = require(game.ReplicatedStorage.jecs)
local world = jecs.World.new()

local Cooldown = world:component()

local ent = world:entity()
world:set(ent, Cooldown, 2)
world:set(ent, Cooldown, 1)
world:remove(ent, Cooldown)
assert(not world:has(ent, Cooldown))