silphius/app/create-ecs.js

32 lines
711 B
JavaScript
Raw Normal View History

2024-07-02 20:43:55 -05:00
import Components from '@/ecs-components/index.js';
import Systems from '@/ecs-systems/index.js';
export default function createEcs(Ecs) {
const ecs = new Ecs({Components, Systems});
const defaultSystems = [
2024-07-04 15:17:33 -05:00
'PassTime',
2024-07-03 19:05:40 -05:00
'Attract',
2024-07-02 20:43:55 -05:00
'ResetForces',
'ApplyControlMovement',
'IntegratePhysics',
'ClampPositions',
'PlantGrowth',
'FollowCamera',
'VisibleAabbs',
2024-07-02 22:42:56 -05:00
'Colliders',
2024-07-02 20:43:55 -05:00
'ControlDirection',
'SpriteDirection',
'RunAnimations',
'RunTickingPromises',
'Water',
'Interactions',
];
defaultSystems.forEach((defaultSystem) => {
const System = ecs.system(defaultSystem);
if (System) {
System.active = true;
}
});
return ecs;
}