Add basic logic gate and improve wires in general
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.1 MiB |
Before Width: | Height: | Size: 204 KiB After Width: | Height: | Size: 213 KiB |
Before Width: | Height: | Size: 485 KiB After Width: | Height: | Size: 499 KiB |
Before Width: | Height: | Size: 962 KiB After Width: | Height: | Size: 1001 KiB |
|
@ -356,12 +356,14 @@
|
|||
<key type="filename">sprites/blueprints/belt_left.png</key>
|
||||
<key type="filename">sprites/blueprints/belt_right.png</key>
|
||||
<key type="filename">sprites/blueprints/belt_top.png</key>
|
||||
<key type="filename">sprites/blueprints/wire-cross.png</key>
|
||||
<key type="filename">sprites/blueprints/wire-split.png</key>
|
||||
<key type="filename">sprites/blueprints/wire-turn.png</key>
|
||||
<key type="filename">sprites/blueprints/wire.png</key>
|
||||
<key type="filename">sprites/buildings/belt_left.png</key>
|
||||
<key type="filename">sprites/buildings/belt_right.png</key>
|
||||
<key type="filename">sprites/buildings/belt_top.png</key>
|
||||
<key type="filename">sprites/buildings/wire-cross.png</key>
|
||||
<key type="filename">sprites/buildings/wire-split.png</key>
|
||||
<key type="filename">sprites/buildings/wire-turn.png</key>
|
||||
<key type="filename">sprites/buildings/wire.png</key>
|
||||
|
@ -379,6 +381,43 @@
|
|||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
<key type="filename">sprites/blueprints/constant_signal.png</key>
|
||||
<key type="filename">sprites/blueprints/miner-chainable.png</key>
|
||||
<key type="filename">sprites/blueprints/miner.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater-ccw.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater-fl.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater.png</key>
|
||||
<key type="filename">sprites/blueprints/splitter-compact-inverse.png</key>
|
||||
<key type="filename">sprites/blueprints/splitter-compact.png</key>
|
||||
<key type="filename">sprites/blueprints/trash.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_entry-tier2.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_entry.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_exit-tier2.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_exit.png</key>
|
||||
<key type="filename">sprites/buildings/constant_signal.png</key>
|
||||
<key type="filename">sprites/buildings/miner-chainable.png</key>
|
||||
<key type="filename">sprites/buildings/rotater-ccw.png</key>
|
||||
<key type="filename">sprites/buildings/rotater-fl.png</key>
|
||||
<key type="filename">sprites/buildings/splitter-compact-inverse.png</key>
|
||||
<key type="filename">sprites/buildings/splitter-compact.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_entry-tier2.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_entry.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_exit-tier2.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_exit.png</key>
|
||||
<struct type="IndividualSpriteSettings">
|
||||
<key>pivotPoint</key>
|
||||
<point_f>0.5,0.5</point_f>
|
||||
<key>spriteScale</key>
|
||||
<double>1</double>
|
||||
<key>scale9Enabled</key>
|
||||
<false/>
|
||||
<key>scale9Borders</key>
|
||||
<rect>48,48,96,96</rect>
|
||||
<key>scale9Paddings</key>
|
||||
<rect>48,48,96,96</rect>
|
||||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
<key type="filename">sprites/blueprints/cutter-quad.png</key>
|
||||
<key type="filename">sprites/blueprints/painter-quad.png</key>
|
||||
<key type="filename">sprites/buildings/cutter-quad.png</key>
|
||||
|
@ -418,41 +457,6 @@
|
|||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
<key type="filename">sprites/blueprints/miner-chainable.png</key>
|
||||
<key type="filename">sprites/blueprints/miner.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater-ccw.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater-fl.png</key>
|
||||
<key type="filename">sprites/blueprints/rotater.png</key>
|
||||
<key type="filename">sprites/blueprints/splitter-compact-inverse.png</key>
|
||||
<key type="filename">sprites/blueprints/splitter-compact.png</key>
|
||||
<key type="filename">sprites/blueprints/trash.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_entry-tier2.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_entry.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_exit-tier2.png</key>
|
||||
<key type="filename">sprites/blueprints/underground_belt_exit.png</key>
|
||||
<key type="filename">sprites/buildings/miner-chainable.png</key>
|
||||
<key type="filename">sprites/buildings/rotater-ccw.png</key>
|
||||
<key type="filename">sprites/buildings/rotater-fl.png</key>
|
||||
<key type="filename">sprites/buildings/splitter-compact-inverse.png</key>
|
||||
<key type="filename">sprites/buildings/splitter-compact.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_entry-tier2.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_entry.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_exit-tier2.png</key>
|
||||
<key type="filename">sprites/buildings/underground_belt_exit.png</key>
|
||||
<struct type="IndividualSpriteSettings">
|
||||
<key>pivotPoint</key>
|
||||
<point_f>0.5,0.5</point_f>
|
||||
<key>spriteScale</key>
|
||||
<double>1</double>
|
||||
<key>scale9Enabled</key>
|
||||
<false/>
|
||||
<key>scale9Borders</key>
|
||||
<rect>48,48,96,96</rect>
|
||||
<key>scale9Paddings</key>
|
||||
<rect>48,48,96,96</rect>
|
||||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
<key type="filename">sprites/blueprints/painter-double.png</key>
|
||||
<key type="filename">sprites/blueprints/trash-storage.png</key>
|
||||
<key type="filename">sprites/buildings/painter-double.png</key>
|
||||
|
@ -569,6 +573,22 @@
|
|||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
<key type="filename">sprites/wires/boolean_false.png</key>
|
||||
<key type="filename">sprites/wires/boolean_true.png</key>
|
||||
<struct type="IndividualSpriteSettings">
|
||||
<key>pivotPoint</key>
|
||||
<point_f>0.5,0.5</point_f>
|
||||
<key>spriteScale</key>
|
||||
<double>1</double>
|
||||
<key>scale9Enabled</key>
|
||||
<false/>
|
||||
<key>scale9Borders</key>
|
||||
<rect>16,16,32,32</rect>
|
||||
<key>scale9Paddings</key>
|
||||
<rect>16,16,32,32</rect>
|
||||
<key>scale9FromFile</key>
|
||||
<false/>
|
||||
</struct>
|
||||
</map>
|
||||
<key>fileList</key>
|
||||
<array>
|
||||
|
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 1005 B |
Before Width: | Height: | Size: 554 B After Width: | Height: | Size: 922 B |
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 747 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 458 B |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 13 KiB |
|
@ -1,4 +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;
|
||||
|
||||
@each $building in $buildings {
|
||||
[data-icon="building_icons/#{$building}.png"] {
|
||||
|
|
|
@ -32,9 +32,8 @@ export const globalConfig = {
|
|||
|
||||
// Which dpi the assets have
|
||||
assetsDpi: 192 / 32,
|
||||
assetsSharpness: 1.2,
|
||||
assetsSharpness: 1.5,
|
||||
shapesSharpness: 1.4,
|
||||
mapChunkSharpness: 1.0,
|
||||
|
||||
// Production analytics
|
||||
statisticsGraphDpi: 2.5,
|
||||
|
|
|
@ -54,9 +54,9 @@ export class MetaHubBuilding extends MetaBuilding {
|
|||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(3, 0),
|
||||
pos: new Vector(0, 2),
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
direction: enumDirection.top,
|
||||
direction: enumDirection.left,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
import { enumDirection, Vector } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { MetaBuilding } from "../meta_building";
|
||||
import { enumLayer, GameRoot } from "../root";
|
||||
|
||||
export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
constructor() {
|
||||
super("logic_gate");
|
||||
}
|
||||
|
||||
getSilhouetteColor() {
|
||||
return "#89dc60";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {GameRoot} root
|
||||
*/
|
||||
getIsUnlocked(root) {
|
||||
// @todo
|
||||
return true;
|
||||
}
|
||||
|
||||
getLayer() {
|
||||
return enumLayer.wires;
|
||||
}
|
||||
|
||||
getDimensions() {
|
||||
return new Vector(1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the entity at the given location
|
||||
* @param {Entity} entity
|
||||
*/
|
||||
setupEntityComponents(entity) {
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
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,
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
|
@ -38,13 +38,14 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||
* Generates the background pattern for the wires overlay
|
||||
*/
|
||||
generateTilePattern() {
|
||||
const overlayTile = Loader.getSprite("sprites/misc/wires_overlay_tile.png");
|
||||
const overlayTile = Loader.getSprite("sprites/wires/overlay_tile.png");
|
||||
const dims = globalConfig.tileSize * wiresBackgroundDpi;
|
||||
const [canvas, context] = makeOffscreenBuffer(dims, dims, {
|
||||
smooth: false,
|
||||
reusable: false,
|
||||
label: "wires-tile-pattern",
|
||||
});
|
||||
context.clearRect(0, 0, dims, dims);
|
||||
overlayTile.draw(context, 0, 0, dims, dims);
|
||||
this.tilePatternCanvas = canvas;
|
||||
}
|
||||
|
@ -73,10 +74,14 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||
|
||||
const bounds = parameters.visibleRect;
|
||||
|
||||
const scaleFactor = 1 / wiresBackgroundDpi;
|
||||
|
||||
parameters.context.globalAlpha = this.currentAlpha;
|
||||
parameters.context.globalCompositeOperation = "darken";
|
||||
|
||||
const scaleFactor = 1 / wiresBackgroundDpi;
|
||||
parameters.context.globalCompositeOperation = "overlay";
|
||||
parameters.context.fillStyle = "rgba(50, 200, 150, 1)";
|
||||
parameters.context.fillRect(bounds.x, bounds.y, bounds.w, bounds.h);
|
||||
parameters.context.globalCompositeOperation = "source-over";
|
||||
|
||||
parameters.context.scale(scaleFactor, scaleFactor);
|
||||
parameters.context.fillStyle = this.cachedPatternBackground;
|
||||
parameters.context.fillRect(
|
||||
|
@ -86,7 +91,7 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
|||
bounds.h / scaleFactor
|
||||
);
|
||||
parameters.context.scale(1 / scaleFactor, 1 / scaleFactor);
|
||||
parameters.context.globalCompositeOperation = "source-over";
|
||||
|
||||
parameters.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,9 @@ import { enumLayer } from "../../root";
|
|||
import { HUDBaseToolbar } from "./base_toolbar";
|
||||
import { MetaWireBuilding } from "../../buildings/wire";
|
||||
import { MetaConstantSignalBuilding } from "../../buildings/constant_signal";
|
||||
import { MetaLogicGateBuilding } from "../../buildings/logic_gate";
|
||||
|
||||
const supportedBuildings = [MetaWireBuilding, MetaConstantSignalBuilding];
|
||||
const supportedBuildings = [MetaWireBuilding, MetaConstantSignalBuilding, MetaLogicGateBuilding];
|
||||
|
||||
export class HUDWiresToolbar extends HUDBaseToolbar {
|
||||
constructor(root) {
|
||||
|
|
|
@ -57,6 +57,7 @@ export const KEYMAPPINGS = {
|
|||
|
||||
wire: { keyCode: key("1") },
|
||||
constant_signal: { keyCode: key("2") },
|
||||
logic_gate: { keyCode: key("3") },
|
||||
},
|
||||
|
||||
placement: {
|
||||
|
|
|
@ -192,46 +192,6 @@ export class GameLogic {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the wire connections at the given tile
|
||||
* @param {Vector} tile
|
||||
* @returns {import("../core/utils").DirectionalObject}
|
||||
*/
|
||||
getLocalWireConnectionsAtTile(tile) {
|
||||
return {
|
||||
top: this.getTileWireConnections(tile.addScalars(0, -1)).bottom,
|
||||
right: this.getTileWireConnections(tile.addScalars(1, 0)).left,
|
||||
bottom: this.getTileWireConnections(tile.addScalars(0, 1)).top,
|
||||
left: this.getTileWireConnections(tile.addScalars(-1, 0)).right,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the wire connection at the given tile
|
||||
* @param {Vector} tile
|
||||
* @returns {import("../core/utils").DirectionalObject}
|
||||
*/
|
||||
getTileWireConnections(tile) {
|
||||
const result = {
|
||||
top: null,
|
||||
right: null,
|
||||
bottom: null,
|
||||
left: null,
|
||||
};
|
||||
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, enumLayer.wires);
|
||||
if (!contents) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const staticComp = contents.components.StaticMapEntity;
|
||||
const wiresComp = contents.components.Wire;
|
||||
if (wiresComp) {
|
||||
const connections = wiresComp.getLocalConnections();
|
||||
return rotateDirectionalObject(connections, staticComp.originalRotation);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Computes the flag for a given tile
|
||||
|
@ -243,7 +203,7 @@ export class GameLogic {
|
|||
computeWireEdgeStatus({ tile, edge, rotation }) {
|
||||
const offset = enumDirectionToVector[edge];
|
||||
const refTile = tile.add(offset);
|
||||
const angle = enumDirectionToAngle[edge];
|
||||
// const angle = enumDirectionToAngle[edge];
|
||||
|
||||
// // First, check if this edge can be connected from locally
|
||||
// const canConnectLocally = rotation === angle || (rotation + 180) % 360 === angle;
|
||||
|
@ -290,6 +250,7 @@ export class GameLogic {
|
|||
for (let k = 0; k < pinComp.slots.length; ++k) {
|
||||
const pinSlot = pins[k];
|
||||
const pinLocation = staticComp.localTileToWorld(pinSlot.pos);
|
||||
const pinDirection = staticComp.localDirectionToWorld(pinSlot.direction);
|
||||
|
||||
// Check if the pin has the right location
|
||||
if (!pinLocation.equals(tile)) {
|
||||
|
@ -297,7 +258,7 @@ export class GameLogic {
|
|||
}
|
||||
|
||||
// Check if the pin has the right direction
|
||||
if (pinSlot.direction !== enumInvertedDirections[edge]) {
|
||||
if (pinDirection !== enumInvertedDirections[edge]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import { MetaWireBuilding } from "./buildings/wire";
|
|||
import { gBuildingVariants, registerBuildingVariant } from "./building_codes";
|
||||
import { defaultBuildingVariant } from "./meta_building";
|
||||
import { MetaConstantSignalBuilding } from "./buildings/constant_signal";
|
||||
import { MetaLogicGateBuilding } from "./buildings/logic_gate";
|
||||
|
||||
const logger = createLogger("building_registry");
|
||||
|
||||
|
@ -33,6 +34,7 @@ export function initMetaBuildingRegistry() {
|
|||
gMetaBuildingRegistry.register(MetaHubBuilding);
|
||||
gMetaBuildingRegistry.register(MetaWireBuilding);
|
||||
gMetaBuildingRegistry.register(MetaConstantSignalBuilding);
|
||||
gMetaBuildingRegistry.register(MetaLogicGateBuilding);
|
||||
|
||||
// Belt
|
||||
registerBuildingVariant(1, MetaBeltBaseBuilding, defaultBuildingVariant, 0);
|
||||
|
@ -91,6 +93,9 @@ export function initMetaBuildingRegistry() {
|
|||
// Constant signal
|
||||
registerBuildingVariant(31, MetaConstantSignalBuilding);
|
||||
|
||||
// Logic gate
|
||||
registerBuildingVariant(32, MetaLogicGateBuilding);
|
||||
|
||||
// Propagate instances
|
||||
for (const key in gBuildingVariants) {
|
||||
gBuildingVariants[key].metaInstance = gMetaBuildingRegistry.findByClass(
|
||||
|
|
|
@ -9,6 +9,7 @@ import trim from "trim";
|
|||
import { BOOL_TRUE_SINGLETON, BOOL_FALSE_SINGLETON } from "../items/boolean_item";
|
||||
import { ShapeDefinition } from "../shape_definition";
|
||||
import { ShapeItem } from "../items/shape_item";
|
||||
import { BaseItem } from "../base_item";
|
||||
|
||||
export class ConstantSignalSystem extends GameSystemWithFilter {
|
||||
constructor(root) {
|
||||
|
@ -40,7 +41,7 @@ export class ConstantSignalSystem extends GameSystemWithFilter {
|
|||
const uid = entity.uid;
|
||||
|
||||
const signalValueInput = new FormElementInput({
|
||||
id: "markerName",
|
||||
id: "signalValue",
|
||||
label: null,
|
||||
placeholder: "",
|
||||
defaultValue: "",
|
||||
|
@ -51,9 +52,11 @@ export class ConstantSignalSystem extends GameSystemWithFilter {
|
|||
title: "Set Signal",
|
||||
desc: "Enter a shape code, color or '0' or '1'",
|
||||
formElements: [signalValueInput],
|
||||
buttons: ["cancel", "ok:good"],
|
||||
buttons: ["cancel:bad:escape", "ok:good:enter"],
|
||||
});
|
||||
this.root.hud.parts.dialogs.internalShowDialog(dialog);
|
||||
|
||||
// When confirmed, set the signal
|
||||
dialog.buttonSignals.ok.add(() => {
|
||||
if (!this.root || !this.root.entityMgr) {
|
||||
// Game got stopped
|
||||
|
@ -74,18 +77,47 @@ export class ConstantSignalSystem extends GameSystemWithFilter {
|
|||
|
||||
constantComp.signal = this.parseSignalCode(signalValueInput.getValue());
|
||||
});
|
||||
|
||||
// When cancelled, destroy the entity again
|
||||
dialog.buttonSignals.cancel.add(() => {
|
||||
if (!this.root || !this.root.entityMgr) {
|
||||
// Game got stopped
|
||||
return;
|
||||
}
|
||||
|
||||
const entityRef = this.root.entityMgr.findByUid(uid, false);
|
||||
if (!entityRef) {
|
||||
// outdated
|
||||
return;
|
||||
}
|
||||
|
||||
const constantComp = entityRef.components.ConstantSignal;
|
||||
if (!constantComp) {
|
||||
// no longer interesting
|
||||
return;
|
||||
}
|
||||
|
||||
this.root.logic.tryDeleteBuilding(entityRef);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to parse a signal code
|
||||
* @param {string} code
|
||||
* @returns {BaseItem}
|
||||
*/
|
||||
parseSignalCode(code) {
|
||||
code = trim(code);
|
||||
if (enumColors[code]) {
|
||||
return new ColorItem(code);
|
||||
const codeLower = code.toLowerCase();
|
||||
|
||||
if (enumColors[codeLower]) {
|
||||
return new ColorItem(codeLower);
|
||||
}
|
||||
if (code === "1" || code === "true") {
|
||||
if (code === "1" || codeLower === "true") {
|
||||
return BOOL_TRUE_SINGLETON;
|
||||
}
|
||||
|
||||
if (code === "0" || code === "false") {
|
||||
if (code === "0" || codeLower === "false") {
|
||||
return BOOL_FALSE_SINGLETON;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { globalConfig } from "../../core/config";
|
||||
import { DrawParameters } from "../../core/draw_parameters";
|
||||
import { Loader } from "../../core/loader";
|
||||
import { Vector } from "../../core/vector";
|
||||
import { Vector, enumDirectionToAngle } from "../../core/vector";
|
||||
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
|
||||
import { Entity } from "../entity";
|
||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||
|
@ -169,13 +169,16 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|||
|
||||
const worldPos = tile.toWorldSpaceCenterOfTile();
|
||||
|
||||
const effectiveRotation = Math.radians(
|
||||
staticComp.rotation + enumDirectionToAngle[slot.direction]
|
||||
);
|
||||
drawRotatedSprite({
|
||||
parameters,
|
||||
sprite: this.pinSprites[slot.type],
|
||||
x: worldPos.x,
|
||||
y: worldPos.y,
|
||||
angle: Math.radians(staticComp.rotation),
|
||||
size: globalConfig.tileSize,
|
||||
angle: effectiveRotation,
|
||||
size: globalConfig.tileSize + 2,
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
});
|
||||
|
@ -183,7 +186,9 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|||
// Draw contained item to visualize whats emitted
|
||||
const value = slot.value;
|
||||
if (value) {
|
||||
value.draw(worldPos.x, worldPos.y, parameters, 10);
|
||||
const offset = new Vector(0, -5).rotated(effectiveRotation);
|
||||
|
||||
value.draw(worldPos.x + offset.x, worldPos.y + offset.y, parameters, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -555,6 +555,11 @@ buildings:
|
|||
name: &constant_signal Constant Signal
|
||||
description: Emits a constant signal (shape, color or boolean).
|
||||
|
||||
logic_gate:
|
||||
default:
|
||||
name: &logic_gate AND Gate
|
||||
description: Emits a boolean signal if both inputs are truthy.
|
||||
|
||||
storyRewards:
|
||||
# Those are the rewards gained from completing the store
|
||||
reward_cutter_and_trash:
|
||||
|
@ -824,6 +829,7 @@ keybindings:
|
|||
trash: *trash
|
||||
wire: *wire
|
||||
constant_signal: *constant_signal
|
||||
logic_gate: *logic_gate
|
||||
# ---
|
||||
|
||||
pipette: Pipette
|
||||
|
|