mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Allow color inverter to process colors as well
This commit is contained in:
@@ -94,9 +94,7 @@ export class MetaAdvancedProcessorBuilding extends MetaBuilding {
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.left],
|
||||
filter: enumItemType.shape,
|
||||
},
|
||||
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.top],
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { globalConfig } from "../../core/config";
|
||||
import { BaseItem } from "../base_item";
|
||||
import { enumColorMixingResults } from "../colors";
|
||||
import { BaseItem, enumItemType } from "../base_item";
|
||||
import { enumColorMixingResults, enumInvertedColors } from "../colors";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||
import { ColorItem } from "../items/color_item";
|
||||
import { ShapeItem } from "../items/shape_item";
|
||||
import { enumLayer } from "../root";
|
||||
import { NEGATIVE_ENERGY_ITEM_SINGLETON } from "../items/negative_energy_item";
|
||||
|
||||
export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
constructor(root) {
|
||||
@@ -346,13 +344,29 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
||||
// ADVANCED PROCESSING
|
||||
|
||||
case enumItemProcessorTypes.advancedProcessor: {
|
||||
const shapeItem = /** @type {ShapeItem} */ (items[0].item);
|
||||
const newItem = this.root.shapeDefinitionMgr.shapeActionInvertColors(shapeItem.definition);
|
||||
const item = items[0].item;
|
||||
|
||||
if (item.getItemType() === enumItemType.color) {
|
||||
const colorItem = /** @type {ColorItem} */ (items[0].item);
|
||||
const newColor = enumInvertedColors[colorItem.color];
|
||||
outItems.push({
|
||||
item: new ColorItem(newColor),
|
||||
requiredSlot: 0,
|
||||
});
|
||||
} else if (item.getItemType() === enumItemType.shape) {
|
||||
const shapeItem = /** @type {ShapeItem} */ (items[0].item);
|
||||
const newItem = this.root.shapeDefinitionMgr.shapeActionInvertColors(
|
||||
shapeItem.definition
|
||||
);
|
||||
|
||||
outItems.push({
|
||||
item: new ShapeItem(newItem),
|
||||
requiredSlot: 0,
|
||||
});
|
||||
} else {
|
||||
assertAlways(false, "Bad item type: " + item.getItemType() + " for advanced processor.");
|
||||
}
|
||||
|
||||
outItems.push({
|
||||
item: new ShapeItem(newItem),
|
||||
requiredSlot: 0,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user