24 lines
568 B
JavaScript
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});
|
|
}
|
|
};
|
|
}
|
|
} |