silphius/app/ecs/components/emitter.js
2024-07-20 05:07:39 -05:00

24 lines
568 B
JavaScript

import Component from '@/ecs/component.js';
export default class Emitter extends Component {
mergeDiff(original, update) {
const merged = {};
if (update.emit) {
merged.emit = {
...original.emit,
...update.emit,
}
}
return merged;
}
instanceFromSchema() {
const Component = this;
return class EmitterInstance extends super.instanceFromSchema() {
emitting = {};
id = 0;
emit(specification) {
Component.markChange(this.entity, 'emit', {[this.id++]: specification});
}
};
}
}