Skip to content

v0.4.1

Latest

Choose a tag to compare

@andygeiss andygeiss released this 06 Sep 13:58

v0.4.1

Fixed: Entity.Add dropped components the entity did not carry.

It skipped a component when the entity's mask already had its bits,
rather than when the entity already had the component. An entity
carrying masks 1 and 2 refused a component with mask 3, and Get(3)
then returned nil. A component with mask 0 -- the shape you get when
you filter by name and the bits carry no meaning -- was dropped every
time.

Fixed: DefaultEntityManager.Remove panicked on a nil entity, so
em.Remove(em.Get(id)) crashed for an id the manager does not hold,
instead of doing nothing.

Nothing broke. No exported symbol changed, and both fixes make
previously broken calls work, so code that compiles against v0.4.0
needs no edit.

Also: the contracts that were only implied are written down now --
one bit per component type, Run never sleeps, Entities and Systems
hand back the manager's own slice, an Entity marshals but does not
unmarshal, and nothing here is safe for concurrent use. The
benchmarks run on b.Loop, and the default types now assert that they
satisfy their interfaces.