import Component from '@/ecs/component.js'; export default class Sound extends Component { mergeDiff(original, update) { const merged = {}; if (update.play) { merged.play = [ ...(original.play ?? []), ...update.play, ]; } return merged; } instanceFromSchema() { const Component = this; const Instance = super.instanceFromSchema(); return class SoundInstance extends Instance { play(source) { Component.markChange(this.entity, 'play', [source]); } }; } }