You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
973 B
29 lines
973 B
import { ConstantSignalComponent } from "../components/constant_signal";
|
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
|
|
|
export class ConstantSignalSystem extends GameSystemWithFilter {
|
|
constructor(root) {
|
|
super(root, [ConstantSignalComponent]);
|
|
|
|
this.root.signals.entityManuallyPlaced.add(entity => {
|
|
const editorHud = this.root.hud.parts.constantSignalEdit;
|
|
if (editorHud) {
|
|
editorHud.editConstantSignal(entity, { deleteOnCancel: true });
|
|
}
|
|
});
|
|
}
|
|
|
|
update() {
|
|
// Set signals
|
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
|
const entity = this.allEntities[i];
|
|
const signalComp = entity.components.ConstantSignal;
|
|
const pinsComp = entity.components.WiredPins;
|
|
|
|
if (pinsComp) {
|
|
pinsComp.slots[0].value = signalComp.signal;
|
|
}
|
|
}
|
|
}
|
|
}
|