mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Convert all buildings to new variants system
This commit is contained in:
parent
9114c9e4c3
commit
47c8421c27
@ -34,12 +34,12 @@ export const gBuildingVariants = {
|
||||
*/
|
||||
export function registerBuildingVariant(id, meta, variant, rotationVariant = 0) {
|
||||
assert(!gBuildingVariants[id], "Duplicate id: " + id);
|
||||
gBuildingVariants[id] = {
|
||||
gBuildingVariants[id.toString()] = {
|
||||
metaClass: meta,
|
||||
variant,
|
||||
rotationVariant,
|
||||
// @ts-ignore
|
||||
tileSize: new meta().getDimensions(variant),
|
||||
tileSize: variant.getDimensions(),
|
||||
};
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ export function getCodeFromBuildingData(metaBuilding, variant, rotationVariant)
|
||||
data.variant === variant &&
|
||||
data.rotationVariant === rotationVariant
|
||||
) {
|
||||
return +key;
|
||||
return key;
|
||||
}
|
||||
}
|
||||
assertAlways(
|
||||
@ -79,5 +79,5 @@ export function getCodeFromBuildingData(metaBuilding, variant, rotationVariant)
|
||||
" / " +
|
||||
rotationVariant
|
||||
);
|
||||
return 0;
|
||||
return "0";
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Loader } from "../../core/loader";
|
||||
import { enumDirection } from "../../core/vector";
|
||||
import { SOUNDS } from "../../platform/sound";
|
||||
import { arrayBeltVariantToRotation, MetaBeltBaseBuilding } from "./belt_base";
|
||||
import { arrayBeltVariantToRotation, DefaultBeltBaseVariant, MetaBeltBaseBuilding } from "./belt_base";
|
||||
|
||||
export class MetaBeltBuilding extends MetaBeltBaseBuilding {
|
||||
constructor() {
|
||||
@ -16,7 +16,13 @@ export class MetaBeltBuilding extends MetaBeltBaseBuilding {
|
||||
return SOUNDS.placeBelt;
|
||||
}
|
||||
|
||||
getPreviewSprite(rotationVariant) {
|
||||
getAvailableVariants() {
|
||||
return [DefaultBeltVariant];
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultBeltVariant extends DefaultBeltBaseVariant {
|
||||
static getPreviewSprite(rotationVariant) {
|
||||
switch (arrayBeltVariantToRotation[rotationVariant]) {
|
||||
case enumDirection.top: {
|
||||
return Loader.getSprite("sprites/buildings/belt_top.png");
|
||||
@ -33,7 +39,7 @@ export class MetaBeltBuilding extends MetaBeltBaseBuilding {
|
||||
}
|
||||
}
|
||||
|
||||
getBlueprintSprite(rotationVariant) {
|
||||
static getBlueprintSprite(rotationVariant) {
|
||||
switch (arrayBeltVariantToRotation[rotationVariant]) {
|
||||
case enumDirection.top: {
|
||||
return Loader.getSprite("sprites/blueprints/belt_top.png");
|
||||
|
@ -4,7 +4,7 @@ import { SOUNDS } from "../../platform/sound";
|
||||
import { T } from "../../translations";
|
||||
import { BeltComponent } from "../components/belt";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
export const arrayBeltVariantToRotation = [enumDirection.top, enumDirection.left, enumDirection.right];
|
||||
@ -20,47 +20,18 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const beltSpeed = root.hubGoals.getBeltBaseSpeed();
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(beltSpeed)]];
|
||||
}
|
||||
|
||||
getStayInPlacementMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
getPlacementSound() {
|
||||
return SOUNDS.placeBelt;
|
||||
}
|
||||
|
||||
getSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
getIsReplaceable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return beltOverlayMatrices[entity.components.Belt.direction][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
@ -72,13 +43,46 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultBeltBaseVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const beltSpeed = root.hubGoals.getBeltBaseSpeed();
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(beltSpeed)]];
|
||||
}
|
||||
|
||||
static getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static getSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static getSpecialOverlayRenderMatrix(rotation, rotationVariant, entity) {
|
||||
return beltOverlayMatrices[entity.components.Belt.direction][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant) {
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.Belt.direction = arrayBeltVariantToRotation[rotationVariant];
|
||||
}
|
||||
|
||||
@ -88,11 +92,10 @@ export class MetaBeltBaseBuilding extends MetaBuilding {
|
||||
* @param {GameRoot} param0.root
|
||||
* @param {Vector} param0.tile
|
||||
* @param {number} param0.rotation
|
||||
* @param {string} param0.variant
|
||||
* @param {Layer} param0.layer
|
||||
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
|
||||
*/
|
||||
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
|
||||
static computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, layer }) {
|
||||
const topDirection = enumAngleToDirection[rotation];
|
||||
const rightDirection = enumAngleToDirection[(rotation + 90) % 360];
|
||||
const bottomDirection = enumAngleToDirection[(rotation + 180) % 360];
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { ConstantSignalComponent } from "../components/constant_signal";
|
||||
|
||||
@ -14,6 +14,10 @@ export class MetaConstantSignalBuilding extends MetaBuilding {
|
||||
return "#2bafda";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultConstantSignalVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -27,10 +31,6 @@ export class MetaConstantSignalBuilding extends MetaBuilding {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getRenderPins() {
|
||||
return false;
|
||||
}
|
||||
@ -54,3 +54,9 @@ export class MetaConstantSignalBuilding extends MetaBuilding {
|
||||
entity.addComponent(new ConstantSignalComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultConstantSignalVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
|
||||
@ -21,39 +21,16 @@ export class MetaCutterBuilding extends MetaBuilding {
|
||||
return "#7dcda2";
|
||||
}
|
||||
|
||||
getDimensions(variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
return new Vector(2, 1);
|
||||
case enumCutterVariants.quad:
|
||||
return new Vector(4, 1);
|
||||
default:
|
||||
assertAlways(false, "Unknown cutter variant: " + variant);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(
|
||||
variant === enumCutterVariants.quad
|
||||
? enumItemProcessorTypes.cutterQuad
|
||||
: enumItemProcessorTypes.cutter
|
||||
);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
/** @type {Array<typeof MetaBuildingVariant>} */
|
||||
const variants = [DefaultCutterVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_cutter_quad)) {
|
||||
return [defaultBuildingVariant, enumCutterVariants.quad];
|
||||
variants.push(QuadCutterVariant);
|
||||
}
|
||||
return super.getAvailableVariants(root);
|
||||
return variants;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,24 +64,62 @@ export class MetaCutterBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultCutterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions(variant) {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.cutter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
{ pos: new Vector(1, 0), direction: enumDirection.top },
|
||||
]);
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.cutter;
|
||||
break;
|
||||
}
|
||||
case enumCutterVariants.quad: {
|
||||
}
|
||||
|
||||
export class QuadCutterVariant extends DefaultCutterVariant {
|
||||
static getId() {
|
||||
return enumCutterVariants.quad;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(4, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.cutterQuad);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
{ pos: new Vector(1, 0), direction: enumDirection.top },
|
||||
@ -112,11 +127,5 @@ export class MetaCutterBuilding extends MetaBuilding {
|
||||
{ pos: new Vector(3, 0), direction: enumDirection.top },
|
||||
]);
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.cutterQuad;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assertAlways(false, "Unknown painter variant: " + variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { DisplayComponent } from "../components/display";
|
||||
|
||||
@ -14,6 +14,10 @@ export class MetaDisplayBuilding extends MetaBuilding {
|
||||
return "#aaaaaa";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultDisplayVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -22,10 +26,6 @@ export class MetaDisplayBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getShowWiresLayerPreview() {
|
||||
return true;
|
||||
}
|
||||
@ -49,3 +49,9 @@ export class MetaDisplayBuilding extends MetaBuilding {
|
||||
entity.addComponent(new DisplayComponent());
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultDisplayVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import {
|
||||
} from "../components/item_processor";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
export class MetaFilterBuilding extends MetaBuilding {
|
||||
@ -20,6 +20,10 @@ export class MetaFilterBuilding extends MetaBuilding {
|
||||
return "#c45c2e";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultFilterVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -28,10 +32,6 @@ export class MetaFilterBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
getShowWiresLayerPreview() {
|
||||
return true;
|
||||
}
|
||||
@ -88,3 +88,13 @@ export class MetaFilterBuilding extends MetaBuilding {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultFilterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { HubComponent } from "../components/hub";
|
||||
import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||
|
||||
export class MetaHubBuilding extends MetaBuilding {
|
||||
@ -11,25 +11,12 @@ export class MetaHubBuilding extends MetaBuilding {
|
||||
super("hub");
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(4, 4);
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#eb5555";
|
||||
}
|
||||
|
||||
getIsRotateable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
getBlueprintSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
getSprite() {
|
||||
// We render it ourself
|
||||
return null;
|
||||
getAvailableVariants() {
|
||||
return [DefaultHubVariant];
|
||||
}
|
||||
|
||||
getIsRemovable() {
|
||||
@ -139,3 +126,26 @@ export class MetaHubBuilding extends MetaBuilding {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultHubVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getIsRotateable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static getBlueprintSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
static getSprite() {
|
||||
// We render it ourself
|
||||
return null;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(4, 4);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { LeverComponent } from "../components/lever";
|
||||
|
||||
@ -15,6 +15,10 @@ export class MetaLeverBuilding extends MetaBuilding {
|
||||
return "#1a678b";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultLeverVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -23,14 +27,6 @@ export class MetaLeverBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getSprite() {
|
||||
return null;
|
||||
}
|
||||
|
||||
getShowWiresLayerPreview() {
|
||||
return true;
|
||||
}
|
||||
@ -55,3 +51,17 @@ export class MetaLeverBuilding extends MetaBuilding {
|
||||
entity.addComponent(new LeverComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultLeverVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
static getSprite() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
|
||||
import { MetaBuilding, defaultBuildingVariant, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumLogicGateType, LogicGateComponent } from "../components/logic_gate";
|
||||
|
||||
@ -44,18 +44,8 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [
|
||||
defaultBuildingVariant,
|
||||
enumLogicGateVariants.not,
|
||||
enumLogicGateVariants.xor,
|
||||
enumLogicGateVariants.or,
|
||||
enumLogicGateVariants.transistor,
|
||||
];
|
||||
return [ANDGateVariant, NOTGateVariant, XORGateVariant, ORGateVariant, TransistorVariant];
|
||||
}
|
||||
|
||||
getRenderPins() {
|
||||
@ -63,21 +53,43 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
);
|
||||
|
||||
entity.addComponent(new LogicGateComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class ANDGateVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
const gateType = enumVariantToGate[variant];
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
const gateType = enumVariantToGate[this.getId()];
|
||||
entity.components.LogicGate.type = gateType;
|
||||
|
||||
const pinComp = entity.components.WiredPins;
|
||||
|
||||
switch (gateType) {
|
||||
case enumLogicGateType.and:
|
||||
case enumLogicGateType.xor:
|
||||
case enumLogicGateType.or: {
|
||||
this.updateWiredPins(pinComp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
@ -95,9 +107,54 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
case enumLogicGateType.transistor: {
|
||||
}
|
||||
|
||||
export class NOTGateVariant extends ANDGateVariant {
|
||||
static getId() {
|
||||
return enumLogicGateVariants.not;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
export class XORGateVariant extends ANDGateVariant {
|
||||
static getId() {
|
||||
return enumLogicGateVariants.xor;
|
||||
}
|
||||
}
|
||||
|
||||
export class ORGateVariant extends ANDGateVariant {
|
||||
static getId() {
|
||||
return enumLogicGateVariants.or;
|
||||
}
|
||||
}
|
||||
|
||||
export class TransistorVariant extends ANDGateVariant {
|
||||
static getId() {
|
||||
return enumLogicGateVariants.transistor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
@ -115,41 +172,5 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
|
||||
case enumLogicGateType.not: {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assertAlways("unknown logic gate type: " + gateType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
);
|
||||
|
||||
entity.addComponent(new LogicGateComponent({}));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { enumDirection, Vector } from "../../core/vector";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { MinerComponent } from "../components/miner";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
|
||||
import { MetaBuilding, defaultBuildingVariant, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
import { T } from "../../translations";
|
||||
@ -22,35 +22,17 @@ export class MetaMinerBuilding extends MetaBuilding {
|
||||
return "#b37dcd";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getMinerBaseSpeed();
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
/** @type {Array<typeof MetaBuildingVariant>} */
|
||||
const variants = [DefaultMinerVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_miner_chainable)) {
|
||||
return [defaultBuildingVariant, enumMinerVariants.chainable];
|
||||
variants.push(ChainableMinerVariant);
|
||||
}
|
||||
return super.getAvailableVariants(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return overlayMatrix;
|
||||
return variants;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -65,14 +47,44 @@ export class MetaMinerBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultMinerVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
entity.components.Miner.chainable = variant === enumMinerVariants.chainable;
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getMinerBaseSpeed();
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
static getSpecialOverlayRenderMatrix() {
|
||||
return overlayMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static updateEntityComponents(entity) {
|
||||
entity.components.Miner.chainable = false;
|
||||
}
|
||||
}
|
||||
|
||||
export class ChainableMinerVariant extends DefaultMinerVariant {
|
||||
static getId() {
|
||||
return enumMinerVariants.chainable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static updateEntityComponents(entity) {
|
||||
entity.components.Miner.chainable = true;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
|
||||
@ -14,14 +14,14 @@ export class MetaMixerBuilding extends MetaBuilding {
|
||||
super("mixer");
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#cdbb7d";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultMixerVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -29,16 +29,6 @@ export class MetaMixerBuilding extends MetaBuilding {
|
||||
return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_mixer);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.mixer);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
@ -74,3 +64,22 @@ export class MetaMixerBuilding extends MetaBuilding {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultMixerVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.mixer);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
enumItemProcessorRequirements,
|
||||
} from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||
@ -22,57 +22,20 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
super("painter");
|
||||
}
|
||||
|
||||
getDimensions(variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
case enumPainterVariants.mirrored:
|
||||
return new Vector(2, 1);
|
||||
case enumPainterVariants.double:
|
||||
return new Vector(2, 2);
|
||||
case enumPainterVariants.quad:
|
||||
return new Vector(4, 1);
|
||||
default:
|
||||
assertAlways(false, "Unknown painter variant: " + variant);
|
||||
}
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#cd9b7d";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
case enumPainterVariants.mirrored: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumPainterVariants.double: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterDouble);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed, true)]];
|
||||
}
|
||||
case enumPainterVariants.quad: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterQuad);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
let variants = [defaultBuildingVariant, enumPainterVariants.mirrored];
|
||||
let variants = [DefaultPainterVariant, MirroredPainterVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_painter_double)) {
|
||||
variants.push(enumPainterVariants.double);
|
||||
variants.push(DoublePainterVariant);
|
||||
}
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_painter_quad)) {
|
||||
variants.push(enumPainterVariants.quad);
|
||||
variants.push(QuadPainterVariant);
|
||||
}
|
||||
return variants;
|
||||
}
|
||||
@ -113,19 +76,32 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultPainterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
case enumPainterVariants.mirrored: {
|
||||
// REGULAR PAINTER
|
||||
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (entity.components.WiredPins) {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
@ -138,27 +114,79 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [
|
||||
variant === defaultBuildingVariant ? enumDirection.top : enumDirection.bottom,
|
||||
],
|
||||
directions: [enumDirection.top],
|
||||
filter: "color",
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(1, 0), direction: enumDirection.right },
|
||||
]);
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(1, 0), direction: enumDirection.right }]);
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.painter;
|
||||
entity.components.ItemProcessor.processingRequirement = null;
|
||||
entity.components.ItemProcessor.inputsPerCharge = 2;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case enumPainterVariants.double: {
|
||||
// DOUBLE PAINTER
|
||||
export class MirroredPainterVariant extends DefaultPainterVariant {
|
||||
static getId() {
|
||||
return enumPainterVariants.mirrored;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (entity.components.WiredPins) {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(1, 0), direction: enumDirection.right }]);
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.painter;
|
||||
entity.components.ItemProcessor.processingRequirement = null;
|
||||
entity.components.ItemProcessor.inputsPerCharge = 2;
|
||||
}
|
||||
}
|
||||
|
||||
export class DoublePainterVariant extends DefaultPainterVariant {
|
||||
static getId() {
|
||||
return enumPainterVariants.double;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterDouble);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed, true)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (entity.components.WiredPins) {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
@ -181,19 +209,38 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(1, 0), direction: enumDirection.right },
|
||||
]);
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(1, 0), direction: enumDirection.right }]);
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.painterDouble;
|
||||
entity.components.ItemProcessor.processingRequirement = null;
|
||||
entity.components.ItemProcessor.inputsPerCharge = 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
case enumPainterVariants.quad: {
|
||||
// QUAD PAINTER
|
||||
export class QuadPainterVariant extends DefaultPainterVariant {
|
||||
static getId() {
|
||||
return enumPainterVariants.quad;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(4, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.painterQuad);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (!entity.components.WiredPins) {
|
||||
entity.addComponent(new WiredPinsComponent({ slots: [] }));
|
||||
}
|
||||
@ -249,20 +296,10 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
]);
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(0, 0), direction: enumDirection.top }]);
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.painterQuad;
|
||||
entity.components.ItemProcessor.processingRequirement =
|
||||
enumItemProcessorRequirements.painterQuad;
|
||||
entity.components.ItemProcessor.processingRequirement = enumItemProcessorRequirements.painterQuad;
|
||||
entity.components.ItemProcessor.inputsPerCharge = 5;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assertAlways(false, "Unknown painter variant: " + variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { BeltUnderlaysComponent } from "../components/belt_underlays";
|
||||
import { BeltReaderComponent } from "../components/belt_reader";
|
||||
@ -18,6 +18,10 @@ export class MetaReaderBuilding extends MetaBuilding {
|
||||
return "#25fff2";
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultReaderVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
@ -26,10 +30,6 @@ export class MetaReaderBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getShowWiresLayerPreview() {
|
||||
return true;
|
||||
}
|
||||
@ -99,3 +99,9 @@ export class MetaReaderBuilding extends MetaBuilding {
|
||||
entity.addComponent(new BeltReaderComponent());
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultReaderVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
|
||||
@ -21,39 +21,17 @@ export class MetaRotaterBuilding extends MetaBuilding {
|
||||
return "#7dc6cd";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotater);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumRotaterVariants.ccw: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotaterCCW);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
case enumRotaterVariants.fl: {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotaterFL);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
let variants = [defaultBuildingVariant];
|
||||
let variants = [DefaultRotaterVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_rotater_ccw)) {
|
||||
variants.push(enumRotaterVariants.ccw);
|
||||
variants.push(CCWRotaterVariant);
|
||||
}
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_rotater_fl)) {
|
||||
variants.push(enumRotaterVariants.fl);
|
||||
variants.push(FLRotaterVariant);
|
||||
}
|
||||
return variants;
|
||||
}
|
||||
@ -94,29 +72,76 @@ export class MetaRotaterBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultRotaterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotater);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.rotater;
|
||||
break;
|
||||
}
|
||||
case enumRotaterVariants.ccw: {
|
||||
}
|
||||
|
||||
export class CCWRotaterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return enumRotaterVariants.ccw;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotaterCCW);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.rotaterCCW;
|
||||
break;
|
||||
}
|
||||
case enumRotaterVariants.fl: {
|
||||
}
|
||||
|
||||
export class FLRotaterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return enumRotaterVariants.fl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.rotaterFL);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.rotaterFL;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertAlways(false, "Unknown rotater variant: " + variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
|
||||
import { MetaBuilding, defaultBuildingVariant, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
import { T } from "../../translations";
|
||||
@ -23,30 +23,6 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
super("splitter");
|
||||
}
|
||||
|
||||
getDimensions(variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
return new Vector(2, 1);
|
||||
case enumSplitterVariants.compact:
|
||||
case enumSplitterVariants.compactInverse:
|
||||
case enumSplitterVariants.compactMerge:
|
||||
case enumSplitterVariants.compactMergeInverse:
|
||||
return new Vector(1, 1);
|
||||
default:
|
||||
assertAlways(false, "Unknown splitter variant: " + variant);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.splitter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#444";
|
||||
}
|
||||
@ -55,17 +31,17 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
let available = [defaultBuildingVariant];
|
||||
let variants = [DefaultSplitterVariant];
|
||||
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_splitter_compact)) {
|
||||
available.push(enumSplitterVariants.compact, enumSplitterVariants.compactInverse);
|
||||
variants.push(CompactSplitterVariant, CompactInverseSplitterVariant);
|
||||
}
|
||||
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_merger_compact)) {
|
||||
available.push(enumSplitterVariants.compactMerge, enumSplitterVariants.compactMergeInverse);
|
||||
variants.push(CompactMergerVariant, CompactInverseMergerVariant);
|
||||
}
|
||||
|
||||
return available;
|
||||
return variants;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,16 +77,31 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
|
||||
entity.addComponent(new BeltUnderlaysComponent({ underlays: [] }));
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultSplitterVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.splitter);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
@ -131,11 +122,23 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
{ pos: new Vector(1, 0), direction: enumDirection.top },
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
case enumSplitterVariants.compact:
|
||||
case enumSplitterVariants.compactInverse: {
|
||||
}
|
||||
|
||||
export class CompactSplitterVariant extends DefaultSplitterVariant {
|
||||
static getId() {
|
||||
return enumSplitterVariants.compact;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
@ -143,26 +146,53 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [
|
||||
variant === enumSplitterVariants.compactInverse
|
||||
? enumDirection.left
|
||||
: enumDirection.right,
|
||||
],
|
||||
directions: [enumDirection.right],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(0, 0), direction: enumDirection.top }]);
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [{ pos: new Vector(0, 0), direction: enumDirection.top }];
|
||||
}
|
||||
}
|
||||
|
||||
export class CompactInverseSplitterVariant extends CompactSplitterVariant {
|
||||
static getId() {
|
||||
return enumSplitterVariants.compactInverse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
];
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(0, 0), direction: enumDirection.top }]);
|
||||
|
||||
break;
|
||||
entity.components.BeltUnderlays.underlays = [{ pos: new Vector(0, 0), direction: enumDirection.top }];
|
||||
}
|
||||
case enumSplitterVariants.compactMerge:
|
||||
case enumSplitterVariants.compactMergeInverse: {
|
||||
}
|
||||
|
||||
export class CompactMergerVariant extends CompactSplitterVariant {
|
||||
static getId() {
|
||||
return enumSplitterVariants.compactMerge;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
@ -177,21 +207,42 @@ export class MetaSplitterBuilding extends MetaBuilding {
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction:
|
||||
variant === enumSplitterVariants.compactMergeInverse
|
||||
? enumDirection.left
|
||||
: enumDirection.right,
|
||||
direction: enumDirection.right,
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [
|
||||
{ pos: new Vector(0, 0), direction: enumDirection.top },
|
||||
];
|
||||
entity.components.BeltUnderlays.underlays = [{ pos: new Vector(0, 0), direction: enumDirection.top }];
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertAlways(false, "Unknown splitter variant: " + variant);
|
||||
export class CompactInverseMergerVariant extends CompactSplitterVariant {
|
||||
static getId() {
|
||||
return enumSplitterVariants.compactMergeInverse;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [{ pos: new Vector(0, 0), direction: enumDirection.top }];
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/item_processor";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
|
||||
@ -18,18 +18,8 @@ export class MetaStackerBuilding extends MetaBuilding {
|
||||
return "#9fcd7d";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.stacker);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
getAvailableVariants() {
|
||||
return [DefaultStackerVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,3 +64,22 @@ export class MetaStackerBuilding extends MetaBuilding {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultStackerVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const speed = root.hubGoals.getProcessorBaseSpeed(enumItemProcessorTypes.stacker);
|
||||
return [[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(speed)]];
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { enumItemProcessorTypes, ItemProcessorComponent } from "../components/it
|
||||
import { StorageComponent } from "../components/storage";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
|
||||
@ -21,45 +21,20 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||
super("trash");
|
||||
}
|
||||
|
||||
getIsRotateable(variant) {
|
||||
return variant !== defaultBuildingVariant;
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#cd7d86";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
if (variant === enumTrashVariants.storage) {
|
||||
return [[T.ingame.buildingPlacement.infoTexts.storage, formatBigNumber(trashSize)]];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
getDimensions(variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant:
|
||||
return new Vector(1, 1);
|
||||
case enumTrashVariants.storage:
|
||||
return new Vector(2, 2);
|
||||
default:
|
||||
assertAlways(false, "Unknown trash variant: " + variant);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
/** @type {Array<typeof MetaBuildingVariant>} */
|
||||
const variants = [DefaultTrashVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_storage)) {
|
||||
return [defaultBuildingVariant, enumTrashVariants.storage];
|
||||
variants.push(StorageTrashVariant);
|
||||
}
|
||||
return super.getAvailableVariants(root);
|
||||
return variants;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,16 +72,22 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultTrashVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
static getIsRotateable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
switch (variant) {
|
||||
case defaultBuildingVariant: {
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (!entity.components.ItemProcessor) {
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
@ -135,9 +116,36 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||
]);
|
||||
entity.components.ItemEjector.setSlots([]);
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.trash;
|
||||
break;
|
||||
}
|
||||
case enumTrashVariants.storage: {
|
||||
}
|
||||
/**/
|
||||
|
||||
export class StorageTrashVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return enumTrashVariants.storage;
|
||||
}
|
||||
|
||||
static getIsRotateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
return [[T.ingame.buildingPlacement.infoTexts.storage, formatBigNumber(trashSize)]];
|
||||
}
|
||||
|
||||
static getDimensions() {
|
||||
return new Vector(2, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
if (entity.components.ItemProcessor) {
|
||||
entity.removeComponent(ItemProcessorComponent);
|
||||
}
|
||||
@ -185,10 +193,5 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertAlways(false, "Unknown trash variant: " + variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,13 @@ import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||
import { enumUndergroundBeltMode, UndergroundBeltComponent } from "../components/underground_belt";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
|
||||
import { MetaBuilding, defaultBuildingVariant, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { globalConfig } from "../../core/config";
|
||||
import { enumHubGoalRewards } from "../tutorial_goals";
|
||||
import { formatItemsPerSecond, generateMatrixRotations } from "../../core/utils";
|
||||
import { T } from "../../translations";
|
||||
import { DefaultWireTunnelVariant } from "./wire_tunnel";
|
||||
|
||||
/** @enum {string} */
|
||||
export const arrayUndergroundRotationVariantToMode = [
|
||||
@ -50,91 +51,16 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return overlayMatrices[rotationVariant][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @param {string} variant
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
getAdditionalStatistics(root, variant) {
|
||||
const rangeTiles =
|
||||
globalConfig.undergroundBeltMaxTilesByTier[enumUndergroundBeltVariantToTier[variant]];
|
||||
|
||||
const beltSpeed = root.hubGoals.getUndergroundBeltBaseSpeed();
|
||||
return [
|
||||
[
|
||||
T.ingame.buildingPlacement.infoTexts.range,
|
||||
T.ingame.buildingPlacement.infoTexts.tiles.replace("<x>", "" + rangeTiles),
|
||||
],
|
||||
[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(beltSpeed)],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getAvailableVariants(root) {
|
||||
/** @type {Array<typeof MetaBuildingVariant>} */
|
||||
const variants = [DefaultUndergroundBeltVariant];
|
||||
if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_underground_belt_tier_2)) {
|
||||
return [defaultBuildingVariant, enumUndergroundBeltVariants.tier2];
|
||||
variants.push(Tier2UndergroundBeltVariant);
|
||||
}
|
||||
return super.getAvailableVariants(root);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
getPreviewSprite(rotationVariant, variant) {
|
||||
let suffix = "";
|
||||
if (variant !== defaultBuildingVariant) {
|
||||
suffix = "-" + variant;
|
||||
}
|
||||
|
||||
switch (arrayUndergroundRotationVariantToMode[rotationVariant]) {
|
||||
case enumUndergroundBeltMode.sender:
|
||||
return Loader.getSprite("sprites/buildings/underground_belt_entry" + suffix + ".png");
|
||||
case enumUndergroundBeltMode.receiver:
|
||||
return Loader.getSprite("sprites/buildings/underground_belt_exit" + suffix + ".png");
|
||||
default:
|
||||
assertAlways(false, "Invalid rotation variant");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
getBlueprintSprite(rotationVariant, variant) {
|
||||
let suffix = "";
|
||||
if (variant !== defaultBuildingVariant) {
|
||||
suffix = "-" + variant;
|
||||
}
|
||||
|
||||
switch (arrayUndergroundRotationVariantToMode[rotationVariant]) {
|
||||
case enumUndergroundBeltMode.sender:
|
||||
return Loader.getSprite("sprites/blueprints/underground_belt_entry" + suffix + ".png");
|
||||
case enumUndergroundBeltMode.receiver:
|
||||
return Loader.getSprite("sprites/blueprints/underground_belt_exit" + suffix + ".png");
|
||||
default:
|
||||
assertAlways(false, "Invalid rotation variant");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
getSprite(rotationVariant, variant) {
|
||||
return this.getPreviewSprite(rotationVariant, variant);
|
||||
return variants;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -163,6 +89,87 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultUndergroundBeltVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static getSpecialOverlayRenderMatrix(rotation, rotationVariant, entity) {
|
||||
return overlayMatrices[rotationVariant][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
* @returns {Array<[string, string]>}
|
||||
*/
|
||||
static getAdditionalStatistics(root) {
|
||||
const rangeTiles =
|
||||
globalConfig.undergroundBeltMaxTilesByTier[enumUndergroundBeltVariantToTier[this.getId()]];
|
||||
|
||||
const beltSpeed = root.hubGoals.getUndergroundBeltBaseSpeed();
|
||||
return [
|
||||
[
|
||||
T.ingame.buildingPlacement.infoTexts.range,
|
||||
T.ingame.buildingPlacement.infoTexts.tiles.replace("<x>", "" + rangeTiles),
|
||||
],
|
||||
[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(beltSpeed)],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getPreviewSprite(rotationVariant, building) {
|
||||
let suffix = "";
|
||||
if (this.getId() !== defaultBuildingVariant) {
|
||||
suffix = "-" + this.getId();
|
||||
}
|
||||
|
||||
switch (arrayUndergroundRotationVariantToMode[rotationVariant]) {
|
||||
case enumUndergroundBeltMode.sender:
|
||||
return Loader.getSprite("sprites/buildings/underground_belt_entry" + suffix + ".png");
|
||||
case enumUndergroundBeltMode.receiver:
|
||||
return Loader.getSprite("sprites/buildings/underground_belt_exit" + suffix + ".png");
|
||||
default:
|
||||
assertAlways(false, "Invalid rotation variant");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getBlueprintSprite(rotationVariant, building) {
|
||||
let suffix = "";
|
||||
if (this.getId() !== defaultBuildingVariant) {
|
||||
suffix = "-" + this.getId();
|
||||
}
|
||||
|
||||
switch (arrayUndergroundRotationVariantToMode[rotationVariant]) {
|
||||
case enumUndergroundBeltMode.sender:
|
||||
return Loader.getSprite("sprites/blueprints/underground_belt_entry" + suffix + ".png");
|
||||
case enumUndergroundBeltMode.receiver:
|
||||
return Loader.getSprite("sprites/blueprints/underground_belt_exit" + suffix + ".png");
|
||||
default:
|
||||
assertAlways(false, "Invalid rotation variant");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getSprite(rotationVariant, building) {
|
||||
return this.getPreviewSprite(rotationVariant, building);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should compute the optimal rotation variant on the given tile
|
||||
@ -170,14 +177,13 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
* @param {GameRoot} param0.root
|
||||
* @param {Vector} param0.tile
|
||||
* @param {number} param0.rotation
|
||||
* @param {string} param0.variant
|
||||
* @param {Layer} param0.layer
|
||||
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
|
||||
*/
|
||||
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
|
||||
static computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, layer }) {
|
||||
const searchDirection = enumAngleToDirection[rotation];
|
||||
const searchVector = enumDirectionToVector[searchDirection];
|
||||
const tier = enumUndergroundBeltVariantToTier[variant];
|
||||
const tier = enumUndergroundBeltVariantToTier[this.getId()];
|
||||
|
||||
const targetRotation = (rotation + 180) % 360;
|
||||
const targetSenderRotation = rotation;
|
||||
@ -231,10 +237,10 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
entity.components.UndergroundBelt.tier = enumUndergroundBeltVariantToTier[variant];
|
||||
static updateEntityComponents(entity, rotationVariant, root) {
|
||||
entity.components.UndergroundBelt.tier = enumUndergroundBeltVariantToTier[this.getId()];
|
||||
|
||||
switch (arrayUndergroundRotationVariantToMode[rotationVariant]) {
|
||||
case enumUndergroundBeltMode.sender: {
|
||||
@ -264,3 +270,9 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class Tier2UndergroundBeltVariant extends DefaultUndergroundBeltVariant {
|
||||
static getId() {
|
||||
return enumUndergroundBeltVariants.tier2;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Vector, enumDirection } from "../../core/vector";
|
||||
import { LogicGateComponent, enumLogicGateType } from "../components/logic_gate";
|
||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { defaultBuildingVariant, MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
/** @enum {string} */
|
||||
@ -44,17 +44,13 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [
|
||||
defaultBuildingVariant,
|
||||
enumVirtualProcessorVariants.rotater,
|
||||
enumVirtualProcessorVariants.unstacker,
|
||||
enumVirtualProcessorVariants.analyzer,
|
||||
enumVirtualProcessorVariants.shapecompare,
|
||||
CutterVirtualProcessorVariant,
|
||||
RotaterVirtualProcessorVariant,
|
||||
UnstackerVirtualProcessorVariant,
|
||||
AnalyzerVirtualProcessorVariant,
|
||||
ShapeCompareProcessorVariant,
|
||||
];
|
||||
}
|
||||
|
||||
@ -63,78 +59,6 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
const gateType = enumVariantToGate[variant];
|
||||
entity.components.LogicGate.type = gateType;
|
||||
const pinComp = entity.components.WiredPins;
|
||||
switch (gateType) {
|
||||
case enumLogicGateType.cutter:
|
||||
case enumLogicGateType.analyzer:
|
||||
case enumLogicGateType.unstacker: {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
case enumLogicGateType.rotater: {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
case enumLogicGateType.shapecompare: {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assertAlways("unknown logic gate type: " + gateType);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
@ -149,3 +73,110 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
|
||||
entity.addComponent(new LogicGateComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class CutterVirtualProcessorVariant extends MetaBuildingVariant {
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant) {
|
||||
const gateType = enumVariantToGate[this.getId()];
|
||||
entity.components.LogicGate.type = gateType;
|
||||
const pinComp = entity.components.WiredPins;
|
||||
|
||||
this.updateWiredPins(pinComp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
export class AnalyzerVirtualProcessorVariant extends CutterVirtualProcessorVariant {
|
||||
static getId() {
|
||||
return enumVirtualProcessorVariants.analyzer;
|
||||
}
|
||||
}
|
||||
|
||||
export class UnstackerVirtualProcessorVariant extends CutterVirtualProcessorVariant {
|
||||
static getId() {
|
||||
return enumVirtualProcessorVariants.unstacker;
|
||||
}
|
||||
}
|
||||
|
||||
export class RotaterVirtualProcessorVariant extends CutterVirtualProcessorVariant {
|
||||
static getId() {
|
||||
return enumVirtualProcessorVariants.rotater;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
export class ShapeCompareProcessorVariant extends CutterVirtualProcessorVariant {
|
||||
static getId() {
|
||||
return enumVirtualProcessorVariants.shapecompare;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {WiredPinsComponent} pinComp
|
||||
*/
|
||||
static updateWiredPins(pinComp) {
|
||||
pinComp.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { enumDirection, enumDirectionToAngle, enumDirectionToVector, Vector } fr
|
||||
import { SOUNDS } from "../../platform/sound";
|
||||
import { enumWireType, WireComponent } from "../components/wire";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
|
||||
export const arrayWireRotationVariantToType = [
|
||||
@ -26,6 +26,10 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
super("wire");
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [DefaultWireVariant];
|
||||
}
|
||||
|
||||
getHasDirectionLockAvailable() {
|
||||
return true;
|
||||
}
|
||||
@ -34,10 +38,6 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
return "#25fff2";
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getStayInPlacementMode() {
|
||||
return true;
|
||||
}
|
||||
@ -46,10 +46,6 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
return SOUNDS.placeBelt;
|
||||
}
|
||||
|
||||
getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @returns {"wires"} **/
|
||||
getLayer() {
|
||||
return "wires";
|
||||
@ -79,78 +75,36 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
// @todo
|
||||
entity.addComponent(new WireComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultWireVariant extends MetaBuildingVariant {
|
||||
/**
|
||||
* @returns {string} Variant id
|
||||
*/
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Should update the entity components
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
updateVariants(entity, rotationVariant) {
|
||||
static updateEntityComponents(entity, rotationVariant, root) {
|
||||
entity.components.Wire.type = arrayWireRotationVariantToType[rotationVariant];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return wireOverlayMatrices[entity.components.Wire.type][rotation];
|
||||
}
|
||||
|
||||
getPreviewSprite(rotationVariant) {
|
||||
switch (arrayWireRotationVariantToType[rotationVariant]) {
|
||||
case enumWireType.regular: {
|
||||
return Loader.getSprite("sprites/buildings/wire.png");
|
||||
}
|
||||
case enumWireType.turn: {
|
||||
return Loader.getSprite("sprites/buildings/wire-turn.png");
|
||||
}
|
||||
case enumWireType.split: {
|
||||
return Loader.getSprite("sprites/buildings/wire-split.png");
|
||||
}
|
||||
case enumWireType.cross: {
|
||||
return Loader.getSprite("sprites/buildings/wire-cross.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getBlueprintSprite(rotationVariant) {
|
||||
switch (arrayWireRotationVariantToType[rotationVariant]) {
|
||||
case enumWireType.regular: {
|
||||
return Loader.getSprite("sprites/blueprints/wire.png");
|
||||
}
|
||||
case enumWireType.turn: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-turn.png");
|
||||
}
|
||||
case enumWireType.split: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-split.png");
|
||||
}
|
||||
case enumWireType.cross: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-cross.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Should compute the optimal rotation variant on the given tile
|
||||
* @param {object} param0
|
||||
* @param {GameRoot} param0.root
|
||||
* @param {Vector} param0.tile
|
||||
* @param {number} param0.rotation
|
||||
* @param {string} param0.variant
|
||||
* @param {string} param0.layer
|
||||
* @param {Layer} param0.layer
|
||||
* @return {{ rotation: number, rotationVariant: number, connectedEntities?: Array<Entity> }}
|
||||
*/
|
||||
computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, variant, layer }) {
|
||||
static computeOptimalDirectionAndRotationVariantAtTile({ root, tile, rotation, layer }) {
|
||||
const connections = {
|
||||
top: root.logic.computeWireEdgeStatus({ tile, rotation, edge: enumDirection.top }),
|
||||
right: root.logic.computeWireEdgeStatus({ tile, rotation, edge: enumDirection.right }),
|
||||
@ -260,4 +214,81 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
rotationVariant: arrayWireRotationVariantToType.indexOf(targetType),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Can return a special interlaved 9 elements overlay matrix for rendering
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {Entity} entity
|
||||
* @returns {Array<number>|null}
|
||||
*/
|
||||
static getSpecialOverlayRenderMatrix(rotation, rotationVariant, entity) {
|
||||
return wireOverlayMatrices[entity.components.Wire.type][rotation];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sprite for a given variant
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getSprite(rotationVariant, building) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sprite for a given variant
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getBlueprintSprite(rotationVariant, building) {
|
||||
switch (arrayWireRotationVariantToType[rotationVariant]) {
|
||||
case enumWireType.regular: {
|
||||
return Loader.getSprite("sprites/blueprints/wire.png");
|
||||
}
|
||||
case enumWireType.turn: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-turn.png");
|
||||
}
|
||||
case enumWireType.split: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-split.png");
|
||||
}
|
||||
case enumWireType.cross: {
|
||||
return Loader.getSprite("sprites/blueprints/wire-cross.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the sprite for a given variant
|
||||
* @param {number} rotationVariant
|
||||
* @param {MetaBuilding} building
|
||||
*/
|
||||
static getPreviewSprite(rotationVariant, building) {
|
||||
switch (arrayWireRotationVariantToType[rotationVariant]) {
|
||||
case enumWireType.regular: {
|
||||
return Loader.getSprite("sprites/buildings/wire.png");
|
||||
}
|
||||
case enumWireType.turn: {
|
||||
return Loader.getSprite("sprites/buildings/wire-turn.png");
|
||||
}
|
||||
case enumWireType.split: {
|
||||
return Loader.getSprite("sprites/buildings/wire-split.png");
|
||||
}
|
||||
case enumWireType.cross: {
|
||||
return Loader.getSprite("sprites/buildings/wire-cross.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to rotate automatically in the dragging direction while placing
|
||||
*/
|
||||
static getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Vector } from "../../core/vector";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding, defaultBuildingVariant } from "../meta_building";
|
||||
import { MetaBuilding, defaultBuildingVariant, MetaBuildingVariant } from "../meta_building";
|
||||
import { GameRoot } from "../root";
|
||||
import { WireTunnelComponent } from "../components/wire_tunnel";
|
||||
import { generateMatrixRotations } from "../../core/utils";
|
||||
@ -32,27 +32,8 @@ export class MetaWireTunnelBuilding extends MetaBuilding {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) {
|
||||
return wireTunnelOverlayMatrices[variant][rotation];
|
||||
}
|
||||
|
||||
getIsRotateable(variant) {
|
||||
return variant !== defaultBuildingVariant;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
getAvailableVariants() {
|
||||
return [defaultBuildingVariant, enumWireTunnelVariants.coating];
|
||||
return [DefaultWireTunnelVariant, CoatedWireTunnelVariant];
|
||||
}
|
||||
|
||||
/** @returns {"wires"} **/
|
||||
@ -60,10 +41,6 @@ export class MetaWireTunnelBuilding extends MetaBuilding {
|
||||
return "wires";
|
||||
}
|
||||
|
||||
getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
getStayInPlacementMode() {
|
||||
return true;
|
||||
}
|
||||
@ -75,13 +52,58 @@ export class MetaWireTunnelBuilding extends MetaBuilding {
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(new WireTunnelComponent({}));
|
||||
}
|
||||
}
|
||||
|
||||
export class DefaultWireTunnelVariant extends MetaBuildingVariant {
|
||||
/**
|
||||
* @returns {string} Variant id
|
||||
*/
|
||||
static getId() {
|
||||
return defaultBuildingVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {number} rotation
|
||||
* @param {number} rotationVariant
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static getSpecialOverlayRenderMatrix(rotation, rotationVariant, entity) {
|
||||
return wireTunnelOverlayMatrices[this.getId()][rotation];
|
||||
}
|
||||
|
||||
static getRotateAutomaticallyWhilePlacing() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
* @param {number} rotationVariant
|
||||
* @param {string} variant
|
||||
*/
|
||||
updateVariants(entity, rotationVariant, variant) {
|
||||
entity.components.WireTunnel.multipleDirections = variant === defaultBuildingVariant;
|
||||
static updateEntityComponents(entity) {
|
||||
entity.components.WireTunnel.multipleDirections = true;
|
||||
}
|
||||
|
||||
static getIsRotateable() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export class CoatedWireTunnelVariant extends DefaultWireTunnelVariant {
|
||||
/**
|
||||
* @returns {string} Variant id
|
||||
*/
|
||||
static getId() {
|
||||
return "coating";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
static updateEntityComponents(entity) {
|
||||
entity.components.WireTunnel.multipleDirections = false;
|
||||
}
|
||||
|
||||
static getIsRotateable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ export class StaticMapEntityComponent extends Component {
|
||||
|
||||
this.origin = origin;
|
||||
this.rotation = rotation;
|
||||
this.code = code;
|
||||
this.code = code.toString();
|
||||
this.originalRotation = originalRotation;
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
const dimensions = variant.getDimensions();
|
||||
const sprite = variant.getPreviewSprite(0, metaBuilding);
|
||||
const spriteWrapper = makeDiv(element, null, ["iconWrap"]);
|
||||
spriteWrapper.setAttribute("data-tile-w", dimensions.x);
|
||||
spriteWrapper.setAttribute("data-tile-h", dimensions.y);
|
||||
spriteWrapper.setAttribute("data-tile-w", dimensions.x.toString());
|
||||
spriteWrapper.setAttribute("data-tile-h", dimensions.y.toString());
|
||||
|
||||
spriteWrapper.innerHTML = sprite.getAsHTML(iconSize * dimensions.x, iconSize * dimensions.y);
|
||||
|
||||
|
@ -10,7 +10,7 @@ import { KEYMAPPINGS } from "../../key_action_mapper";
|
||||
import { defaultBuildingVariant, MetaBuilding, MetaBuildingVariant } from "../../meta_building";
|
||||
import { BaseHUDPart } from "../base_hud_part";
|
||||
import { SOUNDS } from "../../../platform/sound";
|
||||
import { MetaMinerBuilding, enumMinerVariants } from "../../buildings/miner";
|
||||
import { MetaMinerBuilding, enumMinerVariants, ChainableMinerVariant } from "../../buildings/miner";
|
||||
import { enumHubGoalRewards } from "../../tutorial_goals";
|
||||
import { getBuildingDataFromCode, getCodeFromBuildingData } from "../../building_codes";
|
||||
import { MetaHubBuilding } from "../../buildings/hub";
|
||||
@ -332,7 +332,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
|
||||
// Select chained miner if available, since thats always desired once unlocked
|
||||
if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_miner_chainable)) {
|
||||
this.currentVariant.set(enumMinerVariants.chainable);
|
||||
this.currentVariant.set(ChainableMinerVariant);
|
||||
}
|
||||
} else {
|
||||
this.currentMetaBuilding.set(null);
|
||||
|
@ -183,9 +183,7 @@ export class MetaBuildingVariant {
|
||||
* @param {number} rotationVariant
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
static updateEntityComponents(entity, rotationVariant, root) {
|
||||
abstract;
|
||||
}
|
||||
static updateEntityComponents(entity, rotationVariant, root) {}
|
||||
|
||||
/**
|
||||
* Returns whether this building is rotateable
|
||||
|
@ -1,28 +1,90 @@
|
||||
import { gMetaBuildingRegistry } from "../core/global_registries";
|
||||
import { createLogger } from "../core/logging";
|
||||
import { MetaBeltBuilding } from "./buildings/belt";
|
||||
import { MetaBeltBaseBuilding } from "./buildings/belt_base";
|
||||
import { enumCutterVariants, MetaCutterBuilding } from "./buildings/cutter";
|
||||
import { MetaHubBuilding } from "./buildings/hub";
|
||||
import { enumMinerVariants, MetaMinerBuilding } from "./buildings/miner";
|
||||
import { MetaMixerBuilding } from "./buildings/mixer";
|
||||
import { enumPainterVariants, MetaPainterBuilding } from "./buildings/painter";
|
||||
import { enumRotaterVariants, MetaRotaterBuilding } from "./buildings/rotater";
|
||||
import { enumSplitterVariants, MetaSplitterBuilding } from "./buildings/splitter";
|
||||
import { MetaStackerBuilding } from "./buildings/stacker";
|
||||
import { enumTrashVariants, MetaTrashBuilding } from "./buildings/trash";
|
||||
import { enumUndergroundBeltVariants, MetaUndergroundBeltBuilding } from "./buildings/underground_belt";
|
||||
import { MetaWireBuilding } from "./buildings/wire";
|
||||
import { DefaultBeltVariant, MetaBeltBuilding } from "./buildings/belt";
|
||||
import { DefaultBeltBaseVariant, MetaBeltBaseBuilding } from "./buildings/belt_base";
|
||||
import {
|
||||
DefaultCutterVariant,
|
||||
enumCutterVariants,
|
||||
MetaCutterBuilding,
|
||||
QuadCutterVariant,
|
||||
} from "./buildings/cutter";
|
||||
import { DefaultHubVariant, MetaHubBuilding } from "./buildings/hub";
|
||||
import {
|
||||
ChainableMinerVariant,
|
||||
DefaultMinerVariant,
|
||||
enumMinerVariants,
|
||||
MetaMinerBuilding,
|
||||
} from "./buildings/miner";
|
||||
import { DefaultMixerVariant, MetaMixerBuilding } from "./buildings/mixer";
|
||||
import {
|
||||
DefaultPainterVariant,
|
||||
DoublePainterVariant,
|
||||
enumPainterVariants,
|
||||
MetaPainterBuilding,
|
||||
MirroredPainterVariant,
|
||||
QuadPainterVariant,
|
||||
} from "./buildings/painter";
|
||||
import {
|
||||
CCWRotaterVariant,
|
||||
DefaultRotaterVariant,
|
||||
enumRotaterVariants,
|
||||
FLRotaterVariant,
|
||||
MetaRotaterBuilding,
|
||||
} from "./buildings/rotater";
|
||||
import {
|
||||
CompactInverseMergerVariant,
|
||||
CompactInverseSplitterVariant,
|
||||
CompactMergerVariant,
|
||||
CompactSplitterVariant,
|
||||
DefaultSplitterVariant,
|
||||
enumSplitterVariants,
|
||||
MetaSplitterBuilding,
|
||||
} from "./buildings/splitter";
|
||||
import { DefaultStackerVariant, MetaStackerBuilding } from "./buildings/stacker";
|
||||
import {
|
||||
DefaultTrashVariant,
|
||||
enumTrashVariants,
|
||||
MetaTrashBuilding,
|
||||
StorageTrashVariant,
|
||||
} from "./buildings/trash";
|
||||
import {
|
||||
DefaultUndergroundBeltVariant,
|
||||
enumUndergroundBeltVariants,
|
||||
MetaUndergroundBeltBuilding,
|
||||
Tier2UndergroundBeltVariant,
|
||||
} from "./buildings/underground_belt";
|
||||
import { DefaultWireVariant, MetaWireBuilding } from "./buildings/wire";
|
||||
import { gBuildingVariants, registerBuildingVariant } from "./building_codes";
|
||||
import { defaultBuildingVariant } from "./meta_building";
|
||||
import { MetaConstantSignalBuilding } from "./buildings/constant_signal";
|
||||
import { MetaLogicGateBuilding, enumLogicGateVariants } from "./buildings/logic_gate";
|
||||
import { MetaLeverBuilding } from "./buildings/lever";
|
||||
import { MetaFilterBuilding } from "./buildings/filter";
|
||||
import { MetaWireTunnelBuilding, enumWireTunnelVariants } from "./buildings/wire_tunnel";
|
||||
import { MetaDisplayBuilding } from "./buildings/display";
|
||||
import { MetaVirtualProcessorBuilding, enumVirtualProcessorVariants } from "./buildings/virtual_processor";
|
||||
import { MetaReaderBuilding } from "./buildings/reader";
|
||||
import { DefaultConstantSignalVariant, MetaConstantSignalBuilding } from "./buildings/constant_signal";
|
||||
import {
|
||||
MetaLogicGateBuilding,
|
||||
enumLogicGateVariants,
|
||||
ANDGateVariant,
|
||||
NOTGateVariant,
|
||||
XORGateVariant,
|
||||
ORGateVariant,
|
||||
TransistorVariant,
|
||||
} from "./buildings/logic_gate";
|
||||
import { DefaultLeverVariant, MetaLeverBuilding } from "./buildings/lever";
|
||||
import { DefaultFilterVariant, MetaFilterBuilding } from "./buildings/filter";
|
||||
import {
|
||||
MetaWireTunnelBuilding,
|
||||
enumWireTunnelVariants,
|
||||
DefaultWireTunnelVariant,
|
||||
CoatedWireTunnelVariant,
|
||||
} from "./buildings/wire_tunnel";
|
||||
import { DefaultDisplayVariant, MetaDisplayBuilding } from "./buildings/display";
|
||||
import {
|
||||
MetaVirtualProcessorBuilding,
|
||||
enumVirtualProcessorVariants,
|
||||
CutterVirtualProcessorVariant,
|
||||
AnalyzerVirtualProcessorVariant,
|
||||
RotaterVirtualProcessorVariant,
|
||||
UnstackerVirtualProcessorVariant,
|
||||
ShapeCompareProcessorVariant,
|
||||
} from "./buildings/virtual_processor";
|
||||
import { DefaultReaderVariant, MetaReaderBuilding } from "./buildings/reader";
|
||||
|
||||
const logger = createLogger("building_registry");
|
||||
|
||||
@ -49,93 +111,93 @@ export function initMetaBuildingRegistry() {
|
||||
gMetaBuildingRegistry.register(MetaReaderBuilding);
|
||||
|
||||
// Belt
|
||||
registerBuildingVariant(1, MetaBeltBaseBuilding, defaultBuildingVariant, 0);
|
||||
registerBuildingVariant(2, MetaBeltBaseBuilding, defaultBuildingVariant, 1);
|
||||
registerBuildingVariant(3, MetaBeltBaseBuilding, defaultBuildingVariant, 2);
|
||||
registerBuildingVariant(1, MetaBeltBaseBuilding, DefaultBeltVariant, 0);
|
||||
registerBuildingVariant(2, MetaBeltBaseBuilding, DefaultBeltVariant, 1);
|
||||
registerBuildingVariant(3, MetaBeltBaseBuilding, DefaultBeltVariant, 2);
|
||||
|
||||
// Splitter
|
||||
registerBuildingVariant(4, MetaSplitterBuilding);
|
||||
registerBuildingVariant(5, MetaSplitterBuilding, enumSplitterVariants.compact);
|
||||
registerBuildingVariant(6, MetaSplitterBuilding, enumSplitterVariants.compactInverse);
|
||||
registerBuildingVariant(47, MetaSplitterBuilding, enumSplitterVariants.compactMerge);
|
||||
registerBuildingVariant(48, MetaSplitterBuilding, enumSplitterVariants.compactMergeInverse);
|
||||
registerBuildingVariant(4, MetaSplitterBuilding, DefaultSplitterVariant);
|
||||
registerBuildingVariant(5, MetaSplitterBuilding, CompactSplitterVariant);
|
||||
registerBuildingVariant(6, MetaSplitterBuilding, CompactInverseSplitterVariant);
|
||||
registerBuildingVariant(47, MetaSplitterBuilding, CompactMergerVariant);
|
||||
registerBuildingVariant(48, MetaSplitterBuilding, CompactInverseMergerVariant);
|
||||
|
||||
// Miner
|
||||
registerBuildingVariant(7, MetaMinerBuilding);
|
||||
registerBuildingVariant(8, MetaMinerBuilding, enumMinerVariants.chainable);
|
||||
registerBuildingVariant(7, MetaMinerBuilding, DefaultMinerVariant);
|
||||
registerBuildingVariant(8, MetaMinerBuilding, ChainableMinerVariant);
|
||||
|
||||
// Cutter
|
||||
registerBuildingVariant(9, MetaCutterBuilding);
|
||||
registerBuildingVariant(10, MetaCutterBuilding, enumCutterVariants.quad);
|
||||
registerBuildingVariant(9, MetaCutterBuilding, DefaultCutterVariant);
|
||||
registerBuildingVariant(10, MetaCutterBuilding, QuadCutterVariant);
|
||||
|
||||
// Rotater
|
||||
registerBuildingVariant(11, MetaRotaterBuilding);
|
||||
registerBuildingVariant(12, MetaRotaterBuilding, enumRotaterVariants.ccw);
|
||||
registerBuildingVariant(13, MetaRotaterBuilding, enumRotaterVariants.fl);
|
||||
registerBuildingVariant(11, MetaRotaterBuilding, DefaultRotaterVariant);
|
||||
registerBuildingVariant(12, MetaRotaterBuilding, CCWRotaterVariant);
|
||||
registerBuildingVariant(13, MetaRotaterBuilding, FLRotaterVariant);
|
||||
|
||||
// Stacker
|
||||
registerBuildingVariant(14, MetaStackerBuilding);
|
||||
registerBuildingVariant(14, MetaStackerBuilding, DefaultStackerVariant);
|
||||
|
||||
// Mixer
|
||||
registerBuildingVariant(15, MetaMixerBuilding);
|
||||
registerBuildingVariant(15, MetaMixerBuilding, DefaultMixerVariant);
|
||||
|
||||
// Painter
|
||||
registerBuildingVariant(16, MetaPainterBuilding);
|
||||
registerBuildingVariant(17, MetaPainterBuilding, enumPainterVariants.mirrored);
|
||||
registerBuildingVariant(18, MetaPainterBuilding, enumPainterVariants.double);
|
||||
registerBuildingVariant(19, MetaPainterBuilding, enumPainterVariants.quad);
|
||||
registerBuildingVariant(16, MetaPainterBuilding, DefaultPainterVariant);
|
||||
registerBuildingVariant(17, MetaPainterBuilding, MirroredPainterVariant);
|
||||
registerBuildingVariant(18, MetaPainterBuilding, DoublePainterVariant);
|
||||
registerBuildingVariant(19, MetaPainterBuilding, QuadPainterVariant);
|
||||
|
||||
// Trash
|
||||
registerBuildingVariant(20, MetaTrashBuilding);
|
||||
registerBuildingVariant(21, MetaTrashBuilding, enumTrashVariants.storage);
|
||||
registerBuildingVariant(20, MetaTrashBuilding, DefaultTrashVariant);
|
||||
registerBuildingVariant(21, MetaTrashBuilding, StorageTrashVariant);
|
||||
|
||||
// Underground belt
|
||||
registerBuildingVariant(22, MetaUndergroundBeltBuilding, defaultBuildingVariant, 0);
|
||||
registerBuildingVariant(23, MetaUndergroundBeltBuilding, defaultBuildingVariant, 1);
|
||||
registerBuildingVariant(24, MetaUndergroundBeltBuilding, enumUndergroundBeltVariants.tier2, 0);
|
||||
registerBuildingVariant(25, MetaUndergroundBeltBuilding, enumUndergroundBeltVariants.tier2, 1);
|
||||
registerBuildingVariant(22, MetaUndergroundBeltBuilding, DefaultUndergroundBeltVariant, 0);
|
||||
registerBuildingVariant(23, MetaUndergroundBeltBuilding, DefaultUndergroundBeltVariant, 1);
|
||||
registerBuildingVariant(24, MetaUndergroundBeltBuilding, Tier2UndergroundBeltVariant, 0);
|
||||
registerBuildingVariant(25, MetaUndergroundBeltBuilding, Tier2UndergroundBeltVariant, 1);
|
||||
|
||||
// Hub
|
||||
registerBuildingVariant(26, MetaHubBuilding);
|
||||
registerBuildingVariant(26, MetaHubBuilding, DefaultHubVariant);
|
||||
|
||||
// Wire
|
||||
registerBuildingVariant(27, MetaWireBuilding, defaultBuildingVariant, 0);
|
||||
registerBuildingVariant(28, MetaWireBuilding, defaultBuildingVariant, 1);
|
||||
registerBuildingVariant(29, MetaWireBuilding, defaultBuildingVariant, 2);
|
||||
registerBuildingVariant(30, MetaWireBuilding, defaultBuildingVariant, 3);
|
||||
registerBuildingVariant(27, MetaWireBuilding, DefaultWireVariant, 0);
|
||||
registerBuildingVariant(28, MetaWireBuilding, DefaultWireVariant, 1);
|
||||
registerBuildingVariant(29, MetaWireBuilding, DefaultWireVariant, 2);
|
||||
registerBuildingVariant(30, MetaWireBuilding, DefaultWireVariant, 3);
|
||||
|
||||
// Constant signal
|
||||
registerBuildingVariant(31, MetaConstantSignalBuilding);
|
||||
registerBuildingVariant(31, MetaConstantSignalBuilding, DefaultConstantSignalVariant);
|
||||
|
||||
// Logic gate
|
||||
registerBuildingVariant(32, MetaLogicGateBuilding);
|
||||
registerBuildingVariant(34, MetaLogicGateBuilding, enumLogicGateVariants.not);
|
||||
registerBuildingVariant(35, MetaLogicGateBuilding, enumLogicGateVariants.xor);
|
||||
registerBuildingVariant(36, MetaLogicGateBuilding, enumLogicGateVariants.or);
|
||||
registerBuildingVariant(38, MetaLogicGateBuilding, enumLogicGateVariants.transistor);
|
||||
registerBuildingVariant(32, MetaLogicGateBuilding, ANDGateVariant);
|
||||
registerBuildingVariant(34, MetaLogicGateBuilding, NOTGateVariant);
|
||||
registerBuildingVariant(35, MetaLogicGateBuilding, XORGateVariant);
|
||||
registerBuildingVariant(36, MetaLogicGateBuilding, ORGateVariant);
|
||||
registerBuildingVariant(38, MetaLogicGateBuilding, TransistorVariant);
|
||||
|
||||
// Lever
|
||||
registerBuildingVariant(33, MetaLeverBuilding);
|
||||
registerBuildingVariant(33, MetaLeverBuilding, DefaultLeverVariant);
|
||||
|
||||
// Filter
|
||||
registerBuildingVariant(37, MetaFilterBuilding);
|
||||
registerBuildingVariant(37, MetaFilterBuilding, DefaultFilterVariant);
|
||||
|
||||
// Wire tunnel
|
||||
registerBuildingVariant(39, MetaWireTunnelBuilding);
|
||||
registerBuildingVariant(41, MetaWireTunnelBuilding, enumWireTunnelVariants.coating);
|
||||
registerBuildingVariant(39, MetaWireTunnelBuilding, DefaultWireTunnelVariant);
|
||||
registerBuildingVariant(41, MetaWireTunnelBuilding, CoatedWireTunnelVariant);
|
||||
|
||||
// Display
|
||||
registerBuildingVariant(40, MetaDisplayBuilding);
|
||||
registerBuildingVariant(40, MetaDisplayBuilding, DefaultDisplayVariant);
|
||||
|
||||
// Virtual Processor
|
||||
registerBuildingVariant(42, MetaVirtualProcessorBuilding);
|
||||
registerBuildingVariant(43, MetaVirtualProcessorBuilding, enumVirtualProcessorVariants.analyzer);
|
||||
registerBuildingVariant(44, MetaVirtualProcessorBuilding, enumVirtualProcessorVariants.rotater);
|
||||
registerBuildingVariant(45, MetaVirtualProcessorBuilding, enumVirtualProcessorVariants.unstacker);
|
||||
registerBuildingVariant(46, MetaVirtualProcessorBuilding, enumVirtualProcessorVariants.shapecompare);
|
||||
registerBuildingVariant(42, MetaVirtualProcessorBuilding, CutterVirtualProcessorVariant);
|
||||
registerBuildingVariant(43, MetaVirtualProcessorBuilding, AnalyzerVirtualProcessorVariant);
|
||||
registerBuildingVariant(44, MetaVirtualProcessorBuilding, RotaterVirtualProcessorVariant);
|
||||
registerBuildingVariant(45, MetaVirtualProcessorBuilding, UnstackerVirtualProcessorVariant);
|
||||
registerBuildingVariant(46, MetaVirtualProcessorBuilding, ShapeCompareProcessorVariant);
|
||||
|
||||
// Reader
|
||||
registerBuildingVariant(49, MetaReaderBuilding);
|
||||
registerBuildingVariant(49, MetaReaderBuilding, DefaultReaderVariant);
|
||||
|
||||
// Propagate instances
|
||||
for (const key in gBuildingVariants) {
|
||||
|
Loading…
Reference in New Issue
Block a user