/
RaskolnickOFF
/
3D
Обзор
Документация
Войти
/
RaskolnickOFF
/
3D
Код
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/source/systems/services/CleanupSystem.js
24 строки
790 B
RaskolnickOFF
Structure update
06 июн 2026, 03:18
06 июн 2026, 03:18
9bc1c25
Код
Авторство
О чём код?
// js/source/systems/services/CleanupSystem.js — удаление PENDING_DESTROY сущностей (симуляция) import { Components } from '../../core/Components.js'; import { GameEvents } from '../../core/GameEvents.js'; export class CleanupSystem { /** * @param {import('../../core/SimulationContext.js').SimulationContext} ctx */ constructor(ctx) { this.engine = ctx.engine; this.eventBus = ctx.eventBus; } update() { const entities = this.engine.with(Components.PENDING_DESTROY); for (const entity of entities) { const mesh = entity.get(Components.MESH); this.eventBus.emit(GameEvents.ENTITY_DESTROYED, { entity, mesh }); this.engine.removeEntity(entity.id); } } }