Since a user can pass any options in the opts param when invoking a system, there is no longer any need to bind the EntityManager instance as the this argument to registered systems.
To achieve the old behavior, a user can simply:
entityManager.registerLogicSystem(key, (entities, { entityManager }) => {
for (const entity of entities) {
// do something using the entityManager
}
})
// later ...
entityManager.onLogic({ entityManager })
This will remove one of the most annoying gotchas in the current API.
Since a user can pass any options in the
opts
param when invoking a system, there is no longer any need to bind theEntityManager
instance as thethis
argument to registered systems.To achieve the old behavior, a user can simply:
This will remove one of the most annoying gotchas in the current API.