From ef3bccdaa86b700c79e7068362af7bfd22b80e2d Mon Sep 17 00:00:00 2001 From: Christopher-Robin Date: Wed, 14 Oct 2020 20:41:49 +1100 Subject: [PATCH] Added Blueprint sprites and overhauled Wire logic. needs more work to get direction's Reliable --- .../blueprints/wire_tunnel-double_elbow.png | Bin 0 -> 4275 bytes .../sprites/blueprints/wire_tunnel-elbow.png | Bin 0 -> 2899 bytes .../blueprints/wire_tunnel-straight.png | Bin 0 -> 2536 bytes ...orner.png => wire_tunnel-double_elbow.png} | Bin .../sprites/buildings/wire_tunnel-elbow.png | Bin 0 -> 5179 bytes .../buildings/wire_tunnel-straight.png | Bin 0 -> 4733 bytes src/js/game/buildings/wire.js | 40 ++++---- src/js/game/buildings/wire_tunnel.js | 64 ++++++++++-- src/js/game/components/wire_tunnel.js | 92 +++++++++++++++--- src/js/game/logic.js | 6 +- src/js/game/meta_building_registry.js | 5 +- src/js/game/systems/wire.js | 35 +++++-- translations/base-en.yaml | 11 ++- 13 files changed, 204 insertions(+), 49 deletions(-) create mode 100755 res_raw/sprites/blueprints/wire_tunnel-double_elbow.png create mode 100755 res_raw/sprites/blueprints/wire_tunnel-elbow.png create mode 100755 res_raw/sprites/blueprints/wire_tunnel-straight.png rename res_raw/sprites/buildings/{wire_tunnel_double_corner.png => wire_tunnel-double_elbow.png} (100%) create mode 100755 res_raw/sprites/buildings/wire_tunnel-elbow.png create mode 100755 res_raw/sprites/buildings/wire_tunnel-straight.png diff --git a/res_raw/sprites/blueprints/wire_tunnel-double_elbow.png b/res_raw/sprites/blueprints/wire_tunnel-double_elbow.png new file mode 100755 index 0000000000000000000000000000000000000000..9961b356720f18184ef65cd5187675131c51d9eb GIT binary patch literal 4275 zcmdT|S5(vOlm3NbLXQvxAp)UD=%1(v3Q|Hz05O0NddG+~1won+BvfhA6#RftR1^(} z^saP4sv;7kmngl4NPy*k_Ga()cK2dt&NEkY<~{Gs^GrO}#DI%kh#dd`E(}`N>?F4S z#~`OpyxD{o_#}Y*%?xw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P)$7!u zVbZA|FtZV1(Wq_@>E<`&e7KwDzMA!}ePUFue9yJ}m!*=wrG`JjjG9emjuTa0_6pv^ zA_FPtsEI2>I|j9~Ba?sL+ATU``ThcSTtVI&L@N=lq5!MqhpWKwjZ)B8|Cu8pCkNjw zl!f)@uv{CyJ-WOz=1_Z)^uo4ibLPXR(!Cs-7n%37 zX6=%)_vfE4{E8yH=Lbq~#i678v*}T?h@EZ_!kg{@yE~XSU#iLJ}g7)~RX7eSQ;Qq{A*o3C*ei5V*q-Svu7 zJ0TNd#OT22`RS7NZgMCRcMVq8kym<5G!FLAL!3|3GhJz^1#>7#Qp~F^CUos&^%>MC zu9GF{Xfgh=dLl1V!@L25NRVRXQsPT)EXhTgblF%Y3GxjG{lLY39#|m~rVD#sUCsHs zf^E2F_anlOyHqbs({Dbi!-kj-H)fQ-G}3QcZKRs4PinXYQZ8xpcZr#sX_EI!5Jn4P zYT(yYdSXc4l$&p#dja0RuGqaO#Ko#fiKv-%oT7vYUYD7-?8qarg$f`l?LKs+?+n#-8>K^}Zbfp}C literal 0 HcmV?d00001 diff --git a/res_raw/sprites/blueprints/wire_tunnel-straight.png b/res_raw/sprites/blueprints/wire_tunnel-straight.png new file mode 100755 index 0000000000000000000000000000000000000000..da36be68a751cdddc0d76cecf5c9129135e3ee2c GIT binary patch literal 2536 zcmc&$XH*l|621wc7zL>oG=gHmf`nxe76cQDAtFT}p$QgrS&%@K5+#I06zQO7Kvqg9 zVnP!aK?Mm|mbf5A0w_gcK}0|Z5J?Dx=t(2hBBzQumQ2sSCP&>pmB)9EZL8bWzsU_Z3m9^bKbc%^t~p(5m#eCkFG;|Lzt#`mnJl057x81}Ii4N{EJ=Yk9!TzkA2n&qFveD>i>rD)qhZ3T zA;tv*5AWHv$n2GA^EZ+qfPAe<5H@fvp~51RDc z7&3$T1iix5oOdHE<@HDYkh`CFY<%}|SagXR)?#c=-?4sDZJ0zvdsIiMbeGB!hj2byFe#XP6*PF(|AzwFK zpoOp;0@D!X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AOx_1zm7Z2eQp10UWl45aBdEFs4TPZ5|9} zpXx2j&(wKdg(u0{M7D*%7#puBsc7Ujn!*@5DpQ(WbL3`1XUr^O4hgsX-{gIjv#itq Xj?(Jk)mJOq&H&cV$+pt^bnL$XdWebd literal 0 HcmV?d00001 diff --git a/res_raw/sprites/buildings/wire_tunnel_double_corner.png b/res_raw/sprites/buildings/wire_tunnel-double_elbow.png similarity index 100% rename from res_raw/sprites/buildings/wire_tunnel_double_corner.png rename to res_raw/sprites/buildings/wire_tunnel-double_elbow.png diff --git a/res_raw/sprites/buildings/wire_tunnel-elbow.png b/res_raw/sprites/buildings/wire_tunnel-elbow.png new file mode 100755 index 0000000000000000000000000000000000000000..6d18d4242f03c7d60e4a3294ab84f165b43c8892 GIT binary patch literal 5179 zcmd5=4OkRq9v=`7)I-d&FAS&UE-@H(W_EUGXWW&L#qa_`#6&G+KHi0W+}&As7j{7p z%}V@2%(GI-=sVNHD3!cZLPJS=3NoG^>`2Y8JR>v212mL-XLniF4wSmPp7xpjnE(I( z{@(xh|D9ctk^XS_@Oy_N2ogRu#gGZV_sQ?D-@(t!ugszFE69=g@ML6r!`SoiCL}j8 zEfGQ9EgR9z4Tbl^Y$>xG2r}Y!`5lC8dhu=q85v^A%64X_rLux#iRVO#2k~x;4N4=3 zF2QZ%g!#aU@*vk_)hjOUsa2pRQLmV(PQ%k|Ng&UZQe+3yi_)`%qWJT$!_6b>`WFe7btDkT+eQ4Y3x+1!^v3%Fx8+}Kvm;SCXvOp8k!IUHD(ly0^FOT zG2RF`OhwZiuVrvrLxbM+21&@5^GaUtEj3XRAcj96EJcZGm58e_nx{!jG*ST53LJ@P zIDr#@QKdGjHN9w$+D)+BIddSYtd$56DG>)6hBRUf1!#=IDH7uZfyXp})^aKwsA;31 zK>PMhlFX7lO%kEcRSHxNI1AySs+?S6dIjMlX3N=X&i4{&5{EA(A%FV#vu?rfW6!Xf zpo>WbDyIzV*?&50V^9H&TCGz1=ouzAFlQS~&}$B_B24cR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m~%Rl1E!h)AjzsYN7 zo-V4y#O_&GiEmr;)U}4kHZ)|ZD?BFWc3?K)iFI4N%V3&rPN)rL&| z^2)Y`BpC8VJNGmfed~%}iDannTlF>m$vXyQ%d4A{J3~U2Y`vu4UxPmi3Ge;LZCt+X zA!23mn6RG6(kZ)&dvdT6m4(lHPrF?3_!MMq@3n>MDJ6OqRJ=a!%Kb=6^ewL?&f*CX)4VGE>f*+Q)9 zePKpUW6`mWmWbQh=dIYgw`NCZ%0~&SgATgRwi}QMW5071?>hLG_Bkth0N_J>B=MNYMTmk-eg+scFaA`uh4WFO9DK!=KxdE)};;Jbhqu zNbbm-<9jat#Nr0@mrg7LaXoVtkX@KJM+oz*au28 z?;RO>`V8^7{qg1#8;{4%cyV#mrKfvZPakY~6y&V~^e-kw=J zX3NK~#%wZozi;WH7nLI0pPBdRCYSS6}-d literal 0 HcmV?d00001 diff --git a/res_raw/sprites/buildings/wire_tunnel-straight.png b/res_raw/sprites/buildings/wire_tunnel-straight.png new file mode 100755 index 0000000000000000000000000000000000000000..520009e05e8ae18bf663e04c670c3d9fdfaacb72 GIT binary patch literal 4733 zcmd5=dvFwY9pCT@51|j#w%T^qi&LQOX5Y8BOD-Ygc*NcdzfG2V?Dck& zT#yEAwWTtcanLG}KucyigDDRQ6eUpUA0^JvfN4M)j3~_%R6-e{p#x-szrDL$4!l5G z6}_3u?S6mX-{<@Oet*Bbx~OEq)X86)jA7W+;)R}4^n1wuPMm=Lmi7d*(NC6Hx?nE0 zE)9r5-*0||G44XDi_xUZq_bEv+Lb*US zWSAQZMG!ZJ@K`7qHl>)`5eJsgvrQ%)c$~!wxE+PIMBMLPgcli6i1WElLZLYx z7sOoJ$#SCjB+gK@i=@Z`sV#Nl{eRMn(X&-|n~^yYR{Syn_M$=cf5 z+*&r*h*pxcD2gP-kPJg04#KPpTOdY+&71^C62=2fC8|d(-3a40ERcRw*3z&nUJd_SEJ`m0=lXl`(=7Qp-2F z!qT-71llV%vBH=>0;|1}VvR^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j<-eW5w$&N7hvreEjIWSm(G%!-q{TPe%`P zxU74wF#GQI6qr=H@rJx|NaC1lV=(_nnNuoe!0ba?lr!= zKcHY)eP_?r_gp&Hf4(@!zkTq9*27DCV&0xlst#V+N+0jOda3x4TxWyUt6#v(wl}+5 z$M&85S^cIBVtH5Jq>AkRZ(ZL#E%d<8*TH37>*|kUr^l>cWc*z|KJawz}somvyu>ZX0;^@(UfkjrRoJ*$&2K^)2}B zjX%Bfy*j^H+Eu@^?EP$h%gI$`mjhFC_AY^rB2@dA5ihU63>pg6)*l1Yr+s$ literal 0 HcmV?d00001 diff --git a/src/js/game/buildings/wire.js b/src/js/game/buildings/wire.js index de9317e9..d57ffc25 100644 --- a/src/js/game/buildings/wire.js +++ b/src/js/game/buildings/wire.js @@ -168,10 +168,10 @@ export class MetaWireBuilding extends MetaBuilding { }; let flag = 0; - flag |= connections.top ? 0x1000 : 0; - flag |= connections.right ? 0x100 : 0; - flag |= connections.bottom ? 0x10 : 0; - flag |= connections.left ? 0x1 : 0; + flag |= connections.top ? 0b1000 : 0; + flag |= connections.right ? 0b100 : 0; + flag |= connections.bottom ? 0b10 : 0; + flag |= connections.left ? 0b1 : 0; let targetType = enumWireType.forward; @@ -179,85 +179,85 @@ export class MetaWireBuilding extends MetaBuilding { rotation = 0; switch (flag) { - case 0x0000: + case 0b0000: // Nothing break; - case 0x0001: + case 0b0001: // Left rotation += 90; break; - case 0x0010: + case 0b0010: // Bottom // END break; - case 0x0011: + case 0b0011: // Bottom | Left targetType = enumWireType.turn; rotation += 90; break; - case 0x0100: + case 0b0100: // Right rotation += 90; break; - case 0x0101: + case 0b0101: // Right | Left rotation += 90; break; - case 0x0110: + case 0b0110: // Right | Bottom targetType = enumWireType.turn; break; - case 0x0111: + case 0b0111: // Right | Bottom | Left targetType = enumWireType.split; break; - case 0x1000: + case 0b1000: // Top break; - case 0x1001: + case 0b1001: // Top | Left targetType = enumWireType.turn; rotation += 180; break; - case 0x1010: + case 0b1010: // Top | Bottom break; - case 0x1011: + case 0b1011: // Top | Bottom | Left targetType = enumWireType.split; rotation += 90; break; - case 0x1100: + case 0b1100: // Top | Right targetType = enumWireType.turn; rotation -= 90; break; - case 0x1101: + case 0b1101: // Top | Right | Left targetType = enumWireType.split; rotation += 180; break; - case 0x1110: + case 0b1110: // Top | Right | Bottom targetType = enumWireType.split; rotation -= 90; break; - case 0x1111: + case 0b1111: // Top | Right | Bottom | Left targetType = enumWireType.cross; break; diff --git a/src/js/game/buildings/wire_tunnel.js b/src/js/game/buildings/wire_tunnel.js index 2626dd12..015b48fa 100644 --- a/src/js/game/buildings/wire_tunnel.js +++ b/src/js/game/buildings/wire_tunnel.js @@ -2,11 +2,33 @@ import { generateMatrixRotations } from "../../core/utils"; import { Vector } from "../../core/vector"; import { WireTunnelComponent } from "../components/wire_tunnel"; import { Entity } from "../entity"; -import { MetaBuilding } from "../meta_building"; +import { MetaBuilding, defaultBuildingVariant } from "../meta_building"; import { GameRoot } from "../root"; import { enumHubGoalRewards } from "../tutorial_goals"; -const wireTunnelOverlayMatrix = generateMatrixRotations([0, 1, 0, 1, 1, 1, 0, 1, 0]); +/** @enum {string} */ +export const enumWireTunnelVariants = { + Elbow: "elbow", + Straight: "straight", + DoubleElbow: "double_elbow", +}; + +const wireTunnelsOverlayMatrix = { + [defaultBuildingVariant]: generateMatrixRotations([0, 1, 0, 1, 1, 1, 0, 1, 0]), + [enumWireTunnelVariants.DoubleElbow]: generateMatrixRotations([0, 1, 0, 1, 1, 1, 0, 1, 0]), + [enumWireTunnelVariants.Elbow]: generateMatrixRotations([0, 1, 0, 0, 1, 1, 0, 0, 0]), + [enumWireTunnelVariants.Straight]: generateMatrixRotations([0, 1, 0, 0, 1, 0, 0, 1, 0]), +}; + +/** + * @enum {Array>} + */ +export const ConnectionDirections = { + [defaultBuildingVariant]: [[new Vector(0, 1), new Vector(0, -1)], [new Vector(-1, 0), new Vector(1, 0)]], + [enumWireTunnelVariants.DoubleElbow]: [[new Vector(0, 1), new Vector(1, 0)], [new Vector(0, -1), new Vector(-1, 0)]], + [enumWireTunnelVariants.Elbow]: [[new Vector(0, 1), new Vector(1, 0)]], + [enumWireTunnelVariants.Straight]: [[new Vector(0, 1), new Vector(0, -1)]], +}; export class MetaWireTunnelBuilding extends MetaBuilding { constructor() { @@ -22,6 +44,18 @@ export class MetaWireTunnelBuilding extends MetaBuilding { */ getIsUnlocked(root) { return root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_wires_painter_and_levers); + } + + /** + * + * @param {GameRoot} root + */ + getAvailableVariants(root) { + return [defaultBuildingVariant, enumWireTunnelVariants.Elbow, enumWireTunnelVariants.Straight, enumWireTunnelVariants.DoubleElbow]; + // if (root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_miner_chainable)) { + // return [enumMinerVariants.chainable]; + // } + // return super.getAvailableVariants(root); } /** @@ -32,13 +66,17 @@ export class MetaWireTunnelBuilding extends MetaBuilding { * @param {Entity} entity */ getSpecialOverlayRenderMatrix(rotation, rotationVariant, variant, entity) { - return wireTunnelOverlayMatrix[rotation]; + return wireTunnelsOverlayMatrix[variant][rotation]; } getIsRotateable() { - return false; + return true; } + getStayInPlacementMode() { + return true; + } + getDimensions() { return new Vector(1, 1); } @@ -53,6 +91,20 @@ export class MetaWireTunnelBuilding extends MetaBuilding { * @param {Entity} entity */ setupEntityComponents(entity) { - entity.addComponent(new WireTunnelComponent()); - } + entity.addComponent(new WireTunnelComponent({Variant: defaultBuildingVariant, Connections: ConnectionDirections[defaultBuildingVariant]})); + } + + /** + * + * @param {Entity} entity + * @param {number} rotationVariant + * @param {string} variant + */ + updateVariants(entity, rotationVariant, variant) { + if(entity.components.WireTunnel){ + let a = new Vector(1, 0); + //a.rotateInplaceFastMultipleOf90(rotationVariant); + entity.components.WireTunnel.UpdateConnections(variant, ConnectionDirections[variant]) + } + } } diff --git a/src/js/game/components/wire_tunnel.js b/src/js/game/components/wire_tunnel.js index 1c170484..f4230d0e 100644 --- a/src/js/game/components/wire_tunnel.js +++ b/src/js/game/components/wire_tunnel.js @@ -1,17 +1,87 @@ +import { Vector } from "../../core/vector"; import { Component } from "../component"; +import { defaultBuildingVariant } from "../meta_building"; export class WireTunnelComponent extends Component { - static getId() { - return "WireTunnel"; - } + static getId() { + return "WireTunnel"; - constructor() { - super(); + } - /** - * Linked network, only if its not multiple directions - * @type {Array} - */ - this.linkedNetworks = []; - } + constructor({ Variant, Connections = [] }) { + super(); + + this.Variant = Variant; + // /** + // * All Connection Directions + // * @type {Object.>} Possibility for a T piece. Should be Irrelevant + // */ + /** + * @type {Object.} + */ + this.Connections = {}; + + this.RebuildConnections(Connections); + + /** + * Linked network, only if its not multiple directions + * @type {Array} + */ + this.linkedNetworks = []; + } + + /** + * @param {import("../buildings/wire_tunnel").ConnectionDirections} Connections + */ + RebuildConnections(Connections) { + + this.Connections = {}; + for(let i = 0; i < Connections.length; ++i) { + assert(Connections[i].length == 2, "Connection Wasn't Continuos"); + let [a, b] = Connections[i]; + + const ahash = a.toString(); + if(!this.Connections[ahash]) { + this.Connections[ahash] = b; + } + + const bhash = b.toString(); + if(!this.Connections[bhash]) { + this.Connections[bhash] = a; + } + } + console.log(this.Connections); + } + + /** + * @param {string} Variant + * @param {import("../buildings/wire_tunnel").ConnectionDirections} Connections + */ + UpdateConnections(Variant, Connections) { + if(this.Variant !== Variant){ + this.Variant = Variant; + this.RebuildConnections(Connections) + } + } + + /** + * Local Space Direction the connection is coming from + * @param {Vector} dir + */ + CanConnect(dir) { + return !!this.Connections[dir.toString()]; + } + + /** + * @param {import("./static_map_entity").StaticMapEntityComponent} staticComp + * @param {Vector} input + * LocalSpace Direction into the Tunnel + */ + GetOutputDirection(staticComp, input) { + const inputDir = staticComp.unapplyRotationToVector(input); //TODO: Fix the Wierd Shit + if(this.CanConnect(inputDir)){ + return staticComp.applyRotationToVector(this.Connections[inputDir.toString()]);; + } + return null; + } } diff --git a/src/js/game/logic.js b/src/js/game/logic.js index 7ec7b8ab..9692f4a6 100644 --- a/src/js/game/logic.js +++ b/src/js/game/logic.js @@ -193,6 +193,9 @@ export class GameLogic { * @param {enumDirection} param0.edge The edge to check for */ computeWireEdgeStatus({ wireVariant, tile, edge }) { + /** + * @type {Vector} + */ const offset = enumDirectionToVector[edge]; const targetTile = tile.add(offset); @@ -243,7 +246,8 @@ export class GameLogic { // Check if its a crossing const wireTunnelComp = targetEntity.components.WireTunnel; if (wireTunnelComp) { - return true; + const inputDir = targetStaticComp.unapplyRotationToVector(offset.rotateFastMultipleOf90(270)); + return wireTunnelComp.CanConnect(inputDir); } // Check if its a wire diff --git a/src/js/game/meta_building_registry.js b/src/js/game/meta_building_registry.js index c2884e87..668d8a37 100644 --- a/src/js/game/meta_building_registry.js +++ b/src/js/game/meta_building_registry.js @@ -25,7 +25,7 @@ import { MetaTrashBuilding } from "./buildings/trash"; import { enumUndergroundBeltVariants, MetaUndergroundBeltBuilding } from "./buildings/underground_belt"; import { enumVirtualProcessorVariants, MetaVirtualProcessorBuilding } from "./buildings/virtual_processor"; import { MetaWireBuilding } from "./buildings/wire"; -import { MetaWireTunnelBuilding } from "./buildings/wire_tunnel"; +import { MetaWireTunnelBuilding, enumWireTunnelVariants } from "./buildings/wire_tunnel"; import { buildBuildingCodeCache, gBuildingVariants, registerBuildingVariant } from "./building_codes"; import { enumWireVariant } from "./components/wire"; import { KEYMAPPINGS } from "./key_action_mapper"; @@ -150,6 +150,9 @@ export function initMetaBuildingRegistry() { // Wire tunnel registerBuildingVariant(39, MetaWireTunnelBuilding); + registerBuildingVariant(10000006, MetaWireTunnelBuilding, enumWireTunnelVariants.Elbow); + registerBuildingVariant(10000007, MetaWireTunnelBuilding, enumWireTunnelVariants.Straight); + registerBuildingVariant(10000008, MetaWireTunnelBuilding, enumWireTunnelVariants.DoubleElbow); // Display registerBuildingVariant(40, MetaDisplayBuilding); diff --git a/src/js/game/systems/wire.js b/src/js/game/systems/wire.js index 4d0e6de4..656f7c79 100644 --- a/src/js/game/systems/wire.js +++ b/src/js/game/systems/wire.js @@ -314,7 +314,12 @@ export class WireSystem extends GameSystemWithFilter { newSearchDirections = [staticComp.localDirectionToWorld(slot.direction)]; newSearchTile = staticComp.localTileToWorld(slot.pos); } - } + } + + const tunnelComp = nextEntity.components.WireTunnel; + if(tunnelComp){ + //const outputDir = tunnelComp.GetOutputDirection(staticComp, offset); + } if (newSearchTile) { // Find new surrounding wire targets @@ -396,17 +401,18 @@ export class WireSystem extends GameSystemWithFilter { ); // Link the initial tile to the initial entities, since it may change - /** @type {Array<{entity: Entity, tile: Vector}>} */ + /** @type {Array<{entity: Entity, tile: Vector, dir: Vector}>} */ const contents = []; for (let j = 0; j < initialContents.length; ++j) { contents.push({ entity: initialContents[j], - tile: initialSearchTile, + tile: initialSearchTile, + dir: offset }); } for (let k = 0; k < contents.length; ++k) { - const { entity, tile } = contents[k]; + const { entity, tile, dir } = contents[k]; const wireComp = entity.components.Wire; // Check for wire @@ -458,14 +464,24 @@ export class WireSystem extends GameSystemWithFilter { // Check if it's a tunnel, if so, go to the forwarded item const tunnelComp = entity.components.WireTunnel; if (tunnelComp) { + //TODO: Add Additional Tunnel Variants if (visitedTunnels.has(entity.uid)) { continue; } - const staticComp = entity.components.StaticMapEntity; + const staticComp = entity.components.StaticMapEntity; + + //const localDir = staticComp.worldToLocalTile(tile.sub(offset)); + //staticComp.localDirectionToWorld(); + const outputDir = tunnelComp.GetOutputDirection(staticComp, dir); + if(!outputDir){ + continue; + } + const forwardedTile = staticComp.origin.add(outputDir); + //TODO: Alter to Allow for different tunnel Types // Compute where this tunnel connects to - const forwardedTile = staticComp.origin.add(offset); + //const forwardedTile = staticComp.origin.add(offset); VERBOSE_WIRES && logger.log( " Found tunnel", @@ -481,14 +497,15 @@ export class WireSystem extends GameSystemWithFilter { forwardedTile.x, forwardedTile.y ); - + // Attach the entities and the tile we search at, because it may change for (let h = 0; h < connectedContents.length; ++h) { contents.push({ entity: connectedContents[h], - tile: forwardedTile, + tile: forwardedTile, + dir: outputDir }); - } + } // Add the tunnel to the network if (tunnelComp.linkedNetworks.indexOf(network) < 0) { diff --git a/translations/base-en.yaml b/translations/base-en.yaml index ace667b0..06c11b96 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -642,8 +642,17 @@ buildings: wire_tunnel: default: - name: &wire_tunnel Wire Crossing + name: &wire_tunnel Wire Tunnel description: Allows two wires to cross without connecting to each other. + elbow: + name: Elbow Tunnel + description: Allows a wire to turn a corner without connecting to anything else + straight: + name: Straight tunnel + description: Allows a wire to go straight without connecting to anything else + double_elbow: + name: Double Elbow Tunnel + description: Allows two wires to turn corners without connecting to each other. constant_signal: default: