gamedev-patterns-ts
gamedev-patterns-ts copied to clipboard
Small bug where Entity._components can never fully be empty
Since index=0 evaluates as false, the last element will never be removed in _components.
https://github.com/soloschenko-grigoriy/gamedev-patterns-ts/blob/148f337040b8285a3debf032e137a9441591ed23/src/utils/ecs/entity.ts#L42
should be:
if (toRemove && index !== undefined) {
See: https://github.com/joaqim/gamedev-patterns-ts/commit/e84cbd06485dca97804ab5b47b358dbc2df9302d Where I also added test that would fail without this fix.
Hello there! Good catch, thank you for sharing!