Fix cutter

This commit is contained in:
tobspr 2020-08-18 20:12:18 +02:00
parent 1a6c91f4e9
commit 93f9d7ae23
1 changed files with 10 additions and 2 deletions

View File

@ -226,6 +226,10 @@ export class LogicGateSystem extends GameSystemWithFilter {
const definition = /** @type {ShapeItem} */ (item).definition;
const lowerLayer = /** @type {import("../shape_definition").ShapeLayer} */ (definition.layers[0]);
if (!lowerLayer) {
return [null, null];
}
const topRightContent = lowerLayer[0];
if (!topRightContent || topRightContent.subShape === null) {
@ -263,8 +267,12 @@ export class LogicGateSystem extends GameSystemWithFilter {
const definition = /** @type {ShapeItem} */ (item).definition;
const result = this.root.shapeDefinitionMgr.shapeActionCutHalf(definition);
return [
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[0]),
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[1]),
result[0].isEntirelyEmpty()
? null
: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[0]),
result[1].isEntirelyEmpty()
? null
: this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[1]),
];
}