silphius/app/server/create/ecs.js
2024-07-30 09:56:53 -05:00

36 lines
798 B
JavaScript

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 = [
'Behave',
'PassTime',
'Attract',
'ResetForces',
'ApplyControlMovement',
'IntegratePhysics',
'ClampPositions',
'PlantGrowth',
'FollowCamera',
'VisibleAabbs',
'MaintainColliderHash',
'Colliders',
'ControlDirection',
'SpriteDirection',
'RunAnimations',
'RunTickingPromises',
'Water',
'Interactions',
'InventoryCloser',
'KillPerishable',
];
defaultSystems.forEach((defaultSystem) => {
const System = ecs.system(defaultSystem);
if (System) {
System.active = true;
}
});
return ecs;
}