1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-06-13 13:04:03 +00:00

Prettier and readded shapez.io logo

This commit is contained in:
DJ1TJOO 2021-02-26 16:29:37 +01:00
parent 31a6444bfc
commit 9f5ceff0bb
142 changed files with 1668 additions and 1645 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@ -1,27 +1,6 @@
$buildings: belt, $buildings: belt, cutter, miner, mixer, painter, rotater, balancer, stacker, trash, underground_belt, wire,
cutter, constant_signal, logic_gate, lever, filter, wire_tunnel, display, virtual_processor, reader, storage,
miner, transistor, analyzer, comparator, item_producer;
mixer,
painter,
rotater,
balancer,
stacker,
trash,
underground_belt,
wire,
constant_signal,
logic_gate,
lever,
filter,
wire_tunnel,
display,
virtual_processor,
reader,
storage,
transistor,
analyzer,
comparator,
item_producer;
@each $building in $buildings { @each $building in $buildings {
[data-icon="building_icons/#{$building}.png"] { [data-icon="building_icons/#{$building}.png"] {
/* @load-async */ /* @load-async */
@ -29,41 +8,11 @@ item_producer;
} }
} }
$buildingsAndVariants: belt, $buildingsAndVariants: belt, balancer, underground_belt, underground_belt-tier2, miner, miner-chainable,
balancer, cutter, cutter-quad, rotater, rotater-ccw, stacker, mixer, painter-double, painter-quad, trash, storage,
underground_belt, reader, rotater-rotate180, display, constant_signal, wire, wire_tunnel, logic_gate-or, logic_gate-not,
underground_belt-tier2, logic_gate-xor, analyzer, virtual_processor-rotater, virtual_processor-unstacker, item_producer,
miner, virtual_processor-stacker, virtual_processor-painter, wire-second, painter, painter-mirrored, comparator;
miner-chainable,
cutter,
cutter-quad,
rotater,
rotater-ccw,
stacker,
mixer,
painter-double,
painter-quad,
trash,
storage,
reader,
rotater-rotate180,
display,
constant_signal,
wire,
wire_tunnel,
logic_gate-or,
logic_gate-not,
logic_gate-xor,
analyzer,
virtual_processor-rotater,
virtual_processor-unstacker,
item_producer,
virtual_processor-stacker,
virtual_processor-painter,
wire-second,
painter,
painter-mirrored,
comparator;
@each $building in $buildingsAndVariants { @each $building in $buildingsAndVariants {
[data-icon="building_tutorials/#{$building}.png"] { [data-icon="building_tutorials/#{$building}.png"] {
/* @load-async */ /* @load-async */
@ -108,9 +57,7 @@ comparator;
background-image: uiResource("res/ui/building_tutorials/virtual_processor-cutter.png") !important; background-image: uiResource("res/ui/building_tutorials/virtual_processor-cutter.png") !important;
} }
$icons: notification_saved, $icons: notification_saved, notification_success, notification_upgrade;
notification_success,
notification_upgrade;
@each $icon in $icons { @each $icon in $icons {
[data-icon="icons/#{$icon}.png"] { [data-icon="icons/#{$icon}.png"] {
/* @load-async */ /* @load-async */
@ -118,34 +65,8 @@ notification_upgrade;
} }
} }
$languages: en, $languages: en, de, cs, da, et, es-419, fr, it, pt-BR, sv, tr, el, ru, uk, zh-TW, zh-CN, nb, mt-MT, ar, nl, vi,
de, th, hu, pl, ja, kor, no, pt-PT;
cs,
da,
et,
es-419,
fr,
it,
pt-BR,
sv,
tr,
el,
ru,
uk,
zh-TW,
zh-CN,
nb,
mt-MT,
ar,
nl,
vi,
th,
hu,
pl,
ja,
kor,
no,
pt-PT;
@each $language in $languages { @each $language in $languages {
[data-languageicon="#{$language}"] { [data-languageicon="#{$language}"] {
/* @load-async */ /* @load-async */
@ -153,7 +74,6 @@ pt-PT;
} }
} }
/* /*
PRICE PRICE
*/ */

View File

@ -1,13 +1,15 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>shapez.io - Build automated factories to build, combine and color shapes!</title> <title>shapez.io - Build automated factories to build, combine and color shapes!</title>
<!-- mobile stuff --> <!-- mobile stuff -->
<meta name="format-detection" content="telephone=no" /> <meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" /> <meta name="msapplication-tap-highlight" content="no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no, viewport-fit=cover" /> <meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no, viewport-fit=cover"
/>
<meta name="HandheldFriendly" content="true" /> <meta name="HandheldFriendly" content="true" />
<meta name="MobileOptimized" content="320" /> <meta name="MobileOptimized" content="320" />
<meta name="theme-color" content="#393747" /> <meta name="theme-color" content="#393747" />
@ -15,10 +17,19 @@
<!-- seo --> <!-- seo -->
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" /> <meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" /> <meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
<meta name="description" content="shapez.io is an open-source factory building game about combining and producing different types of shapes." /> <meta
<meta name="keywords" content="shapes, .io games, factorio, incremental, upgrades, base building, open source" /> name="description"
content="shapez.io is an open-source factory building game about combining and producing different types of shapes."
/>
<meta
name="keywords"
content="shapes, .io games, factorio, incremental, upgrades, base building, open source"
/>
<meta property="og:title" content="shapez.io" /> <meta property="og:title" content="shapez.io" />
<meta property="og:description" content="shapez.io is a fun factory base building game about combining shapes" /> <meta
property="og:description"
content="shapez.io is a fun factory base building game about combining shapes"
/>
<meta property="og:url" content="https://shapez.io/" /> <meta property="og:url" content="https://shapez.io/" />
<meta property="og:image" content="https://shapez.io/og_thumb.png" /> <meta property="og:image" content="https://shapez.io/og_thumb.png" />
<meta property="og:image:type" content="image/png" /> <meta property="og:image:type" content="image/png" />
@ -31,6 +42,5 @@
<link rel="canonical" href="https://shapez.io" /> <link rel="canonical" href="https://shapez.io" />
</head> </head>
<body oncontextmenu="return false" style="background: #393747"></body> <body oncontextmenu="return false" style="background: #393747;"></body>
</html> </html>

View File

@ -1,7 +1,8 @@
/** /**
* @type {Array<{version: string, date: string, entries: Array<String>}>} changelog * @type {Array<{version: string, date: string, entries: Array<String>}>} changelog
*/ */
export const CHANGELOG = [{ export const CHANGELOG = [
{
version: "1.2.3", version: "1.2.3",
date: "unreleased", date: "unreleased",
entries: [ entries: [

View File

@ -111,9 +111,9 @@ export class ReadWriteProxy {
const checksum = decompressed.substring(0, 40); const checksum = decompressed.substring(0, 40);
const jsonString = decompressed.substr(40); const jsonString = decompressed.substr(40);
const desiredChecksum = checksum.startsWith(CRC_PREFIX) ? const desiredChecksum = checksum.startsWith(CRC_PREFIX)
computeCrc(jsonString + salt) : ? computeCrc(jsonString + salt)
sha1(jsonString + salt); : sha1(jsonString + salt);
if (desiredChecksum !== checksum) { if (desiredChecksum !== checksum) {
// Checksum mismatch // Checksum mismatch
@ -202,9 +202,9 @@ export class ReadWriteProxy {
const checksum = decompressed.substring(0, 40); const checksum = decompressed.substring(0, 40);
const jsonString = decompressed.substr(40); const jsonString = decompressed.substr(40);
const desiredChecksum = checksum.startsWith(CRC_PREFIX) ? const desiredChecksum = checksum.startsWith(CRC_PREFIX)
computeCrc(jsonString + salt) : ? computeCrc(jsonString + salt)
sha1(jsonString + salt); : sha1(jsonString + salt);
if (desiredChecksum !== checksum) { if (desiredChecksum !== checksum) {
// Checksum mismatch // Checksum mismatch

View File

@ -97,7 +97,8 @@ export class StateManager {
this.app.analytics.trackStateEnter(key); this.app.analytics.trackStateEnter(key);
window.history.pushState({ window.history.pushState(
{
key, key,
}, },
key key

View File

@ -573,9 +573,9 @@ export function round1DigitLocalized(speed, separator = T.global.decimalSeparato
* @param {string=} separator The decimal separator for numbers like 50.1 (separator='.') * @param {string=} separator The decimal separator for numbers like 50.1 (separator='.')
*/ */
export function formatItemsPerSecond(speed, double = false, separator = T.global.decimalSeparator) { export function formatItemsPerSecond(speed, double = false, separator = T.global.decimalSeparator) {
return speed === 1.0 ? return speed === 1.0
T.ingame.buildingPlacement.infoTexts.oneItemPerSecond : ? T.ingame.buildingPlacement.infoTexts.oneItemPerSecond
T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace( : T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace(
"<x>", "<x>",
round2Digits(speed).toString().replace(".", separator) round2Digits(speed).toString().replace(".", separator)
) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : ""); ) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");

View File

@ -119,7 +119,8 @@ MetaAnalyzerBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -186,7 +187,8 @@ MetaAnalyzerBuilding.layerPreview = {
MetaAnalyzerBuilding.componentVariations = { MetaAnalyzerBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -297,7 +297,8 @@ MetaBalancerBuilding.silhouetteColors = {
MetaBalancerBuilding.componentVariations = { MetaBalancerBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, },
@ -319,7 +320,8 @@ MetaBalancerBuilding.componentVariations = {
}, },
[MetaBalancerBuilding.variants.merger]: (entity, rotationVariant) => { [MetaBalancerBuilding.variants.merger]: (entity, rotationVariant) => {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, },
@ -335,7 +337,8 @@ MetaBalancerBuilding.componentVariations = {
}, },
[MetaBalancerBuilding.variants.mergerInverse]: (entity, rotationVariant) => { [MetaBalancerBuilding.variants.mergerInverse]: (entity, rotationVariant) => {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, },
@ -352,12 +355,15 @@ MetaBalancerBuilding.componentVariations = {
[MetaBalancerBuilding.variants.splitter]: (entity, rotationVariant) => { [MetaBalancerBuilding.variants.splitter]: (entity, rotationVariant) => {
{ {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ]); },
]);
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },
@ -375,12 +381,15 @@ MetaBalancerBuilding.componentVariations = {
[MetaBalancerBuilding.variants.splitterInverse]: (entity, rotationVariant) => { [MetaBalancerBuilding.variants.splitterInverse]: (entity, rotationVariant) => {
{ {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ]); },
]);
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },

View File

@ -138,20 +138,16 @@ export class MetaBeltBuilding extends MetaBuilding {
getPreviewSprite(rotationVariant) { getPreviewSprite(rotationVariant) {
switch (MetaBeltBuilding.variantToRotation[rotationVariant]) { switch (MetaBeltBuilding.variantToRotation[rotationVariant]) {
case enumDirection.top: case enumDirection.top: {
{
return Loader.getSprite("sprites/buildings/belt_top.png"); return Loader.getSprite("sprites/buildings/belt_top.png");
} }
case enumDirection.left: case enumDirection.left: {
{
return Loader.getSprite("sprites/buildings/belt_left.png"); return Loader.getSprite("sprites/buildings/belt_left.png");
} }
case enumDirection.right: case enumDirection.right: {
{
return Loader.getSprite("sprites/buildings/belt_right.png"); return Loader.getSprite("sprites/buildings/belt_right.png");
} }
default: default: {
{
assertAlways(false, "Invalid belt rotation variant"); assertAlways(false, "Invalid belt rotation variant");
} }
} }
@ -159,20 +155,16 @@ export class MetaBeltBuilding extends MetaBuilding {
getBlueprintSprite(rotationVariant) { getBlueprintSprite(rotationVariant) {
switch (MetaBeltBuilding.variantToRotation[rotationVariant]) { switch (MetaBeltBuilding.variantToRotation[rotationVariant]) {
case enumDirection.top: case enumDirection.top: {
{
return Loader.getSprite("sprites/blueprints/belt_top.png"); return Loader.getSprite("sprites/blueprints/belt_top.png");
} }
case enumDirection.left: case enumDirection.left: {
{
return Loader.getSprite("sprites/blueprints/belt_left.png"); return Loader.getSprite("sprites/blueprints/belt_left.png");
} }
case enumDirection.right: case enumDirection.right: {
{
return Loader.getSprite("sprites/blueprints/belt_right.png"); return Loader.getSprite("sprites/blueprints/belt_right.png");
} }
default: default: {
{
assertAlways(false, "Invalid belt rotation variant"); assertAlways(false, "Invalid belt rotation variant");
} }
} }

View File

@ -120,7 +120,8 @@ MetaComparatorBuilding.setupEntityComponents = [
(entity, rotationVariant) => (entity, rotationVariant) =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -185,7 +186,8 @@ MetaComparatorBuilding.layerByVariant = {
MetaComparatorBuilding.componentVariations = { MetaComparatorBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -120,11 +120,13 @@ MetaConstantSignalBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
}, ], },
],
}) })
), ),
entity => entity.addComponent(new ConstantSignalComponent({})), entity => entity.addComponent(new ConstantSignalComponent({})),
@ -170,10 +172,12 @@ MetaConstantSignalBuilding.layerPreview = {
MetaConstantSignalBuilding.componentVariations = { MetaConstantSignalBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
}, ]); },
]);
}, },
}; };

View File

@ -99,11 +99,13 @@ MetaCutterBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "shape", filter: "shape",
}, ], },
],
}) })
), ),
]; ];

View File

@ -107,11 +107,13 @@ MetaDisplayBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.bottom, direction: enumDirection.bottom,
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
}, ], },
],
}) })
), ),
entity => entity.addComponent(new DisplayComponent()), entity => entity.addComponent(new DisplayComponent()),
@ -155,10 +157,12 @@ MetaDisplayBuilding.renderPins = {
MetaDisplayBuilding.componentVariations = { MetaDisplayBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.bottom, direction: enumDirection.bottom,
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
}, ]); },
]);
}, },
}; };

View File

@ -132,28 +132,33 @@ MetaFilterBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
}, ], },
],
}) })
), ),
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ], },
],
}) })
), ),
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemEjectorComponent({ new ItemEjectorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },
@ -212,18 +217,23 @@ MetaFilterBuilding.renderPins = {
MetaFilterBuilding.componentVariations = { MetaFilterBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
}, ]); },
]);
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ]); },
]);
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },

View File

@ -132,18 +132,21 @@ MetaHubBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 2), pos: new Vector(0, 2),
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
direction: enumDirection.left, direction: enumDirection.left,
}, ], },
],
}) })
), ),
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.top, enumDirection.left], directions: [enumDirection.top, enumDirection.left],
filter: "shape", filter: "shape",
@ -256,13 +259,16 @@ MetaHubBuilding.componentVariations = {
entity.components.ItemProcessor.type = enumItemProcessorTypes.hub; entity.components.ItemProcessor.type = enumItemProcessorTypes.hub;
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 2), pos: new Vector(0, 2),
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
direction: enumDirection.left, direction: enumDirection.left,
}, ]); },
]);
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.top, enumDirection.left], directions: [enumDirection.top, enumDirection.left],
filter: "shape", filter: "shape",

View File

@ -106,11 +106,13 @@ MetaItemProducerBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
direction: enumDirection.bottom, direction: enumDirection.bottom,
}, ], },
],
}) })
), ),
@ -153,10 +155,12 @@ MetaItemProducerBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
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.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
direction: enumDirection.bottom, direction: enumDirection.bottom,
}, ]); },
]);
}, },
}; };

View File

@ -123,11 +123,13 @@ MetaLeverBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
}, ], },
],
}) })
), ),
entity => entity.addComponent(new LeverComponent({})), entity => entity.addComponent(new LeverComponent({})),
@ -172,10 +174,12 @@ MetaLeverBuilding.renderPins = {
MetaLeverBuilding.componentVariations = { MetaLeverBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
}, ]); },
]);
}, },
}; };

View File

@ -202,7 +202,8 @@ MetaLogicGateBuilding.layerPreview = {
MetaLogicGateBuilding.componentVariations = { MetaLogicGateBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -223,7 +224,8 @@ MetaLogicGateBuilding.componentVariations = {
}, },
[MetaLogicGateBuilding.variants.xor]: (entity, rotationVariant) => { [MetaLogicGateBuilding.variants.xor]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -244,7 +246,8 @@ MetaLogicGateBuilding.componentVariations = {
}, },
[MetaLogicGateBuilding.variants.or]: (entity, rotationVariant) => { [MetaLogicGateBuilding.variants.or]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -264,7 +267,8 @@ MetaLogicGateBuilding.componentVariations = {
entity.components.LogicGate.type = enumLogicGateType.or; entity.components.LogicGate.type = enumLogicGateType.or;
}, },
[MetaLogicGateBuilding.variants.not]: (entity, rotationVariant) => { [MetaLogicGateBuilding.variants.not]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -131,7 +131,8 @@ MetaMixerBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "color", filter: "color",
@ -195,7 +196,8 @@ MetaMixerBuilding.componentVariations = {
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.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "color", filter: "color",

View File

@ -129,7 +129,8 @@ MetaPainterBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.left], directions: [enumDirection.left],
filter: "shape", filter: "shape",
@ -251,7 +252,8 @@ MetaPainterBuilding.componentVariations = {
entity.removeComponent(WiredPinsComponent); entity.removeComponent(WiredPinsComponent);
} }
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.left], directions: [enumDirection.left],
filter: "shape", filter: "shape",
@ -275,7 +277,8 @@ MetaPainterBuilding.componentVariations = {
entity.removeComponent(WiredPinsComponent); entity.removeComponent(WiredPinsComponent);
} }
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.left], directions: [enumDirection.left],
filter: "shape", filter: "shape",
@ -299,7 +302,8 @@ MetaPainterBuilding.componentVariations = {
entity.removeComponent(WiredPinsComponent); entity.removeComponent(WiredPinsComponent);
} }
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.left], directions: [enumDirection.left],
filter: "shape", filter: "shape",
@ -328,7 +332,8 @@ MetaPainterBuilding.componentVariations = {
entity.addComponent(new WiredPinsComponent({ slots: [] })); entity.addComponent(new WiredPinsComponent({ slots: [] }));
} }
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.bottom, direction: enumDirection.bottom,
type: enumPinSlotType.logicalAcceptor, type: enumPinSlotType.logicalAcceptor,
@ -350,7 +355,8 @@ MetaPainterBuilding.componentVariations = {
}, },
]); ]);
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.left], directions: [enumDirection.left],
filter: "shape", filter: "shape",

View File

@ -134,7 +134,8 @@ MetaReaderBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.right, direction: enumDirection.right,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -150,19 +151,23 @@ MetaReaderBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ], },
],
}) })
), ),
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemEjectorComponent({ new ItemEjectorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, ], },
],
}) })
), ),
entity => entity =>
@ -175,10 +180,12 @@ MetaReaderBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new BeltUnderlaysComponent({ new BeltUnderlaysComponent({
underlays: [{ underlays: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, ], },
],
}) })
), ),
entity => entity.addComponent(new BeltReaderComponent()), entity => entity.addComponent(new BeltReaderComponent()),
@ -229,23 +236,29 @@ MetaReaderBuilding.renderPins = {
MetaReaderBuilding.componentVariations = { MetaReaderBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ]); },
]);
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, ]); },
]);
entity.components.ItemProcessor.inputsPerCharge = 1; entity.components.ItemProcessor.inputsPerCharge = 1;
entity.components.ItemProcessor.type = enumItemProcessorTypes.reader; entity.components.ItemProcessor.type = enumItemProcessorTypes.reader;
entity.components.BeltUnderlays.underlays = [{ entity.components.BeltUnderlays.underlays = [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, ]; },
];
}, },
}; };

View File

@ -144,11 +144,13 @@ MetaRotaterBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "shape", filter: "shape",
}, ], },
],
}) })
), ),
]; ];

View File

@ -144,7 +144,8 @@ MetaStackerBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "shape", filter: "shape",
@ -216,7 +217,8 @@ MetaStackerBuilding.componentVariations = {
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.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
filter: "shape", filter: "shape",

View File

@ -135,7 +135,8 @@ MetaStorageBuilding.setupEntityComponents = [
// Required, since the item processor needs this. // Required, since the item processor needs this.
entity.addComponent( entity.addComponent(
new ItemEjectorComponent({ new ItemEjectorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },
@ -149,7 +150,8 @@ MetaStorageBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 1), pos: new Vector(0, 1),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, },
@ -169,7 +171,8 @@ MetaStorageBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(1, 1), pos: new Vector(1, 1),
direction: enumDirection.right, direction: enumDirection.right,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -232,7 +235,8 @@ MetaStorageBuilding.renderPins = {
MetaStorageBuilding.componentVariations = { MetaStorageBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, },
@ -241,7 +245,8 @@ MetaStorageBuilding.componentVariations = {
direction: enumDirection.top, direction: enumDirection.top,
}, },
]); ]);
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 1), pos: new Vector(0, 1),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, },
@ -251,7 +256,8 @@ MetaStorageBuilding.componentVariations = {
}, },
]); ]);
entity.components.Storage.maximumStorage = storageSize; entity.components.Storage.maximumStorage = storageSize;
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(1, 1), pos: new Vector(1, 1),
direction: enumDirection.right, direction: enumDirection.right,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -120,7 +120,8 @@ MetaTransistorBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new WiredPinsComponent({ new WiredPinsComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -122,7 +122,8 @@ MetaTrashBuilding.setupEntityComponents = [
entity => entity =>
entity.addComponent( entity.addComponent(
new ItemAcceptorComponent({ new ItemAcceptorComponent({
slots: [{ slots: [
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [ directions: [
enumDirection.top, enumDirection.top,
@ -130,7 +131,8 @@ MetaTrashBuilding.setupEntityComponents = [
enumDirection.bottom, enumDirection.bottom,
enumDirection.left, enumDirection.left,
], ],
}, ], },
],
}) })
), ),
entity => entity =>
@ -182,7 +184,8 @@ MetaTrashBuilding.avaibleVariants = {
MetaTrashBuilding.componentVariations = { MetaTrashBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [ directions: [
enumDirection.top, enumDirection.top,
@ -190,7 +193,8 @@ MetaTrashBuilding.componentVariations = {
enumDirection.bottom, enumDirection.bottom,
enumDirection.left, enumDirection.left,
], ],
}, ]); },
]);
entity.components.ItemProcessor.inputsPerCharge = 1; entity.components.ItemProcessor.inputsPerCharge = 1;

View File

@ -188,7 +188,8 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
const targetSenderRotation = rotation; const targetSenderRotation = rotation;
for ( for (
let searchOffset = 1; searchOffset <= globalConfig.undergroundBeltMaxTilesByTier[tier]; let searchOffset = 1;
searchOffset <= globalConfig.undergroundBeltMaxTilesByTier[tier];
++searchOffset ++searchOffset
) { ) {
tile = tile.addScalars(searchVector.x, searchVector.y); tile = tile.addScalars(searchVector.x, searchVector.y);
@ -360,18 +361,22 @@ MetaUndergroundBeltBuilding.componentVariationsByRotation = {
[enumUndergroundBeltMode.sender]: (entity, rotationVariant) => { [enumUndergroundBeltMode.sender]: (entity, rotationVariant) => {
entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.sender; entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.sender;
entity.components.ItemEjector.setSlots([]); entity.components.ItemEjector.setSlots([]);
entity.components.ItemAcceptor.setSlots([{ entity.components.ItemAcceptor.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
directions: [enumDirection.bottom], directions: [enumDirection.bottom],
}, ]); },
]);
}, },
[enumUndergroundBeltMode.receiver]: (entity, rotationVariant) => { [enumUndergroundBeltMode.receiver]: (entity, rotationVariant) => {
entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.receiver; entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.receiver;
entity.components.ItemAcceptor.setSlots([]); entity.components.ItemAcceptor.setSlots([]);
entity.components.ItemEjector.setSlots([{ entity.components.ItemEjector.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
}, ]); },
]);
}, },
}; };

View File

@ -219,7 +219,8 @@ MetaVirtualProcessorBuilding.silhouetteColors = {
MetaVirtualProcessorBuilding.componentVariations = { MetaVirtualProcessorBuilding.componentVariations = {
[defaultBuildingVariant]: (entity, rotationVariant) => { [defaultBuildingVariant]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -240,7 +241,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
}, },
[MetaVirtualProcessorBuilding.variants.rotater]: (entity, rotationVariant) => { [MetaVirtualProcessorBuilding.variants.rotater]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -256,7 +258,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
}, },
[MetaVirtualProcessorBuilding.variants.unstacker]: (entity, rotationVariant) => { [MetaVirtualProcessorBuilding.variants.unstacker]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.left, direction: enumDirection.left,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -277,7 +280,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
}, },
[MetaVirtualProcessorBuilding.variants.stacker]: (entity, rotationVariant) => { [MetaVirtualProcessorBuilding.variants.stacker]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,
@ -298,7 +302,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
}, },
[MetaVirtualProcessorBuilding.variants.painter]: (entity, rotationVariant) => { [MetaVirtualProcessorBuilding.variants.painter]: (entity, rotationVariant) => {
entity.components.WiredPins.setSlots([{ entity.components.WiredPins.setSlots([
{
pos: new Vector(0, 0), pos: new Vector(0, 0),
direction: enumDirection.top, direction: enumDirection.top,
type: enumPinSlotType.logicalEjector, type: enumPinSlotType.logicalEjector,

View File

@ -151,24 +151,19 @@ export class MetaWireBuilding extends MetaBuilding {
getPreviewSprite(rotationVariant, variant) { getPreviewSprite(rotationVariant, variant) {
const wireVariant = MetaWireBuilding.wireVariantToVariant[variant]; const wireVariant = MetaWireBuilding.wireVariantToVariant[variant];
switch (MetaWireBuilding.rotationVariantToType[rotationVariant]) { switch (MetaWireBuilding.rotationVariantToType[rotationVariant]) {
case enumWireType.forward: case enumWireType.forward: {
{
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_forward.png"); return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_forward.png");
} }
case enumWireType.turn: case enumWireType.turn: {
{
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_turn.png"); return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_turn.png");
} }
case enumWireType.split: case enumWireType.split: {
{
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png"); return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png");
} }
case enumWireType.cross: case enumWireType.cross: {
{
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png"); return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png");
} }
default: default: {
{
assertAlways(false, "Invalid wire rotation variant"); assertAlways(false, "Invalid wire rotation variant");
} }
} }

View File

@ -66,14 +66,12 @@ export class BeltComponent extends Component {
assert(progress <= 1.02, "Invalid progress: " + progress); assert(progress <= 1.02, "Invalid progress: " + progress);
return new Vector(0, 0.5 - progress); return new Vector(0, 0.5 - progress);
case enumDirection.right: case enumDirection.right: {
{
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 2: " + progress); assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 2: " + progress);
const arcProgress = (progress / BeltComponent.curvedBeltLength) * 0.5 * Math.PI; const arcProgress = (progress / BeltComponent.curvedBeltLength) * 0.5 * Math.PI;
return new Vector(0.5 - 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress)); return new Vector(0.5 - 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress));
} }
case enumDirection.left: case enumDirection.left: {
{
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 3: " + progress); assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 3: " + progress);
const arcProgress = (progress / BeltComponent.curvedBeltLength) * 0.5 * Math.PI; const arcProgress = (progress / BeltComponent.curvedBeltLength) * 0.5 * Math.PI;
return new Vector(-0.5 + 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress)); return new Vector(-0.5 + 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress));

View File

@ -201,32 +201,28 @@ export class StaticMapEntityComponent extends Component {
const size = this.getTileSize(); const size = this.getTileSize();
switch (this.rotation) { switch (this.rotation) {
case 0: case 0: {
{
x = this.origin.x; x = this.origin.x;
y = this.origin.y; y = this.origin.y;
w = size.x; w = size.x;
h = size.y; h = size.y;
break; break;
} }
case 90: case 90: {
{
x = this.origin.x - size.y + 1; x = this.origin.x - size.y + 1;
y = this.origin.y; y = this.origin.y;
w = size.y; w = size.y;
h = size.x; h = size.x;
break; break;
} }
case 180: case 180: {
{
x = this.origin.x - size.x + 1; x = this.origin.x - size.x + 1;
y = this.origin.y - size.y + 1; y = this.origin.y - size.y + 1;
w = size.x; w = size.x;
h = size.y; h = size.y;
break; break;
} }
case 270: case 270: {
{
x = this.origin.x; x = this.origin.x;
y = this.origin.y - size.x + 1; y = this.origin.y - size.x + 1;
w = size.y; w = size.y;
@ -281,7 +277,9 @@ export class StaticMapEntityComponent extends Component {
parameters.context.translate(rotationCenterX, rotationCenterY); parameters.context.translate(rotationCenterX, rotationCenterY);
parameters.context.rotate(Math.radians(this.rotation)); parameters.context.rotate(Math.radians(this.rotation));
sprite.drawCached( sprite.drawCached(
parameters, -globalConfig.halfTileSize - extrudePixels * size.x, -globalConfig.halfTileSize - extrudePixels * size.y, parameters,
-globalConfig.halfTileSize - extrudePixels * size.x,
-globalConfig.halfTileSize - extrudePixels * size.y,
globalConfig.tileSize * size.x + 2 * extrudePixels * size.x, globalConfig.tileSize * size.x + 2 * extrudePixels * size.x,
globalConfig.tileSize * size.y + 2 * extrudePixels * size.y, globalConfig.tileSize * size.y + 2 * extrudePixels * size.y,
false // no clipping possible here false // no clipping possible here

View File

@ -422,7 +422,9 @@ export class GameCore {
// Transform to world space // Transform to world space
if (G_IS_DEV && globalConfig.debug.testClipping) { if (G_IS_DEV && globalConfig.debug.testClipping) {
params.visibleRect = params.visibleRect.expandedInAllDirections(-200 / this.root.camera.zoomLevel); params.visibleRect = params.visibleRect.expandedInAllDirections(
-200 / this.root.camera.zoomLevel
);
} }
root.camera.transform(context); root.camera.transform(context);

View File

@ -127,7 +127,8 @@ export class HubGoals extends BasicSerializableObject {
* @returns {boolean} * @returns {boolean}
*/ */
isEndOfDemoReached() { isEndOfDemoReached() {
return (!this.root.gameMode.getIsFreeplayAvailable() && return (
!this.root.gameMode.getIsFreeplayAvailable() &&
this.level >= this.root.gameMode.getLevelDefinitions().length this.level >= this.root.gameMode.getLevelDefinitions().length
); );
} }

View File

@ -18,7 +18,8 @@ export class HUDBaseToolbar extends BaseHUDPart {
* @param {Layer=} param0.layer * @param {Layer=} param0.layer
*/ */
constructor( constructor(
root, { primaryBuildings, secondaryBuildings = [], visibilityCondition, htmlElementId, layer = "regular" } root,
{ primaryBuildings, secondaryBuildings = [], visibilityCondition, htmlElementId, layer = "regular" }
) { ) {
super(root); super(root);
@ -81,7 +82,8 @@ export class HUDBaseToolbar extends BaseHUDPart {
const itemContainer = makeDiv( const itemContainer = makeDiv(
this.primaryBuildings.includes(allBuildings[i]) ? rowPrimary : rowSecondary, this.primaryBuildings.includes(allBuildings[i]) ? rowPrimary : rowSecondary,
null, ["building"] null,
["building"]
); );
itemContainer.setAttribute("data-icon", "building_icons/" + metaBuilding.getId() + ".png"); itemContainer.setAttribute("data-icon", "building_icons/" + metaBuilding.getId() + ".png");
itemContainer.setAttribute("data-id", metaBuilding.getId()); itemContainer.setAttribute("data-id", metaBuilding.getId());
@ -159,9 +161,9 @@ export class HUDBaseToolbar extends BaseHUDPart {
let newBuildingFound = false; let newBuildingFound = false;
let newIndex = this.lastSelectedIndex; let newIndex = this.lastSelectedIndex;
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed ? const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed
-1 : ? -1
1; : 1;
for (let i = 0; i <= this.primaryBuildings.length; ++i) { for (let i = 0; i <= this.primaryBuildings.length; ++i) {
newIndex = safeModulo(newIndex + direction, this.primaryBuildings.length); newIndex = safeModulo(newIndex + direction, this.primaryBuildings.length);

View File

@ -34,7 +34,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
this.buildingInfoElements.descText = makeDiv(this.buildingInfoElements.desc, null, ["text"], ""); this.buildingInfoElements.descText = makeDiv(this.buildingInfoElements.desc, null, ["text"], "");
this.buildingInfoElements.additionalInfo = makeDiv( this.buildingInfoElements.additionalInfo = makeDiv(
this.buildingInfoElements.desc, this.buildingInfoElements.desc,
null, ["additionalInfo"], null,
["additionalInfo"],
"" ""
); );
this.buildingInfoElements.hotkey = makeDiv(this.buildingInfoElements.desc, null, ["hotkey"], ""); this.buildingInfoElements.hotkey = makeDiv(this.buildingInfoElements.desc, null, ["hotkey"], "");
@ -189,7 +190,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
makeDiv( makeDiv(
this.variantsElement, this.variantsElement,
null, ["explanation"], null,
["explanation"],
T.ingame.buildingPlacement.cycleBuildingVariants.replace( T.ingame.buildingPlacement.cycleBuildingVariants.replace(
"<key>", "<key>",
"<code class='keybinding'>" + "<code class='keybinding'>" +
@ -442,7 +444,9 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
parameters.context.translate(worldPos.x, worldPos.y); parameters.context.translate(worldPos.x, worldPos.y);
parameters.context.rotate(angle); parameters.context.rotate(angle);
parameters.context.drawImage( parameters.context.drawImage(
arrowSprite, -6, -globalConfig.halfTileSize - arrowSprite,
-6,
-globalConfig.halfTileSize -
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize + clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
globalConfig.halfTileSize - globalConfig.halfTileSize -
6, 6,
@ -498,7 +502,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
// Go over all slots // Go over all slots
for ( for (
let acceptorDirectionIndex = 0; acceptorDirectionIndex < slot.directions.length; let acceptorDirectionIndex = 0;
acceptorDirectionIndex < slot.directions.length;
++acceptorDirectionIndex ++acceptorDirectionIndex
) { ) {
const direction = slot.directions[acceptorDirectionIndex]; const direction = slot.directions[acceptorDirectionIndex];

View File

@ -443,7 +443,8 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
} }
// Check if we should stop placement // Check if we should stop placement
if (!metaBuilding.getStayInPlacementMode() && if (
!metaBuilding.getStayInPlacementMode() &&
!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).pressed && !this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).pressed &&
!this.root.app.settings.getAllSettings().alwaysMultiplace !this.root.app.settings.getAllSettings().alwaysMultiplace
) { ) {
@ -471,9 +472,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
console.warn("Invalid variant selected:", this.currentVariant.get()); console.warn("Invalid variant selected:", this.currentVariant.get());
} }
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier) const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier)
.pressed ? .pressed
-1 : ? -1
1; : 1;
const newIndex = safeModulo(index + direction, availableVariants.length); const newIndex = safeModulo(index + direction, availableVariants.length);
const newVariant = availableVariants[newIndex]; const newVariant = availableVariants[newIndex];

View File

@ -103,9 +103,9 @@ export class HUDMinerHighlight extends BaseHUDPart {
parameters.context.globalAlpha = 0.6; parameters.context.globalAlpha = 0.6;
parameters.context.font = "bold " + scale * 8 + "px GameFont"; parameters.context.font = "bold " + scale * 8 + "px GameFont";
parameters.context.fillText( parameters.context.fillText(
connectedEntities.length === 1 ? connectedEntities.length === 1
T.ingame.connectedMiners.one_miner : ? T.ingame.connectedMiners.one_miner
T.ingame.connectedMiners.n_miners.replace("<amount>", String(connectedEntities.length)), : T.ingame.connectedMiners.n_miners.replace("<amount>", String(connectedEntities.length)),
tooltipLocation.x + 10 * scale, tooltipLocation.x + 10 * scale,
tooltipLocation.y + 22 * scale tooltipLocation.y + 22 * scale
); );

View File

@ -15,7 +15,8 @@ export class HUDSettingsMenu extends BaseHUDPart {
this.statsElement = makeDiv( this.statsElement = makeDiv(
this.background, this.background,
null, ["statsElement"], null,
["statsElement"],
` `
<strong>${T.ingame.settingsMenu.beltsPlaced}</strong><span class="beltsPlaced"></span> <strong>${T.ingame.settingsMenu.beltsPlaced}</strong><span class="beltsPlaced"></span>
<strong>${T.ingame.settingsMenu.buildingsPlaced}</strong><span class="buildingsPlaced"></span> <strong>${T.ingame.settingsMenu.buildingsPlaced}</strong><span class="buildingsPlaced"></span>
@ -110,7 +111,8 @@ export class HUDSettingsMenu extends BaseHUDPart {
} }
} }
HUDSettingsMenu.buttons = [{ HUDSettingsMenu.buttons = [
{
id: "continue", id: "continue",
action: hudSettingsMenu => () => hudSettingsMenu.close(), action: hudSettingsMenu => () => hudSettingsMenu.close(),
options: { options: {

View File

@ -48,7 +48,8 @@ export class HUDWaypoints extends BaseHUDPart {
if (this.root.app.settings.getAllSettings().offerHints) { if (this.root.app.settings.getAllSettings().offerHints) {
this.hintElement = makeDiv( this.hintElement = makeDiv(
parent, parent,
"ingame_HUD_Waypoints_Hint", [], "ingame_HUD_Waypoints_Hint",
[],
` `
<strong class='title'>${T.ingame.waypoints.waypoints}</strong> <strong class='title'>${T.ingame.waypoints.waypoints}</strong>
<span class='desc'>${T.ingame.waypoints.description.replace( <span class='desc'>${T.ingame.waypoints.description.replace(

View File

@ -36,7 +36,8 @@ export class HUDWireInfo extends BaseHUDPart {
return; return;
} }
if (!this.root.camera.getIsMapOverlayActive() && if (
!this.root.camera.getIsMapOverlayActive() &&
!this.root.logic.getIsEntityIntersectedWithMatrix(entity, worldPos) !this.root.logic.getIsEntityIntersectedWithMatrix(entity, worldPos)
) { ) {
// Detailed intersection check // Detailed intersection check

View File

@ -146,9 +146,9 @@ export class HUDWiresOverlay extends BaseHUDPart {
parameters.context.globalCompositeOperation = "source-over"; parameters.context.globalCompositeOperation = "source-over";
parameters.context.scale(scaleFactor, scaleFactor); parameters.context.scale(scaleFactor, scaleFactor);
parameters.context.fillStyle = hasTileGrid ? parameters.context.fillStyle = hasTileGrid
this.cachedPatternBackground : ? this.cachedPatternBackground
"rgba(78, 137, 125, 0.75)"; : "rgba(78, 137, 125, 0.75)";
parameters.context.fillRect( parameters.context.fillRect(
bounds.x / scaleFactor, bounds.x / scaleFactor,
bounds.y / scaleFactor, bounds.y / scaleFactor,

View File

@ -264,9 +264,9 @@ export function getStringForKeyCode(code) {
return "'"; return "'";
} }
return (48 <= code && code <= 57) || (65 <= code && code <= 90) ? return (48 <= code && code <= 57) || (65 <= code && code <= 90)
String.fromCharCode(code) : ? String.fromCharCode(code)
"[" + code + "]"; : "[" + code + "]";
} }
export class Keybinding { export class Keybinding {

View File

@ -142,9 +142,9 @@ export class MapChunkView extends MapChunk {
*/ */
generateOverlayBuffer(canvas, context, w, h, dpi) { generateOverlayBuffer(canvas, context, w, h, dpi) {
context.fillStyle = context.fillStyle =
this.containedEntities.length > 0 ? this.containedEntities.length > 0
THEME.map.chunkOverview.filled : ? THEME.map.chunkOverview.filled
THEME.map.chunkOverview.empty; : THEME.map.chunkOverview.empty;
context.fillRect(0, 0, w, h); context.fillRect(0, 0, w, h);
if (this.root.app.settings.getAllSettings().displayChunkBorders) { if (this.root.app.settings.getAllSettings().displayChunkBorders) {

View File

@ -43,7 +43,8 @@ function generateUpgrades(limitedVersion = false) {
} }
const upgrades = { const upgrades = {
belt: [{ belt: [
{
required: [{ shape: "CuCuCuCu", amount: 30 }], required: [{ shape: "CuCuCuCu", amount: 30 }],
}, },
{ {
@ -72,7 +73,8 @@ function generateUpgrades(limitedVersion = false) {
...generateInfiniteUnlocks(), ...generateInfiniteUnlocks(),
], ],
miner: [{ miner: [
{
required: [{ shape: "RuRuRuRu", amount: 300 }], required: [{ shape: "RuRuRuRu", amount: 300 }],
}, },
{ {
@ -101,7 +103,8 @@ function generateUpgrades(limitedVersion = false) {
...generateInfiniteUnlocks(), ...generateInfiniteUnlocks(),
], ],
processors: [{ processors: [
{
required: [{ shape: "SuSuSuSu", amount: 500 }], required: [{ shape: "SuSuSuSu", amount: 500 }],
}, },
{ {
@ -130,7 +133,8 @@ function generateUpgrades(limitedVersion = false) {
...generateInfiniteUnlocks(), ...generateInfiniteUnlocks(),
], ],
painting: [{ painting: [
{
required: [{ shape: "RbRb----", amount: 600 }], required: [{ shape: "RbRb----", amount: 600 }],
}, },
{ {
@ -317,13 +321,15 @@ export function generateLevelDefinitions(limitedVersion = false) {
}, },
// DEMO STOPS HERE // DEMO STOPS HERE
...(limitedVersion ? ...(limitedVersion
[{ ? [
{
shape: "RpRpRpRp:CwCwCwCw", shape: "RpRpRpRp:CwCwCwCw",
required: 0, required: 0,
reward: enumHubGoalRewards.reward_demo_end, reward: enumHubGoalRewards.reward_demo_end,
}, ] : },
[ ]
: [
// 14 // 14
// Belt reader // Belt reader
{ {
@ -457,9 +463,9 @@ export class RegularGameMode extends GameMode {
} }
getUpgrades() { getUpgrades() {
return this.root.app.restrictionMgr.getHasExtendedUpgrades() ? return this.root.app.restrictionMgr.getHasExtendedUpgrades()
fullVersionUpgrades : ? fullVersionUpgrades
demoVersionUpgrades; : demoVersionUpgrades;
} }
getIsFreeplayAvailable() { getIsFreeplayAvailable() {
@ -471,8 +477,8 @@ export class RegularGameMode extends GameMode {
} }
getLevelDefinitions() { getLevelDefinitions() {
return this.root.app.restrictionMgr.getHasExtendedLevelsAndFreeplay() ? return this.root.app.restrictionMgr.getHasExtendedLevelsAndFreeplay()
fullVersionLevels : ? fullVersionLevels
demoVersionLevels; : demoVersionLevels;
} }
} }

View File

@ -607,8 +607,10 @@ ShapeDefinition.renderQuad = {
context.beginPath(); context.beginPath();
context.moveTo(insetPadding + -quadrantHalfSize, -insetPadding + quadrantHalfSize); context.moveTo(insetPadding + -quadrantHalfSize, -insetPadding + quadrantHalfSize);
context.arc( context.arc(
insetPadding + -quadrantHalfSize, -insetPadding + quadrantHalfSize, insetPadding + -quadrantHalfSize,
quadrantSize * layerScale, -Math.PI * 0.5, -insetPadding + quadrantHalfSize,
quadrantSize * layerScale,
-Math.PI * 0.5,
0 0
); );
context.closePath(); context.closePath();

View File

@ -30,9 +30,9 @@ export class BeltReaderSystem extends GameSystemWithFilter {
pinsComp.slots[1].value = readerComp.lastItem; pinsComp.slots[1].value = readerComp.lastItem;
pinsComp.slots[0].value = pinsComp.slots[0].value =
(readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) > (readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) >
minimumTimeForThroughput ? minimumTimeForThroughput
BOOL_TRUE_SINGLETON : ? BOOL_TRUE_SINGLETON
BOOL_FALSE_SINGLETON; : BOOL_FALSE_SINGLETON;
if (now - readerComp.lastThroughputComputation > 0.5) { if (now - readerComp.lastThroughputComputation > 0.5) {
// Compute throughput // Compute throughput

View File

@ -252,12 +252,14 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
} }
// Culling, Part 2: Check if the overlay is visible // Culling, Part 2: Check if the overlay is visible
if (!parameters.visibleRect.containsRect4Params( if (
!parameters.visibleRect.containsRect4Params(
destX, destX,
destY, destY,
globalConfig.tileSize, globalConfig.tileSize,
globalConfig.tileSize globalConfig.tileSize
)) { )
) {
continue; continue;
} }
@ -287,7 +289,9 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
this.underlayBeltSprites[ this.underlayBeltSprites[
animationIndex % this.underlayBeltSprites.length animationIndex % this.underlayBeltSprites.length
].drawCachedWithClipRect( ].drawCachedWithClipRect(
parameters, -globalConfig.halfTileSize, -globalConfig.halfTileSize, parameters,
-globalConfig.halfTileSize,
-globalConfig.halfTileSize,
globalConfig.tileSize, globalConfig.tileSize,
globalConfig.tileSize, globalConfig.tileSize,
clipRect clipRect

View File

@ -84,6 +84,6 @@ export class FilterSystem extends GameSystemWithFilter {
} }
FilterSystem.listToCheck = (entity, slot, item, filterComp, networkValue) => FilterSystem.listToCheck = (entity, slot, item, filterComp, networkValue) =>
networkValue.equals(BOOL_TRUE_SINGLETON) || networkValue.equals(item) ? networkValue.equals(BOOL_TRUE_SINGLETON) || networkValue.equals(item)
filterComp.pendingItemsToLeaveThrough : ? filterComp.pendingItemsToLeaveThrough
filterComp.pendingItemsToReject; : filterComp.pendingItemsToReject;

View File

@ -104,9 +104,9 @@ export class LogicGateSystem extends GameSystemWithFilter {
*/ */
compute_AND(parameters) { compute_AND(parameters) {
assert(parameters.length === 2, "bad parameter count for AND"); assert(parameters.length === 2, "bad parameter count for AND");
return isTruthyItem(parameters[0]) && isTruthyItem(parameters[1]) ? return isTruthyItem(parameters[0]) && isTruthyItem(parameters[1])
BOOL_TRUE_SINGLETON : ? BOOL_TRUE_SINGLETON
BOOL_FALSE_SINGLETON; : BOOL_FALSE_SINGLETON;
} }
/** /**
@ -123,9 +123,9 @@ export class LogicGateSystem extends GameSystemWithFilter {
*/ */
compute_XOR(parameters) { compute_XOR(parameters) {
assert(parameters.length === 2, "bad parameter count for XOR"); assert(parameters.length === 2, "bad parameter count for XOR");
return isTruthyItem(parameters[0]) !== isTruthyItem(parameters[1]) ? return isTruthyItem(parameters[0]) !== isTruthyItem(parameters[1])
BOOL_TRUE_SINGLETON : ? BOOL_TRUE_SINGLETON
BOOL_FALSE_SINGLETON; : BOOL_FALSE_SINGLETON;
} }
/** /**
@ -134,9 +134,9 @@ export class LogicGateSystem extends GameSystemWithFilter {
*/ */
compute_OR(parameters) { compute_OR(parameters) {
assert(parameters.length === 2, "bad parameter count for OR"); assert(parameters.length === 2, "bad parameter count for OR");
return isTruthyItem(parameters[0]) || isTruthyItem(parameters[1]) ? return isTruthyItem(parameters[0]) || isTruthyItem(parameters[1])
BOOL_TRUE_SINGLETON : ? BOOL_TRUE_SINGLETON
BOOL_FALSE_SINGLETON; : BOOL_FALSE_SINGLETON;
} }
/** /**
@ -226,12 +226,12 @@ export class LogicGateSystem extends GameSystemWithFilter {
const definition = /** @type {ShapeItem} */ (item).definition; const definition = /** @type {ShapeItem} */ (item).definition;
const result = this.root.shapeDefinitionMgr.shapeActionCutHalf(definition); const result = this.root.shapeDefinitionMgr.shapeActionCutHalf(definition);
return [ return [
result[0].isEntirelyEmpty() ? result[0].isEntirelyEmpty()
null : ? null
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[0]), : this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[0]),
result[1].isEntirelyEmpty() ? result[1].isEntirelyEmpty()
null : ? null
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[1]), : this.root.shapeDefinitionMgr.getShapeItemFromDefinition(result[1]),
]; ];
} }
@ -258,9 +258,9 @@ export class LogicGateSystem extends GameSystemWithFilter {
lowerLayers.length > 0 ? new ShapeDefinition({ layers: lowerLayers }) : null; lowerLayers.length > 0 ? new ShapeDefinition({ layers: lowerLayers }) : null;
return [ return [
lowerLayerDefinition ? lowerLayerDefinition
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(lowerLayerDefinition) : ? this.root.shapeDefinitionMgr.getShapeItemFromDefinition(lowerLayerDefinition)
null, : null,
this.root.shapeDefinitionMgr.getShapeItemFromDefinition(upperLayerDefinition), this.root.shapeDefinitionMgr.getShapeItemFromDefinition(upperLayerDefinition),
]; ];
} }
@ -340,30 +340,26 @@ export class LogicGateSystem extends GameSystemWithFilter {
} }
switch (itemA.getItemType()) { switch (itemA.getItemType()) {
case "shape": case "shape": {
{
return /** @type {ShapeItem} */ (itemA).definition.getHash() === return /** @type {ShapeItem} */ (itemA).definition.getHash() ===
/** @type {ShapeItem} */ /** @type {ShapeItem} */
(itemB).definition.getHash() ? (itemB).definition.getHash()
BOOL_TRUE_SINGLETON : ? BOOL_TRUE_SINGLETON
BOOL_FALSE_SINGLETON; : BOOL_FALSE_SINGLETON;
} }
case "color": case "color": {
{ return /** @type {ColorItem} */ (itemA).color === /** @type {ColorItem} */ (itemB).color
return /** @type {ColorItem} */ (itemA).color === /** @type {ColorItem} */ (itemB).color ? ? BOOL_TRUE_SINGLETON
BOOL_TRUE_SINGLETON : : BOOL_FALSE_SINGLETON;
BOOL_FALSE_SINGLETON;
} }
case "boolean": case "boolean": {
{ return /** @type {BooleanItem} */ (itemA).value === /** @type {BooleanItem} */ (itemB).value
return /** @type {BooleanItem} */ (itemA).value === /** @type {BooleanItem} */ (itemB).value ? ? BOOL_TRUE_SINGLETON
BOOL_TRUE_SINGLETON : : BOOL_FALSE_SINGLETON;
BOOL_FALSE_SINGLETON;
} }
default: default: {
{
assertAlways(false, "Bad item type: " + itemA.getItemType()); assertAlways(false, "Bad item type: " + itemA.getItemType());
} }
} }

View File

@ -254,7 +254,8 @@ export class UndergroundBeltSystem extends GameSystemWithFilter {
// Search in the direction of the tunnel // Search in the direction of the tunnel
for ( for (
let searchOffset = 0; searchOffset < globalConfig.undergroundBeltMaxTilesByTier[undergroundComp.tier]; let searchOffset = 0;
searchOffset < globalConfig.undergroundBeltMaxTilesByTier[undergroundComp.tier];
++searchOffset ++searchOffset
) { ) {
currentTile = currentTile.add(searchVector); currentTile = currentTile.add(searchVector);

View File

@ -217,10 +217,12 @@ export class WireSystem extends GameSystemWithFilter {
currentNetwork.uid, currentNetwork.uid,
")" ")"
); );
const entitiesToVisit = [{ const entitiesToVisit = [
{
entity: initialEntity, entity: initialEntity,
slot, slot,
}, ]; },
];
/** /**
* Once we occur a wire, we store its variant so we don't connect to * Once we occur a wire, we store its variant so we don't connect to
@ -245,7 +247,8 @@ export class WireSystem extends GameSystemWithFilter {
//// WIRE //// WIRE
if (wireComp) { if (wireComp) {
// Sanity check // Sanity check
assert(!wireComp.linkedNetwork || wireComp.linkedNetwork === currentNetwork, assert(
!wireComp.linkedNetwork || wireComp.linkedNetwork === currentNetwork,
"Mismatching wire network on wire entity " + "Mismatching wire network on wire entity " +
(wireComp.linkedNetwork ? wireComp.linkedNetwork.uid : "<empty>") + (wireComp.linkedNetwork ? wireComp.linkedNetwork.uid : "<empty>") +
" vs " + " vs " +
@ -287,7 +290,8 @@ export class WireSystem extends GameSystemWithFilter {
} }
// Sanity check // Sanity check
assert(!slot.linkedNetwork || slot.linkedNetwork === currentNetwork, assert(
!slot.linkedNetwork || slot.linkedNetwork === currentNetwork,
"Mismatching wire network on pin slot entity " + "Mismatching wire network on pin slot entity " +
(slot.linkedNetwork ? slot.linkedNetwork.uid : "<empty>") + (slot.linkedNetwork ? slot.linkedNetwork.uid : "<empty>") +
" vs " + " vs " +

View File

@ -121,9 +121,11 @@ export class WiredPinsSystem extends GameSystemWithFilter {
if (collidingEntity) { if (collidingEntity) {
const staticComp = collidingEntity.components.StaticMapEntity; const staticComp = collidingEntity.components.StaticMapEntity;
const data = getBuildingDataFromCode(staticComp.code); const data = getBuildingDataFromCode(staticComp.code);
if (!collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable( if (
!collidingEntity.components.StaticMapEntity.getMetaBuilding().getIsReplaceable(
data.variant data.variant
)) { )
) {
return true; return true;
} }
} }
@ -193,7 +195,9 @@ export class WiredPinsSystem extends GameSystemWithFilter {
const worldPos = tile.toWorldSpaceCenterOfTile(); const worldPos = tile.toWorldSpaceCenterOfTile();
// Culling // Culling
if (!parameters.visibleRect.containsCircle(worldPos.x, worldPos.y, globalConfig.halfTileSize)) { if (
!parameters.visibleRect.containsCircle(worldPos.x, worldPos.y, globalConfig.halfTileSize)
) {
continue; continue;
} }

View File

@ -28,31 +28,15 @@ const typed = x => x;
* @enum {TutorialGoalReward?} * @enum {TutorialGoalReward?}
*/ */
export const enumHubGoalRewardsToContentUnlocked = { export const enumHubGoalRewardsToContentUnlocked = {
[enumHubGoalRewards.reward_cutter_and_trash]: typed([ [enumHubGoalRewards.reward_cutter_and_trash]: typed([[MetaCutterBuilding, defaultBuildingVariant]]),
[MetaCutterBuilding, defaultBuildingVariant] [enumHubGoalRewards.reward_rotater]: typed([[MetaRotaterBuilding, defaultBuildingVariant]]),
]), [enumHubGoalRewards.reward_painter]: typed([[MetaPainterBuilding, defaultBuildingVariant]]),
[enumHubGoalRewards.reward_rotater]: typed([ [enumHubGoalRewards.reward_mixer]: typed([[MetaMixerBuilding, defaultBuildingVariant]]),
[MetaRotaterBuilding, defaultBuildingVariant] [enumHubGoalRewards.reward_stacker]: typed([[MetaStackerBuilding, defaultBuildingVariant]]),
]), [enumHubGoalRewards.reward_balancer]: typed([[MetaBalancerBuilding, defaultBuildingVariant]]),
[enumHubGoalRewards.reward_painter]: typed([ [enumHubGoalRewards.reward_tunnel]: typed([[MetaUndergroundBeltBuilding, defaultBuildingVariant]]),
[MetaPainterBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_mixer]: typed([
[MetaMixerBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_stacker]: typed([
[MetaStackerBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_balancer]: typed([
[MetaBalancerBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_tunnel]: typed([
[MetaUndergroundBeltBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_rotater_ccw]: typed([ [enumHubGoalRewards.reward_rotater_ccw]: typed([[MetaRotaterBuilding, MetaRotaterBuilding.variants.ccw]]),
[MetaRotaterBuilding, MetaRotaterBuilding.variants.ccw]
]),
[enumHubGoalRewards.reward_rotater_180]: typed([ [enumHubGoalRewards.reward_rotater_180]: typed([
[MetaRotaterBuilding, MetaRotaterBuilding.variants.rotate180], [MetaRotaterBuilding, MetaRotaterBuilding.variants.rotate180],
]), ]),
@ -65,34 +49,20 @@ export const enumHubGoalRewardsToContentUnlocked = {
[enumHubGoalRewards.reward_splitter]: typed([ [enumHubGoalRewards.reward_splitter]: typed([
[MetaBalancerBuilding, MetaBalancerBuilding.variants.splitter], [MetaBalancerBuilding, MetaBalancerBuilding.variants.splitter],
]), ]),
[enumHubGoalRewards.reward_merger]: typed([ [enumHubGoalRewards.reward_merger]: typed([[MetaBalancerBuilding, MetaBalancerBuilding.variants.merger]]),
[MetaBalancerBuilding, MetaBalancerBuilding.variants.merger] [enumHubGoalRewards.reward_cutter_quad]: typed([[MetaCutterBuilding, MetaCutterBuilding.variants.quad]]),
]),
[enumHubGoalRewards.reward_cutter_quad]: typed([
[MetaCutterBuilding, MetaCutterBuilding.variants.quad]
]),
[enumHubGoalRewards.reward_painter_double]: typed([ [enumHubGoalRewards.reward_painter_double]: typed([
[MetaPainterBuilding, MetaPainterBuilding.variants.double], [MetaPainterBuilding, MetaPainterBuilding.variants.double],
]), ]),
[enumHubGoalRewards.reward_storage]: typed([ [enumHubGoalRewards.reward_storage]: typed([[MetaStorageBuilding, defaultBuildingVariant]]),
[MetaStorageBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_belt_reader]: typed([ [enumHubGoalRewards.reward_belt_reader]: typed([[MetaReaderBuilding, defaultBuildingVariant]]),
[MetaReaderBuilding, defaultBuildingVariant] [enumHubGoalRewards.reward_display]: typed([[MetaDisplayBuilding, defaultBuildingVariant]]),
]),
[enumHubGoalRewards.reward_display]: typed([
[MetaDisplayBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_constant_signal]: typed([ [enumHubGoalRewards.reward_constant_signal]: typed([
[MetaConstantSignalBuilding, defaultBuildingVariant], [MetaConstantSignalBuilding, defaultBuildingVariant],
]), ]),
[enumHubGoalRewards.reward_logic_gates]: typed([ [enumHubGoalRewards.reward_logic_gates]: typed([[MetaLogicGateBuilding, defaultBuildingVariant]]),
[MetaLogicGateBuilding, defaultBuildingVariant] [enumHubGoalRewards.reward_filter]: typed([[MetaFilterBuilding, defaultBuildingVariant]]),
]),
[enumHubGoalRewards.reward_filter]: typed([
[MetaFilterBuilding, defaultBuildingVariant]
]),
[enumHubGoalRewards.reward_virtual_processing]: null, [enumHubGoalRewards.reward_virtual_processing]: null,
[enumHubGoalRewards.reward_wires_painter_and_levers]: typed([ [enumHubGoalRewards.reward_wires_painter_and_levers]: typed([

View File

@ -941,7 +941,8 @@ export class ShapezAPI {
sourceImage.crossOrigin = "anonymous"; sourceImage.crossOrigin = "anonymous";
sourceImage.onload = () => { sourceImage.onload = () => {
// @ts-ignore // @ts-ignore
Loader.internalParseAtlas({ Loader.internalParseAtlas(
{
meta: atlasData.atlasData.meta, meta: atlasData.atlasData.meta,
sourceData: atlasData.atlasData.frames, sourceData: atlasData.atlasData.frames,
}, },

View File

@ -24,7 +24,8 @@ export const enumCategories = {
debug: "debug", debug: "debug",
}; };
export const uiScales = [{ export const uiScales = [
{
id: "super_small", id: "super_small",
size: 0.6, size: 0.6,
}, },
@ -46,7 +47,8 @@ export const uiScales = [{
}, },
]; ];
export const scrollWheelSensitivities = [{ export const scrollWheelSensitivities = [
{
id: "super_slow", id: "super_slow",
scale: 0.25, scale: 0.25,
}, },
@ -68,7 +70,8 @@ export const scrollWheelSensitivities = [{
}, },
]; ];
export const movementSpeeds = [{ export const movementSpeeds = [
{
id: "super_slow", id: "super_slow",
multiplier: 0.25, multiplier: 0.25,
}, },
@ -94,7 +97,8 @@ export const movementSpeeds = [{
}, },
]; ];
export const autosaveIntervals = [{ export const autosaveIntervals = [
{
id: "one_minute", id: "one_minute",
seconds: 60, seconds: 60,
}, },

View File

@ -117,7 +117,8 @@ export class BaseSetting {
export class EnumSetting extends BaseSetting { export class EnumSetting extends BaseSetting {
constructor( constructor(
id, { id,
{
options, options,
valueGetter, valueGetter,
textGetter, textGetter,

View File

@ -150,7 +150,8 @@ export class SavegameManager extends ReadWriteProxy {
this.updateAfterSavegamesChanged(); this.updateAfterSavegamesChanged();
return new Savegame( return new Savegame(
this.app, { this.app,
{
internalId: id, internalId: id,
metaDataRef: metaData, metaDataRef: metaData,
}, },

View File

@ -1197,7 +1197,8 @@ export class TypeNullable extends BaseDataType {
getAsJsonSchemaUncached() { getAsJsonSchemaUncached() {
return { return {
oneOf: [{ oneOf: [
{
type: "null", type: "null",
}, },
this.wrapped.getAsJsonSchema(), this.wrapped.getAsJsonSchema(),

View File

@ -155,7 +155,8 @@ export class KeybindingsState extends TextualGameState {
resetBindings() { resetBindings() {
const { reset } = this.dialogs.showWarning( const { reset } = this.dialogs.showWarning(
T.dialogs.resetKeybindingsConfirmation.title, T.dialogs.resetKeybindingsConfirmation.title,
T.dialogs.resetKeybindingsConfirmation.desc, ["cancel:good", "reset:bad"] T.dialogs.resetKeybindingsConfirmation.desc,
["cancel:good", "reset:bad"]
); );
reset.add(() => { reset.add(() => {