1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Add type hints to signals

This commit is contained in:
tobspr
2020-05-14 08:44:07 +02:00
parent ca3f4ff02a
commit cf5d776270
9 changed files with 53 additions and 52 deletions

View File

@@ -157,11 +157,9 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
item: new ShapeItem(cutDefinition1),
requiredSlot: 0,
});
this.root.signals.shapeProduced.dispatch(cutDefinition1);
}
if (!cutDefinition2.isEntirelyEmpty()) {
this.root.signals.shapeProduced.dispatch(cutDefinition2);
outItems.push({
item: new ShapeItem(cutDefinition2),
requiredSlot: 1,
@@ -178,7 +176,6 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
const inputDefinition = inputItem.definition;
const rotatedDefinition = this.root.shapeDefinitionMgr.shapeActionRotateCW(inputDefinition);
this.root.signals.shapeProduced.dispatch(rotatedDefinition);
outItems.push({
item: new ShapeItem(rotatedDefinition),
});
@@ -200,7 +197,6 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
lowerItem.definition,
upperItem.definition
);
this.root.signals.shapeProduced.dispatch(stackedDefinition);
outItems.push({
item: new ShapeItem(stackedDefinition),
});
@@ -253,7 +249,6 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
colorItem.color
);
this.root.signals.shapeProduced.dispatch(colorizedDefinition);
outItems.push({
item: new ShapeItem(colorizedDefinition),
});
@@ -277,6 +272,11 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
assertAlways(false, "Unkown item processor type: " + processorComp.type);
}
// Track produced items
for (let i = 0; i < outItems.length; ++i) {
this.root.signals.itemProduced.dispatch(outItems[i].item);
}
processorComp.itemsToEject = outItems;
}

View File

@@ -38,9 +38,7 @@ export class MinerSystem extends GameSystemWithFilter {
}
// Analytics hook
if (lowerLayerItem instanceof ShapeItem) {
this.root.signals.shapeProduced.dispatch(lowerLayerItem.definition);
}
this.root.signals.itemProduced.dispatch(lowerLayerItem);
// Try actually ejecting
if (!ejectComp.tryEject(0, lowerLayerItem)) {