Add wire bridges and fix Q on hub crash
After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 71 KiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 228 KiB After Width: | Height: | Size: 237 KiB |
Before Width: | Height: | Size: 555 KiB After Width: | Height: | Size: 553 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 6.8 KiB |
|
@ -1,5 +1,5 @@
|
||||||
$buildings: belt, cutter, miner, mixer, painter, rotater, splitter, stacker, trash, underground_belt, wire,
|
$buildings: belt, cutter, miner, mixer, painter, rotater, splitter, stacker, trash, underground_belt, wire,
|
||||||
constant_signal, logic_gate, lever, filter;
|
constant_signal, logic_gate, lever, filter, wire_tunnel;
|
||||||
|
|
||||||
@each $building in $buildings {
|
@each $building in $buildings {
|
||||||
[data-icon="building_icons/#{$building}.png"] {
|
[data-icon="building_icons/#{$building}.png"] {
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { Vector } from "../../core/vector";
|
||||||
|
import { Entity } from "../entity";
|
||||||
|
import { MetaBuilding } from "../meta_building";
|
||||||
|
import { GameRoot, enumLayer } from "../root";
|
||||||
|
import { WireTunnelComponent } from "../components/wire_tunnel";
|
||||||
|
|
||||||
|
export class MetaWireTunnelBuilding extends MetaBuilding {
|
||||||
|
constructor() {
|
||||||
|
super("wire_tunnel");
|
||||||
|
}
|
||||||
|
|
||||||
|
getSilhouetteColor() {
|
||||||
|
return "#25fff2";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {GameRoot} root
|
||||||
|
*/
|
||||||
|
getIsUnlocked(root) {
|
||||||
|
// @todo
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
isRotateable() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getDimensions() {
|
||||||
|
return new Vector(1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
getLayer() {
|
||||||
|
return enumLayer.wires;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the entity at the given location
|
||||||
|
* @param {Entity} entity
|
||||||
|
*/
|
||||||
|
setupEntityComponents(entity) {
|
||||||
|
entity.addComponent(new WireTunnelComponent());
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import { WireComponent } from "./components/wire";
|
||||||
import { ConstantSignalComponent } from "./components/constant_signal";
|
import { ConstantSignalComponent } from "./components/constant_signal";
|
||||||
import { LogicGateComponent } from "./components/logic_gate";
|
import { LogicGateComponent } from "./components/logic_gate";
|
||||||
import { LeverComponent } from "./components/lever";
|
import { LeverComponent } from "./components/lever";
|
||||||
|
import { WireTunnelComponent } from "./components/wire_tunnel";
|
||||||
|
|
||||||
export function initComponentRegistry() {
|
export function initComponentRegistry() {
|
||||||
gComponentRegistry.register(StaticMapEntityComponent);
|
gComponentRegistry.register(StaticMapEntityComponent);
|
||||||
|
@ -31,6 +32,7 @@ export function initComponentRegistry() {
|
||||||
gComponentRegistry.register(ConstantSignalComponent);
|
gComponentRegistry.register(ConstantSignalComponent);
|
||||||
gComponentRegistry.register(LogicGateComponent);
|
gComponentRegistry.register(LogicGateComponent);
|
||||||
gComponentRegistry.register(LeverComponent);
|
gComponentRegistry.register(LeverComponent);
|
||||||
|
gComponentRegistry.register(WireTunnelComponent);
|
||||||
|
|
||||||
// IMPORTANT ^^^^^ UPDATE ENTITY COMPONENT STORAGE AFTERWARDS
|
// IMPORTANT ^^^^^ UPDATE ENTITY COMPONENT STORAGE AFTERWARDS
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
import { Component } from "../component";
|
||||||
|
|
||||||
|
export class WireTunnelComponent extends Component {
|
||||||
|
static getId() {
|
||||||
|
return "WireTunnel";
|
||||||
|
}
|
||||||
|
|
||||||
|
duplicateWithoutContents() {
|
||||||
|
return new WireTunnelComponent();
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import { WireComponent } from "./components/wire";
|
||||||
import { ConstantSignalComponent } from "./components/constant_signal";
|
import { ConstantSignalComponent } from "./components/constant_signal";
|
||||||
import { LogicGateComponent } from "./components/logic_gate";
|
import { LogicGateComponent } from "./components/logic_gate";
|
||||||
import { LeverComponent } from "./components/lever";
|
import { LeverComponent } from "./components/lever";
|
||||||
|
import { WireTunnelComponent } from "./components/wire_tunnel";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +70,9 @@ export class EntityComponentStorage {
|
||||||
/** @type {LeverComponent} */
|
/** @type {LeverComponent} */
|
||||||
this.Lever;
|
this.Lever;
|
||||||
|
|
||||||
|
/** @type {WireTunnelComponent} */
|
||||||
|
this.WireTunnel;
|
||||||
|
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -344,6 +344,12 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||||
const buildingCode = contents.components.StaticMapEntity.code;
|
const buildingCode = contents.components.StaticMapEntity.code;
|
||||||
const extracted = getBuildingDataFromCode(buildingCode);
|
const extracted = getBuildingDataFromCode(buildingCode);
|
||||||
|
|
||||||
|
if (extracted.metaInstance.getId() === "hub") {
|
||||||
|
// Disable pipetting the hub
|
||||||
|
this.currentMetaBuilding.set(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// If the building we are picking is the same as the one we have, clear the cursor.
|
// If the building we are picking is the same as the one we have, clear the cursor.
|
||||||
if (
|
if (
|
||||||
this.currentMetaBuilding.get() &&
|
this.currentMetaBuilding.get() &&
|
||||||
|
|
|
@ -4,9 +4,11 @@ import { MetaWireBuilding } from "../../buildings/wire";
|
||||||
import { MetaConstantSignalBuilding } from "../../buildings/constant_signal";
|
import { MetaConstantSignalBuilding } from "../../buildings/constant_signal";
|
||||||
import { MetaLogicGateBuilding } from "../../buildings/logic_gate";
|
import { MetaLogicGateBuilding } from "../../buildings/logic_gate";
|
||||||
import { MetaLeverBuilding } from "../../buildings/lever";
|
import { MetaLeverBuilding } from "../../buildings/lever";
|
||||||
|
import { MetaWireTunnelBuilding } from "../../buildings/wire_tunnel";
|
||||||
|
|
||||||
const supportedBuildings = [
|
const supportedBuildings = [
|
||||||
MetaWireBuilding,
|
MetaWireBuilding,
|
||||||
|
MetaWireTunnelBuilding,
|
||||||
MetaConstantSignalBuilding,
|
MetaConstantSignalBuilding,
|
||||||
MetaLogicGateBuilding,
|
MetaLogicGateBuilding,
|
||||||
MetaLeverBuilding,
|
MetaLeverBuilding,
|
||||||
|
|
|
@ -56,10 +56,11 @@ export const KEYMAPPINGS = {
|
||||||
trash: { keyCode: key("0") },
|
trash: { keyCode: key("0") },
|
||||||
|
|
||||||
wire: { keyCode: key("1") },
|
wire: { keyCode: key("1") },
|
||||||
constant_signal: { keyCode: key("2") },
|
wire_tunnel: { keyCode: key("2") },
|
||||||
logic_gate: { keyCode: key("3") },
|
constant_signal: { keyCode: key("3") },
|
||||||
lever: { keyCode: key("4") },
|
logic_gate: { keyCode: key("4") },
|
||||||
filter: { keyCode: key("5") },
|
lever: { keyCode: key("5") },
|
||||||
|
filter: { keyCode: key("6") },
|
||||||
},
|
},
|
||||||
|
|
||||||
placement: {
|
placement: {
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { round2Digits, rotateDirectionalObject } from "../core/utils";
|
import { STOP_PROPAGATION } from "../core/signal";
|
||||||
|
import { round2Digits } from "../core/utils";
|
||||||
import {
|
import {
|
||||||
enumDirection,
|
enumDirection,
|
||||||
enumDirectionToVector,
|
|
||||||
Vector,
|
|
||||||
enumDirectionToAngle,
|
enumDirectionToAngle,
|
||||||
|
enumDirectionToVector,
|
||||||
enumInvertedDirections,
|
enumInvertedDirections,
|
||||||
|
Vector,
|
||||||
} from "../core/vector";
|
} from "../core/vector";
|
||||||
import { Entity } from "./entity";
|
import { Entity } from "./entity";
|
||||||
import { MetaBuilding } from "./meta_building";
|
import { MetaBuilding } from "./meta_building";
|
||||||
import { GameRoot, enumLayer } from "./root";
|
import { enumLayer, GameRoot } from "./root";
|
||||||
import { STOP_PROPAGATION } from "../core/signal";
|
|
||||||
|
|
||||||
const logger = createLogger("ingame/logic");
|
const logger = createLogger("ingame/logic");
|
||||||
|
|
||||||
|
@ -273,6 +273,12 @@ export class GameLogic {
|
||||||
return enumWireEdgeFlag.empty;
|
return enumWireEdgeFlag.empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if its a crossing
|
||||||
|
const wireTunnelComp = targetEntity.components.WireTunnel;
|
||||||
|
if (wireTunnelComp) {
|
||||||
|
return enumWireEdgeFlag.filled;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if its a wire
|
// Check if its a wire
|
||||||
const wiresComp = targetEntity.components.Wire;
|
const wiresComp = targetEntity.components.Wire;
|
||||||
if (!wiresComp) {
|
if (!wiresComp) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { MetaConstantSignalBuilding } from "./buildings/constant_signal";
|
||||||
import { MetaLogicGateBuilding, enumLogicGateVariants } from "./buildings/logic_gate";
|
import { MetaLogicGateBuilding, enumLogicGateVariants } from "./buildings/logic_gate";
|
||||||
import { MetaLeverBuilding } from "./buildings/lever";
|
import { MetaLeverBuilding } from "./buildings/lever";
|
||||||
import { MetaFilterBuilding } from "./buildings/filter";
|
import { MetaFilterBuilding } from "./buildings/filter";
|
||||||
|
import { MetaWireTunnelBuilding } from "./buildings/wire_tunnel";
|
||||||
|
|
||||||
const logger = createLogger("building_registry");
|
const logger = createLogger("building_registry");
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ export function initMetaBuildingRegistry() {
|
||||||
gMetaBuildingRegistry.register(MetaLogicGateBuilding);
|
gMetaBuildingRegistry.register(MetaLogicGateBuilding);
|
||||||
gMetaBuildingRegistry.register(MetaLeverBuilding);
|
gMetaBuildingRegistry.register(MetaLeverBuilding);
|
||||||
gMetaBuildingRegistry.register(MetaFilterBuilding);
|
gMetaBuildingRegistry.register(MetaFilterBuilding);
|
||||||
|
gMetaBuildingRegistry.register(MetaWireTunnelBuilding);
|
||||||
|
|
||||||
// Belt
|
// Belt
|
||||||
registerBuildingVariant(1, MetaBeltBaseBuilding, defaultBuildingVariant, 0);
|
registerBuildingVariant(1, MetaBeltBaseBuilding, defaultBuildingVariant, 0);
|
||||||
|
@ -110,6 +112,9 @@ export function initMetaBuildingRegistry() {
|
||||||
// Filter
|
// Filter
|
||||||
registerBuildingVariant(37, MetaFilterBuilding);
|
registerBuildingVariant(37, MetaFilterBuilding);
|
||||||
|
|
||||||
|
// Wire tunnel
|
||||||
|
registerBuildingVariant(39, MetaWireTunnelBuilding);
|
||||||
|
|
||||||
// Propagate instances
|
// Propagate instances
|
||||||
for (const key in gBuildingVariants) {
|
for (const key in gBuildingVariants) {
|
||||||
gBuildingVariants[key].metaInstance = gMetaBuildingRegistry.findByClass(
|
gBuildingVariants[key].metaInstance = gMetaBuildingRegistry.findByClass(
|
||||||
|
|
|
@ -365,6 +365,14 @@ export class WireSystem extends GameSystemWithFilter {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if its a tunnel, if so, go to the forwarded item
|
||||||
|
if (entity.components.WireTunnel) {
|
||||||
|
const forwardedTile = searchTile.add(offset);
|
||||||
|
contents.push(
|
||||||
|
...this.root.map.getLayersContentsMultipleXY(forwardedTile.x, forwardedTile.y)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -542,13 +542,10 @@ buildings:
|
||||||
name: &wire Wire
|
name: &wire Wire
|
||||||
description: &wire_desc Allows to connect logical components and can transfer items, colors or boolean signals.
|
description: &wire_desc Allows to connect logical components and can transfer items, colors or boolean signals.
|
||||||
|
|
||||||
turn:
|
wire_tunnel:
|
||||||
name: *wire
|
default:
|
||||||
description: &wire_desc
|
name: &wire_tunnel Wire Tunnel
|
||||||
|
description: Allows to cross two wires without connecting them.
|
||||||
split:
|
|
||||||
name: *wire
|
|
||||||
description: &wire_desc
|
|
||||||
|
|
||||||
constant_signal:
|
constant_signal:
|
||||||
default:
|
default:
|
||||||
|
@ -856,6 +853,7 @@ keybindings:
|
||||||
logic_gate: *logic_gate
|
logic_gate: *logic_gate
|
||||||
lever: *lever
|
lever: *lever
|
||||||
filter: *filter
|
filter: *filter
|
||||||
|
wire_tunnel: *wire_tunnel
|
||||||
# ---
|
# ---
|
||||||
|
|
||||||
pipette: Pipette
|
pipette: Pipette
|
||||||
|
|