silphius/app/ecs-systems/water.js
2024-06-30 15:54:23 -05:00

16 lines
313 B
JavaScript

import {System} from '@/ecs/index.js';
export default class Water extends System {
frequency = 1;
tick(elapsed) {
const {Water} = this.ecs.get(1);
for (const tile in Water.water) {
Water.water[tile] = Math.max(0, Water.water[tile] - elapsed);
}
Water.water = {...Water.water};
}
}