30 lines
681 B
JavaScript
30 lines
681 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 = [
|
||
|
'ResetForces',
|
||
|
'ApplyControlMovement',
|
||
|
'IntegratePhysics',
|
||
|
'ClampPositions',
|
||
|
'PlantGrowth',
|
||
|
'FollowCamera',
|
||
|
'VisibleAabbs',
|
||
|
'Collliders',
|
||
|
'ControlDirection',
|
||
|
'SpriteDirection',
|
||
|
'RunAnimations',
|
||
|
'RunTickingPromises',
|
||
|
'Water',
|
||
|
'Interactions',
|
||
|
];
|
||
|
defaultSystems.forEach((defaultSystem) => {
|
||
|
const System = ecs.system(defaultSystem);
|
||
|
if (System) {
|
||
|
System.active = true;
|
||
|
}
|
||
|
});
|
||
|
return ecs;
|
||
|
}
|