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:
parent
31a6444bfc
commit
9f5ceff0bb
BIN
res/logo.png
BIN
res/logo.png
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 |
@ -1,6 +1,6 @@
|
|||||||
// Removes the unit (px, %, etc) from a value
|
// Removes the unit (px, %, etc) from a value
|
||||||
@function strip-unit($number) {
|
@function strip-unit($number) {
|
||||||
@if type-of($number)=="number" and not unitless($number) {
|
@if type-of($number) == "number" and not unitless($number) {
|
||||||
@return $number / ($number * 0 + 1);
|
@return $number / ($number * 0 + 1);
|
||||||
}
|
}
|
||||||
@return $number;
|
@return $number;
|
||||||
@ -25,13 +25,13 @@
|
|||||||
$impSuffix: "!important";
|
$impSuffix: "!important";
|
||||||
}
|
}
|
||||||
$v1: D($v1);
|
$v1: D($v1);
|
||||||
@if $v2 !="" {
|
@if $v2 != "" {
|
||||||
$v2: D($v2);
|
$v2: D($v2);
|
||||||
}
|
}
|
||||||
@if $v3 !="" {
|
@if $v3 != "" {
|
||||||
$v3: D($v3);
|
$v3: D($v3);
|
||||||
}
|
}
|
||||||
@if $v4 !="" {
|
@if $v4 != "" {
|
||||||
$v4: D($v4);
|
$v4: D($v4);
|
||||||
}
|
}
|
||||||
#{$propName}: #{$v1} #{$v2} #{$v3} #{$v4} #{$impSuffix};
|
#{$propName}: #{$v1} #{$v2} #{$v3} #{$v4} #{$impSuffix};
|
||||||
|
@ -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
|
||||||
*/
|
*/
|
||||||
|
@ -277,7 +277,7 @@
|
|||||||
grid-row: 2 / 3;
|
grid-row: 2 / 3;
|
||||||
@include SuperSmallText;
|
@include SuperSmallText;
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
>span {
|
> span {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@include S(max-width, 140px);
|
@include S(max-width, 140px);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -290,7 +290,7 @@
|
|||||||
@include PlainText;
|
@include PlainText;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
>span {
|
> span {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@include S(max-width, 140px);
|
@include S(max-width, 140px);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@ -429,7 +429,7 @@
|
|||||||
$linkBg: #fdfdff;
|
$linkBg: #fdfdff;
|
||||||
$linkBgHover: darken($linkBg, 2);
|
$linkBgHover: darken($linkBg, 2);
|
||||||
$linkColor: #55586a;
|
$linkColor: #55586a;
|
||||||
>.boxLink {
|
> .boxLink {
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
grid-template-columns: 1fr auto;
|
grid-template-columns: 1fr auto;
|
||||||
@ -470,14 +470,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
>.sidelinks {
|
> .sidelinks {
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
grid-template-rows: 1fr 1fr 1fr;
|
grid-template-rows: 1fr 1fr 1fr;
|
||||||
@include S(grid-gap, 3px);
|
@include S(grid-gap, 3px);
|
||||||
@include S(height, 60px);
|
@include S(height, 60px);
|
||||||
>a {
|
> a {
|
||||||
color: $linkColor;
|
color: $linkColor;
|
||||||
background: $linkBg;
|
background: $linkBg;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -524,8 +524,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
.footer {
|
.footer {
|
||||||
>a,
|
> a,
|
||||||
.sidelinks>a {
|
.sidelinks > a {
|
||||||
background-color: $darkModeControlsBackground;
|
background-color: $darkModeControlsBackground;
|
||||||
color: #eee;
|
color: #eee;
|
||||||
&:hover {
|
&:hover {
|
||||||
@ -534,7 +534,7 @@
|
|||||||
}
|
}
|
||||||
.author {
|
.author {
|
||||||
color: #bdbdbd;
|
color: #bdbdbd;
|
||||||
>a {
|
> a {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,46 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>shapez.io - Build automated factories to build, combine and color shapes!</title>
|
||||||
|
|
||||||
<head>
|
<!-- mobile stuff -->
|
||||||
<title>shapez.io - Build automated factories to build, combine and color shapes!</title>
|
<meta name="format-detection" content="telephone=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="HandheldFriendly" content="true" />
|
||||||
|
<meta name="MobileOptimized" content="320" />
|
||||||
|
<meta name="theme-color" content="#393747" />
|
||||||
|
|
||||||
<!-- mobile stuff -->
|
<!-- seo -->
|
||||||
<meta name="format-detection" content="telephone=no" />
|
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
|
||||||
<meta name="msapplication-tap-highlight" content="no" />
|
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
|
||||||
<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
|
||||||
<meta name="HandheldFriendly" content="true" />
|
name="description"
|
||||||
<meta name="MobileOptimized" content="320" />
|
content="shapez.io is an open-source factory building game about combining and producing different types of shapes."
|
||||||
<meta name="theme-color" content="#393747" />
|
/>
|
||||||
|
<meta
|
||||||
|
name="keywords"
|
||||||
|
content="shapes, .io games, factorio, incremental, upgrades, base building, open source"
|
||||||
|
/>
|
||||||
|
<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:url" content="https://shapez.io/" />
|
||||||
|
<meta property="og:image" content="https://shapez.io/og_thumb.png" />
|
||||||
|
<meta property="og:image:type" content="image/png" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
|
||||||
<!-- seo -->
|
<!-- misc -->
|
||||||
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
|
<meta http-equiv="Cache-Control" content="private, max-age=0, no-store, no-cache, must-revalidate" />
|
||||||
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
|
<meta http-equiv="Expires" content="0" />
|
||||||
<meta name="description" content="shapez.io is an open-source factory building game about combining and producing different types of shapes." />
|
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
||||||
<meta name="keywords" content="shapes, .io games, factorio, incremental, upgrades, base building, open source" />
|
<link rel="canonical" href="https://shapez.io" />
|
||||||
<meta property="og:title" content="shapez.io" />
|
</head>
|
||||||
<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:image" content="https://shapez.io/og_thumb.png" />
|
|
||||||
<meta property="og:image:type" content="image/png" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
|
|
||||||
<!-- misc -->
|
|
||||||
<meta http-equiv="Cache-Control" content="private, max-age=0, no-store, no-cache, must-revalidate" />
|
|
||||||
<meta http-equiv="Expires" content="0" />
|
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
|
|
||||||
<link rel="canonical" href="https://shapez.io" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body oncontextmenu="return false" style="background: #393747"></body>
|
|
||||||
|
|
||||||
|
<body oncontextmenu="return false" style="background: #393747;"></body>
|
||||||
</html>
|
</html>
|
@ -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: [
|
||||||
|
@ -20,7 +20,7 @@ function initAssert() {
|
|||||||
* @param {Boolean} condition
|
* @param {Boolean} condition
|
||||||
* @param {...String} failureMessage
|
* @param {...String} failureMessage
|
||||||
*/
|
*/
|
||||||
window.assert = function(condition, ...failureMessage) {
|
window.assert = function (condition, ...failureMessage) {
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
logger.error("assertion failed:", ...failureMessage);
|
logger.error("assertion failed:", ...failureMessage);
|
||||||
if (!assertionErrorShown) {
|
if (!assertionErrorShown) {
|
||||||
|
@ -107,10 +107,10 @@ export class BackgroundResourcesLoader {
|
|||||||
internalStartLoadingEssentialsForBareGame() {
|
internalStartLoadingEssentialsForBareGame() {
|
||||||
logger.log("⏰ Start load: bare game");
|
logger.log("⏰ Start load: bare game");
|
||||||
this.internalLoadSpritesAndSounds(
|
this.internalLoadSpritesAndSounds(
|
||||||
essentialBareGameSprites,
|
essentialBareGameSprites,
|
||||||
essentialBareGameSounds,
|
essentialBareGameSounds,
|
||||||
essentialBareGameAtlases
|
essentialBareGameAtlases
|
||||||
)
|
)
|
||||||
.then(() => this.internalPreloadCss("async-resources.scss"))
|
.then(() => this.internalPreloadCss("async-resources.scss"))
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.warn("⏰ Failed to load essentials for bare game:", err);
|
logger.warn("⏰ Failed to load essentials for bare game:", err);
|
||||||
@ -174,13 +174,13 @@ export class BackgroundResourcesLoader {
|
|||||||
this.soundsLoaded.push(sounds[i]);
|
this.soundsLoaded.push(sounds[i]);
|
||||||
promises.push(
|
promises.push(
|
||||||
this.app.sound
|
this.app.sound
|
||||||
.loadSound(sounds[i])
|
.loadSound(sounds[i])
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.warn("Failed to load sound:", sounds[i]);
|
logger.warn("Failed to load sound:", sounds[i]);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.numAssetsLoaded++;
|
this.numAssetsLoaded++;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,12 +192,12 @@ export class BackgroundResourcesLoader {
|
|||||||
this.spritesLoaded.push(sprites[i]);
|
this.spritesLoaded.push(sprites[i]);
|
||||||
promises.push(
|
promises.push(
|
||||||
Loader.preloadCSSSprite(sprites[i])
|
Loader.preloadCSSSprite(sprites[i])
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.warn("Failed to load css sprite:", sprites[i]);
|
logger.warn("Failed to load css sprite:", sprites[i]);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.numAssetsLoaded++;
|
this.numAssetsLoaded++;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,28 +205,28 @@ export class BackgroundResourcesLoader {
|
|||||||
const atlas = atlases[i];
|
const atlas = atlases[i];
|
||||||
promises.push(
|
promises.push(
|
||||||
Loader.preloadAtlas(atlas)
|
Loader.preloadAtlas(atlas)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
logger.warn("Failed to load atlas:", atlas.sourceFileName);
|
logger.warn("Failed to load atlas:", atlas.sourceFileName);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.numAssetsLoaded++;
|
this.numAssetsLoaded++;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
Promise.all(promises)
|
Promise.all(promises)
|
||||||
|
|
||||||
// // Remove some pressure by waiting a bit
|
// // Remove some pressure by waiting a bit
|
||||||
// .then(() => {
|
// .then(() => {
|
||||||
// return new Promise(resolve => {
|
// return new Promise(resolve => {
|
||||||
// setTimeout(resolve, 200);
|
// setTimeout(resolve, 200);
|
||||||
// });
|
// });
|
||||||
// })
|
// })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.numAssetsToLoadTotal = 0;
|
this.numAssetsToLoadTotal = 0;
|
||||||
this.numAssetsLoaded = 0;
|
this.numAssetsLoaded = 0;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@ import { Rectangle } from "./rectangle";
|
|||||||
const logger = createLogger("draw_utils");
|
const logger = createLogger("draw_utils");
|
||||||
|
|
||||||
export function initDrawUtils() {
|
export function initDrawUtils() {
|
||||||
CanvasRenderingContext2D.prototype.beginRoundedRect = function(x, y, w, h, r) {
|
CanvasRenderingContext2D.prototype.beginRoundedRect = function (x, y, w, h, r) {
|
||||||
this.beginPath();
|
this.beginPath();
|
||||||
|
|
||||||
if (r < 0.05) {
|
if (r < 0.05) {
|
||||||
@ -28,7 +28,7 @@ export function initDrawUtils() {
|
|||||||
this.arcTo(x, y, x + w, y, r);
|
this.arcTo(x, y, x + w, y, r);
|
||||||
};
|
};
|
||||||
|
|
||||||
CanvasRenderingContext2D.prototype.beginCircle = function(x, y, r) {
|
CanvasRenderingContext2D.prototype.beginCircle = function (x, y, r) {
|
||||||
this.beginPath();
|
this.beginPath();
|
||||||
|
|
||||||
if (r < 0.05) {
|
if (r < 0.05) {
|
||||||
|
@ -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
|
||||||
@ -165,141 +165,141 @@ export class ReadWriteProxy {
|
|||||||
// Start read request
|
// Start read request
|
||||||
return (
|
return (
|
||||||
this.app.storage
|
this.app.storage
|
||||||
.readFileAsync(this.filename)
|
.readFileAsync(this.filename)
|
||||||
|
|
||||||
// Check for errors during read
|
// Check for errors during read
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err === FILE_NOT_FOUND) {
|
if (err === FILE_NOT_FOUND) {
|
||||||
logger.log("File not found, using default data");
|
logger.log("File not found, using default data");
|
||||||
|
|
||||||
// File not found or unreadable, assume default file
|
// File not found or unreadable, assume default file
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject("file-error: " + err);
|
|
||||||
})
|
|
||||||
|
|
||||||
// Decrypt data (if its encrypted)
|
|
||||||
// @ts-ignore
|
|
||||||
.then(rawData => {
|
|
||||||
if (rawData == null) {
|
|
||||||
// So, the file has not been found, use default data
|
|
||||||
return JSON.stringify(compressObject(this.getDefaultData()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawData.startsWith(compressionPrefix)) {
|
|
||||||
const decompressed = decompressX64(rawData.substr(compressionPrefix.length));
|
|
||||||
if (!decompressed) {
|
|
||||||
// LZ string decompression failure
|
|
||||||
return Promise.reject("bad-content / decompression-failed");
|
|
||||||
}
|
|
||||||
if (decompressed.length < 40) {
|
|
||||||
// String too short
|
|
||||||
return Promise.reject("bad-content / payload-too-small");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare stored checksum with actual checksum
|
return Promise.reject("file-error: " + err);
|
||||||
const checksum = decompressed.substring(0, 40);
|
})
|
||||||
const jsonString = decompressed.substr(40);
|
|
||||||
|
|
||||||
const desiredChecksum = checksum.startsWith(CRC_PREFIX) ?
|
// Decrypt data (if its encrypted)
|
||||||
computeCrc(jsonString + salt) :
|
// @ts-ignore
|
||||||
sha1(jsonString + salt);
|
.then(rawData => {
|
||||||
|
if (rawData == null) {
|
||||||
|
// So, the file has not been found, use default data
|
||||||
|
return JSON.stringify(compressObject(this.getDefaultData()));
|
||||||
|
}
|
||||||
|
|
||||||
if (desiredChecksum !== checksum) {
|
if (rawData.startsWith(compressionPrefix)) {
|
||||||
// Checksum mismatch
|
const decompressed = decompressX64(rawData.substr(compressionPrefix.length));
|
||||||
return Promise.reject(
|
if (!decompressed) {
|
||||||
"bad-content / checksum-mismatch: " + desiredChecksum + " vs " + checksum
|
// LZ string decompression failure
|
||||||
|
return Promise.reject("bad-content / decompression-failed");
|
||||||
|
}
|
||||||
|
if (decompressed.length < 40) {
|
||||||
|
// String too short
|
||||||
|
return Promise.reject("bad-content / payload-too-small");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare stored checksum with actual checksum
|
||||||
|
const checksum = decompressed.substring(0, 40);
|
||||||
|
const jsonString = decompressed.substr(40);
|
||||||
|
|
||||||
|
const desiredChecksum = checksum.startsWith(CRC_PREFIX)
|
||||||
|
? computeCrc(jsonString + salt)
|
||||||
|
: sha1(jsonString + salt);
|
||||||
|
|
||||||
|
if (desiredChecksum !== checksum) {
|
||||||
|
// Checksum mismatch
|
||||||
|
return Promise.reject(
|
||||||
|
"bad-content / checksum-mismatch: " + desiredChecksum + " vs " + checksum
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return jsonString;
|
||||||
|
} else {
|
||||||
|
if (!G_IS_DEV) {
|
||||||
|
return Promise.reject("bad-content / missing-compression");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return rawData;
|
||||||
|
})
|
||||||
|
|
||||||
|
// Parse JSON, this could throw but that's fine
|
||||||
|
.then(res => {
|
||||||
|
try {
|
||||||
|
return JSON.parse(res);
|
||||||
|
} catch (ex) {
|
||||||
|
logger.error(
|
||||||
|
"Failed to parse file content of",
|
||||||
|
this.filename,
|
||||||
|
":",
|
||||||
|
ex,
|
||||||
|
"(content was:",
|
||||||
|
res,
|
||||||
|
")"
|
||||||
);
|
);
|
||||||
|
throw new Error("invalid-serialized-data");
|
||||||
}
|
}
|
||||||
return jsonString;
|
})
|
||||||
} else {
|
|
||||||
if (!G_IS_DEV) {
|
// Decompress
|
||||||
return Promise.reject("bad-content / missing-compression");
|
.then(compressed => decompressObject(compressed))
|
||||||
|
|
||||||
|
// Verify basic structure
|
||||||
|
.then(contents => {
|
||||||
|
const result = this.internalVerifyBasicStructure(contents);
|
||||||
|
if (!result.isGood()) {
|
||||||
|
return Promise.reject("verify-failed: " + result.reason);
|
||||||
}
|
}
|
||||||
}
|
return contents;
|
||||||
return rawData;
|
})
|
||||||
})
|
|
||||||
|
|
||||||
// Parse JSON, this could throw but that's fine
|
// Check version and migrate if required
|
||||||
.then(res => {
|
.then(contents => {
|
||||||
try {
|
if (contents.version > this.getCurrentVersion()) {
|
||||||
return JSON.parse(res);
|
return Promise.reject("stored-data-is-newer");
|
||||||
} catch (ex) {
|
|
||||||
logger.error(
|
|
||||||
"Failed to parse file content of",
|
|
||||||
this.filename,
|
|
||||||
":",
|
|
||||||
ex,
|
|
||||||
"(content was:",
|
|
||||||
res,
|
|
||||||
")"
|
|
||||||
);
|
|
||||||
throw new Error("invalid-serialized-data");
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Decompress
|
|
||||||
.then(compressed => decompressObject(compressed))
|
|
||||||
|
|
||||||
// Verify basic structure
|
|
||||||
.then(contents => {
|
|
||||||
const result = this.internalVerifyBasicStructure(contents);
|
|
||||||
if (!result.isGood()) {
|
|
||||||
return Promise.reject("verify-failed: " + result.reason);
|
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
})
|
|
||||||
|
|
||||||
// Check version and migrate if required
|
|
||||||
.then(contents => {
|
|
||||||
if (contents.version > this.getCurrentVersion()) {
|
|
||||||
return Promise.reject("stored-data-is-newer");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contents.version < this.getCurrentVersion()) {
|
|
||||||
logger.log(
|
|
||||||
"Trying to migrate data object from version",
|
|
||||||
contents.version,
|
|
||||||
"to",
|
|
||||||
this.getCurrentVersion()
|
|
||||||
);
|
|
||||||
const migrationResult = this.migrate(contents); // modify in place
|
|
||||||
if (migrationResult.isBad()) {
|
|
||||||
return Promise.reject("migration-failed: " + migrationResult.reason);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return contents;
|
|
||||||
})
|
|
||||||
|
|
||||||
// Verify
|
if (contents.version < this.getCurrentVersion()) {
|
||||||
.then(contents => {
|
logger.log(
|
||||||
const verifyResult = this.internalVerifyEntry(contents);
|
"Trying to migrate data object from version",
|
||||||
if (!verifyResult.result) {
|
contents.version,
|
||||||
logger.error(
|
"to",
|
||||||
"Read invalid data from",
|
this.getCurrentVersion()
|
||||||
this.filename,
|
);
|
||||||
"reason:",
|
const migrationResult = this.migrate(contents); // modify in place
|
||||||
verifyResult.reason,
|
if (migrationResult.isBad()) {
|
||||||
"contents:",
|
return Promise.reject("migration-failed: " + migrationResult.reason);
|
||||||
contents
|
}
|
||||||
);
|
}
|
||||||
return Promise.reject("invalid-data: " + verifyResult.reason);
|
return contents;
|
||||||
}
|
})
|
||||||
return contents;
|
|
||||||
})
|
|
||||||
|
|
||||||
// Store
|
// Verify
|
||||||
.then(contents => {
|
.then(contents => {
|
||||||
this.currentData = contents;
|
const verifyResult = this.internalVerifyEntry(contents);
|
||||||
logger.log("📄 Read data with version", this.currentData.version, "from", this.filename);
|
if (!verifyResult.result) {
|
||||||
return contents;
|
logger.error(
|
||||||
})
|
"Read invalid data from",
|
||||||
|
this.filename,
|
||||||
|
"reason:",
|
||||||
|
verifyResult.reason,
|
||||||
|
"contents:",
|
||||||
|
contents
|
||||||
|
);
|
||||||
|
return Promise.reject("invalid-data: " + verifyResult.reason);
|
||||||
|
}
|
||||||
|
return contents;
|
||||||
|
})
|
||||||
|
|
||||||
// Catchall
|
// Store
|
||||||
.catch(err => {
|
.then(contents => {
|
||||||
return Promise.reject("Failed to read " + this.filename + ": " + err);
|
this.currentData = contents;
|
||||||
})
|
logger.log("📄 Read data with version", this.currentData.version, "from", this.filename);
|
||||||
|
return contents;
|
||||||
|
})
|
||||||
|
|
||||||
|
// Catchall
|
||||||
|
.catch(err => {
|
||||||
|
return Promise.reject("Failed to read " + this.filename + ": " + err);
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -334,9 +334,9 @@ export function formatBigNumberFull(num, divider = T.global.thousandsDivider) {
|
|||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
export function waitNextFrame() {
|
export function waitNextFrame() {
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function (resolve) {
|
||||||
window.requestAnimationFrame(function() {
|
window.requestAnimationFrame(function () {
|
||||||
window.requestAnimationFrame(function() {
|
window.requestAnimationFrame(function () {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -573,12 +573,12 @@ 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 : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,7 +33,7 @@ export const gBuildingVariants = {
|
|||||||
*/
|
*/
|
||||||
export function registerBuildingVariant(
|
export function registerBuildingVariant(
|
||||||
meta,
|
meta,
|
||||||
variant = "default" /* @TODO: Circular dependency, actually its defaultBuildingVariant */ ,
|
variant = "default" /* @TODO: Circular dependency, actually its defaultBuildingVariant */,
|
||||||
rotationVariant = 0
|
rotationVariant = 0
|
||||||
) {
|
) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -117,33 +117,34 @@ export class MetaAnalyzerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaAnalyzerBuilding.setupEntityComponents = [
|
MetaAnalyzerBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.left,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.right,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.right,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.bottom,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.bottom,
|
||||||
},
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new LogicGateComponent({
|
new LogicGateComponent({
|
||||||
type: enumLogicGateType.analyzer,
|
type: enumLogicGateType.analyzer,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaAnalyzerBuilding.silhouetteColors = {
|
MetaAnalyzerBuilding.silhouetteColors = {
|
||||||
@ -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,
|
||||||
|
@ -130,27 +130,27 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaBalancerBuilding.setupEntityComponents = [
|
MetaBalancerBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [], // set later
|
slots: [], // set later
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
processorType: enumItemProcessorTypes.balancer,
|
processorType: enumItemProcessorTypes.balancer,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [], // set later
|
slots: [], // set later
|
||||||
renderFloatingItems: false,
|
renderFloatingItems: false,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
entity => entity.addComponent(new BeltUnderlaysComponent({ underlays: [] })),
|
entity => entity.addComponent(new BeltUnderlaysComponent({ underlays: [] })),
|
||||||
];
|
];
|
||||||
@ -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),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
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),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
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,
|
||||||
},
|
},
|
||||||
|
@ -138,43 +138,35 @@ 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: {
|
||||||
}
|
return Loader.getSprite("sprites/buildings/belt_right.png");
|
||||||
case enumDirection.right:
|
}
|
||||||
{
|
default: {
|
||||||
return Loader.getSprite("sprites/buildings/belt_right.png");
|
assertAlways(false, "Invalid belt rotation variant");
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
{
|
|
||||||
assertAlways(false, "Invalid belt rotation variant");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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: {
|
||||||
}
|
return Loader.getSprite("sprites/blueprints/belt_right.png");
|
||||||
case enumDirection.right:
|
}
|
||||||
{
|
default: {
|
||||||
return Loader.getSprite("sprites/blueprints/belt_right.png");
|
assertAlways(false, "Invalid belt rotation variant");
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
{
|
|
||||||
assertAlways(false, "Invalid belt rotation variant");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,11 +292,11 @@ export class MetaBeltBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaBeltBuilding.setupEntityComponents = [
|
MetaBeltBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new BeltComponent({
|
new BeltComponent({
|
||||||
direction: enumDirection.top, // updated later
|
direction: enumDirection.top, // updated later
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaBeltBuilding.silhouetteColors = {
|
MetaBeltBuilding.silhouetteColors = {
|
||||||
|
@ -118,32 +118,33 @@ export class MetaComparatorBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaComparatorBuilding.setupEntityComponents = [
|
MetaComparatorBuilding.setupEntityComponents = [
|
||||||
(entity, rotationVariant) =>
|
(entity, rotationVariant) =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.left,
|
||||||
},
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.right,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.right,
|
||||||
},
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
(entity, rotationVariant) =>
|
(entity, rotationVariant) =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new LogicGateComponent({
|
new LogicGateComponent({
|
||||||
type: enumLogicGateType.compare,
|
type: enumLogicGateType.compare,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaComparatorBuilding.overlayMatrices = {
|
MetaComparatorBuilding.overlayMatrices = {
|
||||||
@ -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,
|
||||||
|
@ -118,15 +118,17 @@ export class MetaConstantSignalBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaConstantSignalBuilding.setupEntityComponents = [
|
MetaConstantSignalBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
}, ],
|
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),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
}, ]);
|
type: enumPinSlotType.logicalEjector,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -89,23 +89,25 @@ export class MetaCutterBuilding extends MetaBuilding {
|
|||||||
}
|
}
|
||||||
MetaCutterBuilding.setupEntityComponents = [
|
MetaCutterBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
processorType: enumItemProcessorTypes.cutter,
|
processorType: enumItemProcessorTypes.cutter,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity => entity.addComponent(new ItemEjectorComponent({})),
|
entity => entity.addComponent(new ItemEjectorComponent({})),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
}, ],
|
filter: "shape",
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaCutterBuilding.variants = {
|
MetaCutterBuilding.variants = {
|
||||||
|
@ -105,15 +105,17 @@ export class MetaDisplayBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaDisplayBuilding.setupEntityComponents = [
|
MetaDisplayBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.bottom,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.bottom,
|
||||||
}, ],
|
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),
|
{
|
||||||
direction: enumDirection.bottom,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.bottom,
|
||||||
}, ]);
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -130,40 +130,45 @@ export class MetaFilterBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaFilterBuilding.setupEntityComponents = [
|
MetaFilterBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.left,
|
||||||
}, ],
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ],
|
directions: [enumDirection.bottom],
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
},
|
direction: enumDirection.top,
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
direction: enumDirection.right,
|
pos: new Vector(1, 0),
|
||||||
},
|
direction: enumDirection.right,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity => entity.addComponent(new FilterComponent()),
|
entity => entity.addComponent(new FilterComponent()),
|
||||||
];
|
];
|
||||||
@ -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),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.left,
|
||||||
}, ]);
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
entity.components.ItemAcceptor.setSlots([{
|
entity.components.ItemAcceptor.setSlots([
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
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,
|
||||||
},
|
},
|
||||||
|
@ -122,100 +122,103 @@ MetaHubBuilding.canPipet = () => false;
|
|||||||
MetaHubBuilding.setupEntityComponents = [
|
MetaHubBuilding.setupEntityComponents = [
|
||||||
entity => entity.addComponent(new HubComponent()),
|
entity => entity.addComponent(new HubComponent()),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
processorType: enumItemProcessorTypes.hub,
|
processorType: enumItemProcessorTypes.hub,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 2),
|
{
|
||||||
type: enumPinSlotType.logicalEjector,
|
pos: new Vector(0, 2),
|
||||||
direction: enumDirection.left,
|
type: enumPinSlotType.logicalEjector,
|
||||||
}, ],
|
direction: enumDirection.left,
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.top, enumDirection.left],
|
pos: new Vector(0, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.top, enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
directions: [enumDirection.top],
|
pos: new Vector(1, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.top],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(2, 0),
|
{
|
||||||
directions: [enumDirection.top],
|
pos: new Vector(2, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.top],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(3, 0),
|
{
|
||||||
directions: [enumDirection.top, enumDirection.right],
|
pos: new Vector(3, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.top, enumDirection.right],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 3),
|
{
|
||||||
directions: [enumDirection.bottom, enumDirection.left],
|
pos: new Vector(0, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom, enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 3),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(1, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(2, 3),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(2, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(3, 3),
|
{
|
||||||
directions: [enumDirection.bottom, enumDirection.right],
|
pos: new Vector(3, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom, enumDirection.right],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 1),
|
{
|
||||||
directions: [enumDirection.left],
|
pos: new Vector(0, 1),
|
||||||
filter: "shape",
|
directions: [enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 2),
|
{
|
||||||
directions: [enumDirection.left],
|
pos: new Vector(0, 2),
|
||||||
filter: "shape",
|
directions: [enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 3),
|
{
|
||||||
directions: [enumDirection.left],
|
pos: new Vector(0, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(3, 1),
|
{
|
||||||
directions: [enumDirection.right],
|
pos: new Vector(3, 1),
|
||||||
filter: "shape",
|
directions: [enumDirection.right],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(3, 2),
|
{
|
||||||
directions: [enumDirection.right],
|
pos: new Vector(3, 2),
|
||||||
filter: "shape",
|
directions: [enumDirection.right],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(3, 3),
|
{
|
||||||
directions: [enumDirection.right],
|
pos: new Vector(3, 3),
|
||||||
filter: "shape",
|
directions: [enumDirection.right],
|
||||||
},
|
filter: "shape",
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaHubBuilding.silhouetteColors = {
|
MetaHubBuilding.silhouetteColors = {
|
||||||
@ -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),
|
{
|
||||||
type: enumPinSlotType.logicalEjector,
|
pos: new Vector(0, 2),
|
||||||
direction: enumDirection.left,
|
type: enumPinSlotType.logicalEjector,
|
||||||
}, ]);
|
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",
|
||||||
|
@ -98,21 +98,23 @@ export class MetaItemProducerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaItemProducerBuilding.setupEntityComponents = [
|
MetaItemProducerBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
pos: new Vector(0, 0),
|
||||||
direction: enumDirection.bottom,
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
}, ],
|
direction: enumDirection.bottom,
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
|
|
||||||
entity => entity.addComponent(new ItemProducerComponent()),
|
entity => entity.addComponent(new ItemProducerComponent()),
|
||||||
];
|
];
|
||||||
@ -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),
|
{
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
pos: new Vector(0, 0),
|
||||||
direction: enumDirection.bottom,
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
}, ]);
|
direction: enumDirection.bottom,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -121,15 +121,17 @@ export class MetaLeverBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaLeverBuilding.setupEntityComponents = [
|
MetaLeverBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
}, ],
|
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),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
}, ]);
|
type: enumPinSlotType.logicalEjector,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -117,11 +117,11 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
|||||||
}
|
}
|
||||||
MetaLogicGateBuilding.setupEntityComponents = [
|
MetaLogicGateBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [],
|
slots: [],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity => entity.addComponent(new LogicGateComponent({})),
|
entity => entity.addComponent(new LogicGateComponent({})),
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -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,
|
||||||
|
@ -115,11 +115,11 @@ export class MetaMinerBuilding extends MetaBuilding {
|
|||||||
MetaMinerBuilding.setupEntityComponents = [
|
MetaMinerBuilding.setupEntityComponents = [
|
||||||
entity => entity.addComponent(new MinerComponent({})),
|
entity => entity.addComponent(new MinerComponent({})),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
MetaMinerBuilding.variants = {
|
MetaMinerBuilding.variants = {
|
||||||
chainable: "chainable",
|
chainable: "chainable",
|
||||||
|
@ -115,35 +115,36 @@ export class MetaMixerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaMixerBuilding.setupEntityComponents = [
|
MetaMixerBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 2,
|
inputsPerCharge: 2,
|
||||||
processorType: enumItemProcessorTypes.mixer,
|
processorType: enumItemProcessorTypes.mixer,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
filter: "color",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "color",
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(1, 0),
|
||||||
filter: "color",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "color",
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaMixerBuilding.silhouetteColors = {
|
MetaMixerBuilding.silhouetteColors = {
|
||||||
@ -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",
|
||||||
|
@ -121,27 +121,28 @@ export class MetaPainterBuilding extends MetaBuilding {
|
|||||||
MetaPainterBuilding.setupEntityComponents = [
|
MetaPainterBuilding.setupEntityComponents = [
|
||||||
entity => entity.addComponent(new ItemProcessorComponent({})),
|
entity => entity.addComponent(new ItemProcessorComponent({})),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(1, 0), direction: enumDirection.right }],
|
slots: [{ pos: new Vector(1, 0), direction: enumDirection.right }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.left],
|
pos: new Vector(0, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.left],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
directions: [enumDirection.top],
|
pos: new Vector(1, 0),
|
||||||
filter: "color",
|
directions: [enumDirection.top],
|
||||||
},
|
filter: "color",
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaPainterBuilding.variants = {
|
MetaPainterBuilding.variants = {
|
||||||
@ -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",
|
||||||
|
@ -132,55 +132,62 @@ export class MetaReaderBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaReaderBuilding.setupEntityComponents = [
|
MetaReaderBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.right,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.right,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.left,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ],
|
directions: [enumDirection.bottom],
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
}, ],
|
direction: enumDirection.top,
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
processorType: enumItemProcessorTypes.reader,
|
processorType: enumItemProcessorTypes.reader,
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new BeltUnderlaysComponent({
|
new BeltUnderlaysComponent({
|
||||||
underlays: [{
|
underlays: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
}, ],
|
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),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
directions: [enumDirection.bottom],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
entity.components.ItemEjector.setSlots([{
|
entity.components.ItemEjector.setSlots([
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
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),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
}, ];
|
direction: enumDirection.top,
|
||||||
|
},
|
||||||
|
];
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -129,28 +129,30 @@ export class MetaRotaterBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaRotaterBuilding.setupEntityComponents = [
|
MetaRotaterBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
processorType: enumItemProcessorTypes.rotater,
|
processorType: enumItemProcessorTypes.rotater,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
}, ],
|
filter: "shape",
|
||||||
})
|
},
|
||||||
),
|
],
|
||||||
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaRotaterBuilding.variants = {
|
MetaRotaterBuilding.variants = {
|
||||||
|
@ -129,34 +129,35 @@ export class MetaStackerBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaStackerBuilding.setupEntityComponents = [
|
MetaStackerBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 2,
|
inputsPerCharge: 2,
|
||||||
processorType: enumItemProcessorTypes.stacker,
|
processorType: enumItemProcessorTypes.stacker,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "shape",
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(1, 0),
|
||||||
filter: "shape",
|
directions: [enumDirection.bottom],
|
||||||
},
|
filter: "shape",
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaStackerBuilding.dimensions = {
|
MetaStackerBuilding.dimensions = {
|
||||||
@ -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",
|
||||||
|
@ -132,56 +132,59 @@ export class MetaStorageBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaStorageBuilding.setupEntityComponents = [
|
MetaStorageBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
// 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),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
},
|
direction: enumDirection.top,
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(1, 0),
|
||||||
},
|
direction: enumDirection.top,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 1),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 1),
|
||||||
},
|
directions: [enumDirection.bottom],
|
||||||
{
|
},
|
||||||
pos: new Vector(1, 1),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(1, 1),
|
||||||
},
|
directions: [enumDirection.bottom],
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new StorageComponent({
|
new StorageComponent({
|
||||||
maximumStorage: storageSize,
|
maximumStorage: storageSize,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(1, 1),
|
{
|
||||||
direction: enumDirection.right,
|
pos: new Vector(1, 1),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.right,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 1),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 1),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.left,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaStorageBuilding.dimensions = {
|
MetaStorageBuilding.dimensions = {
|
||||||
@ -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,
|
||||||
|
@ -118,32 +118,33 @@ export class MetaTransistorBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaTransistorBuilding.setupEntityComponents = [
|
MetaTransistorBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalEjector,
|
direction: enumDirection.top,
|
||||||
},
|
type: enumPinSlotType.logicalEjector,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.left,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.left,
|
||||||
},
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
{
|
},
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
direction: enumDirection.bottom,
|
pos: new Vector(0, 0),
|
||||||
type: enumPinSlotType.logicalAcceptor,
|
direction: enumDirection.bottom,
|
||||||
},
|
type: enumPinSlotType.logicalAcceptor,
|
||||||
],
|
},
|
||||||
})
|
],
|
||||||
),
|
})
|
||||||
|
),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new LogicGateComponent({
|
new LogicGateComponent({
|
||||||
type: enumLogicGateType.transistor,
|
type: enumLogicGateType.transistor,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaTransistorBuilding.variants = {
|
MetaTransistorBuilding.variants = {
|
||||||
|
@ -120,26 +120,28 @@ export class MetaTrashBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaTrashBuilding.setupEntityComponents = [
|
MetaTrashBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [{
|
slots: [
|
||||||
pos: new Vector(0, 0),
|
{
|
||||||
directions: [
|
pos: new Vector(0, 0),
|
||||||
enumDirection.top,
|
directions: [
|
||||||
enumDirection.right,
|
enumDirection.top,
|
||||||
enumDirection.bottom,
|
enumDirection.right,
|
||||||
enumDirection.left,
|
enumDirection.bottom,
|
||||||
|
enumDirection.left,
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}, ],
|
})
|
||||||
})
|
),
|
||||||
),
|
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemProcessorComponent({
|
new ItemProcessorComponent({
|
||||||
inputsPerCharge: 1,
|
inputsPerCharge: 1,
|
||||||
processorType: enumItemProcessorTypes.trash,
|
processorType: enumItemProcessorTypes.trash,
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaTrashBuilding.overlayMatrices = {
|
MetaTrashBuilding.overlayMatrices = {
|
||||||
@ -182,15 +184,17 @@ 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),
|
{
|
||||||
directions: [
|
pos: new Vector(0, 0),
|
||||||
enumDirection.top,
|
directions: [
|
||||||
enumDirection.right,
|
enumDirection.top,
|
||||||
enumDirection.bottom,
|
enumDirection.right,
|
||||||
enumDirection.left,
|
enumDirection.bottom,
|
||||||
],
|
enumDirection.left,
|
||||||
}, ]);
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
entity.components.ItemProcessor.inputsPerCharge = 1;
|
entity.components.ItemProcessor.inputsPerCharge = 1;
|
||||||
|
|
||||||
|
@ -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);
|
||||||
@ -245,18 +246,18 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
|||||||
MetaUndergroundBeltBuilding.setupEntityComponents = [
|
MetaUndergroundBeltBuilding.setupEntityComponents = [
|
||||||
// Required, since the item processor needs this.
|
// Required, since the item processor needs this.
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemEjectorComponent({
|
new ItemEjectorComponent({
|
||||||
slots: [],
|
slots: [],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity => entity.addComponent(new UndergroundBeltComponent({})),
|
entity => entity.addComponent(new UndergroundBeltComponent({})),
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new ItemAcceptorComponent({
|
new ItemAcceptorComponent({
|
||||||
slots: [],
|
slots: [],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
MetaUndergroundBeltBuilding.rotationVariants = [0, 1];
|
MetaUndergroundBeltBuilding.rotationVariants = [0, 1];
|
||||||
@ -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),
|
{
|
||||||
directions: [enumDirection.bottom],
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
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),
|
{
|
||||||
direction: enumDirection.top,
|
pos: new Vector(0, 0),
|
||||||
}, ]);
|
direction: enumDirection.top,
|
||||||
|
},
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -121,11 +121,11 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
|
|||||||
|
|
||||||
MetaVirtualProcessorBuilding.setupEntityComponents = [
|
MetaVirtualProcessorBuilding.setupEntityComponents = [
|
||||||
entity =>
|
entity =>
|
||||||
entity.addComponent(
|
entity.addComponent(
|
||||||
new WiredPinsComponent({
|
new WiredPinsComponent({
|
||||||
slots: [],
|
slots: [],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
entity => entity.addComponent(new LogicGateComponent({})),
|
entity => entity.addComponent(new LogicGateComponent({})),
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -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,
|
||||||
|
@ -151,26 +151,21 @@ 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: {
|
||||||
}
|
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png");
|
||||||
case enumWireType.split:
|
}
|
||||||
{
|
case enumWireType.cross: {
|
||||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png");
|
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png");
|
||||||
}
|
}
|
||||||
case enumWireType.cross:
|
default: {
|
||||||
{
|
assertAlways(false, "Invalid wire rotation variant");
|
||||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png");
|
}
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
assertAlways(false, "Invalid wire rotation variant");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +66,16 @@ 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);
|
||||||
{
|
const arcProgress = (progress / BeltComponent.curvedBeltLength) * 0.5 * Math.PI;
|
||||||
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 3: " + progress);
|
return new Vector(-0.5 + 0.5 * Math.cos(arcProgress), 0.5 - 0.5 * Math.sin(arcProgress));
|
||||||
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));
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
assertAlways(false, "Invalid belt direction: " + this.direction);
|
assertAlways(false, "Invalid belt direction: " + this.direction);
|
||||||
return new Vector(0, 0);
|
return new Vector(0, 0);
|
||||||
|
@ -201,38 +201,34 @@ 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;
|
||||||
{
|
y = this.origin.y;
|
||||||
x = this.origin.x - size.y + 1;
|
w = size.y;
|
||||||
y = this.origin.y;
|
h = size.x;
|
||||||
w = size.y;
|
break;
|
||||||
h = size.x;
|
}
|
||||||
break;
|
case 180: {
|
||||||
}
|
x = this.origin.x - size.x + 1;
|
||||||
case 180:
|
y = this.origin.y - size.y + 1;
|
||||||
{
|
w = size.x;
|
||||||
x = this.origin.x - size.x + 1;
|
h = size.y;
|
||||||
y = this.origin.y - size.y + 1;
|
break;
|
||||||
w = size.x;
|
}
|
||||||
h = size.y;
|
case 270: {
|
||||||
break;
|
x = this.origin.x;
|
||||||
}
|
y = this.origin.y - size.x + 1;
|
||||||
case 270:
|
w = size.y;
|
||||||
{
|
h = size.x;
|
||||||
x = this.origin.x;
|
break;
|
||||||
y = this.origin.y - size.x + 1;
|
}
|
||||||
w = size.y;
|
|
||||||
h = size.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
assert(false, "Invalid rotation");
|
assert(false, "Invalid rotation");
|
||||||
}
|
}
|
||||||
@ -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
|
||||||
|
@ -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);
|
||||||
@ -521,11 +523,11 @@ export class GameCore {
|
|||||||
context.fillStyle = "blue";
|
context.fillStyle = "blue";
|
||||||
context.fillText(
|
context.fillText(
|
||||||
"Atlas: " +
|
"Atlas: " +
|
||||||
desiredAtlasScale +
|
desiredAtlasScale +
|
||||||
" / Zoom: " +
|
" / Zoom: " +
|
||||||
round2Digits(zoomLevel) +
|
round2Digits(zoomLevel) +
|
||||||
" / Effective Zoom: " +
|
" / Effective Zoom: " +
|
||||||
round2Digits(effectiveZoomLevel),
|
round2Digits(effectiveZoomLevel),
|
||||||
20,
|
20,
|
||||||
600
|
600
|
||||||
);
|
);
|
||||||
@ -534,31 +536,31 @@ export class GameCore {
|
|||||||
|
|
||||||
context.fillText(
|
context.fillText(
|
||||||
"Maintained Buffers: " +
|
"Maintained Buffers: " +
|
||||||
stats.rootKeys +
|
stats.rootKeys +
|
||||||
" root keys / " +
|
" root keys / " +
|
||||||
stats.subKeys +
|
stats.subKeys +
|
||||||
" buffers / VRAM: " +
|
" buffers / VRAM: " +
|
||||||
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
||||||
" MB",
|
" MB",
|
||||||
20,
|
20,
|
||||||
620
|
620
|
||||||
);
|
);
|
||||||
const internalStats = getBufferStats();
|
const internalStats = getBufferStats();
|
||||||
context.fillText(
|
context.fillText(
|
||||||
"Total Buffers: " +
|
"Total Buffers: " +
|
||||||
internalStats.bufferCount +
|
internalStats.bufferCount +
|
||||||
" buffers / " +
|
" buffers / " +
|
||||||
internalStats.backlogSize +
|
internalStats.backlogSize +
|
||||||
" backlog / " +
|
" backlog / " +
|
||||||
internalStats.backlogKeys +
|
internalStats.backlogKeys +
|
||||||
" keys in backlog / VRAM " +
|
" keys in backlog / VRAM " +
|
||||||
round2Digits(internalStats.vramUsage / (1024 * 1024)) +
|
round2Digits(internalStats.vramUsage / (1024 * 1024)) +
|
||||||
" MB / Backlog " +
|
" MB / Backlog " +
|
||||||
round2Digits(internalStats.backlogVramUsage / (1024 * 1024)) +
|
round2Digits(internalStats.backlogVramUsage / (1024 * 1024)) +
|
||||||
" MB / Created " +
|
" MB / Created " +
|
||||||
internalStats.numCreated +
|
internalStats.numCreated +
|
||||||
" / Reused " +
|
" / Reused " +
|
||||||
internalStats.numReused,
|
internalStats.numReused,
|
||||||
20,
|
20,
|
||||||
640
|
640
|
||||||
);
|
);
|
||||||
|
@ -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
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -506,13 +507,13 @@ export class HubGoals extends BasicSerializableObject {
|
|||||||
HubGoals.getProcessorBaseSpeed = {
|
HubGoals.getProcessorBaseSpeed = {
|
||||||
trash: processorType => 1e30,
|
trash: processorType => 1e30,
|
||||||
hub: processorType => 1e30,
|
hub: processorType => 1e30,
|
||||||
balancer: function(processorType) {
|
balancer: function (processorType) {
|
||||||
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt * 2;
|
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt * 2;
|
||||||
},
|
},
|
||||||
reader: function(processorType) {
|
reader: function (processorType) {
|
||||||
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt;
|
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt;
|
||||||
},
|
},
|
||||||
mixer: function(processorType) {
|
mixer: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -523,7 +524,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
painter: function(processorType) {
|
painter: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -534,7 +535,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
painterDouble: function(processorType) {
|
painterDouble: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -545,7 +546,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
painterQuad: function(processorType) {
|
painterQuad: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -557,7 +558,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
cutter: function(processorType) {
|
cutter: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -568,7 +569,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
cutterQuad: function(processorType) {
|
cutterQuad: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -579,7 +580,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
rotater: function(processorType) {
|
rotater: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -590,7 +591,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
rotaterCCW: function(processorType) {
|
rotaterCCW: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -601,7 +602,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
rotater180: function(processorType) {
|
rotater180: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
@ -612,7 +613,7 @@ HubGoals.getProcessorBaseSpeed = {
|
|||||||
globalConfig.buildingSpeeds[processorType]
|
globalConfig.buildingSpeeds[processorType]
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
stacker: function(processorType) {
|
stacker: function (processorType) {
|
||||||
assert(
|
assert(
|
||||||
globalConfig.buildingSpeeds[processorType],
|
globalConfig.buildingSpeeds[processorType],
|
||||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||||
|
@ -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);
|
||||||
|
@ -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"], "");
|
||||||
@ -135,9 +136,9 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
|||||||
this.buildingInfoElements.tutorialImage.setAttribute(
|
this.buildingInfoElements.tutorialImage.setAttribute(
|
||||||
"data-icon",
|
"data-icon",
|
||||||
"building_tutorials/" +
|
"building_tutorials/" +
|
||||||
metaBuilding.getId() +
|
metaBuilding.getId() +
|
||||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||||
".png"
|
".png"
|
||||||
);
|
);
|
||||||
|
|
||||||
removeAllChildren(this.buildingInfoElements.additionalInfo);
|
removeAllChildren(this.buildingInfoElements.additionalInfo);
|
||||||
@ -189,14 +190,15 @@ 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'>" +
|
||||||
this.root.keyMapper
|
this.root.keyMapper
|
||||||
.getBinding(KEYMAPPINGS.placement.cycleBuildingVariants)
|
.getBinding(KEYMAPPINGS.placement.cycleBuildingVariants)
|
||||||
.getKeyCodeString() +
|
.getKeyCodeString() +
|
||||||
"</code>"
|
"</code>"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -442,10 +444,12 @@ 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,
|
||||||
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
|
-6,
|
||||||
globalConfig.halfTileSize -
|
-globalConfig.halfTileSize -
|
||||||
6,
|
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
|
||||||
|
globalConfig.halfTileSize -
|
||||||
|
6,
|
||||||
12,
|
12,
|
||||||
12
|
12
|
||||||
);
|
);
|
||||||
@ -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];
|
||||||
@ -529,7 +534,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
|||||||
} else if (
|
} else if (
|
||||||
sourceBeltComp &&
|
sourceBeltComp &&
|
||||||
sourceStaticComp.localDirectionToWorld(sourceBeltComp.direction) ===
|
sourceStaticComp.localDirectionToWorld(sourceBeltComp.direction) ===
|
||||||
enumInvertedDirections[worldDirection]
|
enumInvertedDirections[worldDirection]
|
||||||
) {
|
) {
|
||||||
// Belt connected
|
// Belt connected
|
||||||
isConnected = true;
|
isConnected = true;
|
||||||
|
@ -279,20 +279,20 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
* Tries to rotate the current building
|
* Tries to rotate the current building
|
||||||
*/
|
*/
|
||||||
tryRotate() {
|
tryRotate() {
|
||||||
const selectedBuilding = this.currentMetaBuilding.get();
|
const selectedBuilding = this.currentMetaBuilding.get();
|
||||||
if (selectedBuilding) {
|
if (selectedBuilding) {
|
||||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
||||||
this.currentBaseRotation = (this.currentBaseRotation + 270) % 360;
|
this.currentBaseRotation = (this.currentBaseRotation + 270) % 360;
|
||||||
} else {
|
} else {
|
||||||
this.currentBaseRotation = (this.currentBaseRotation + 90) % 360;
|
this.currentBaseRotation = (this.currentBaseRotation + 90) % 360;
|
||||||
}
|
|
||||||
const staticComp = this.fakeEntity.components.StaticMapEntity;
|
|
||||||
staticComp.rotation = this.currentBaseRotation;
|
|
||||||
}
|
}
|
||||||
|
const staticComp = this.fakeEntity.components.StaticMapEntity;
|
||||||
|
staticComp.rotation = this.currentBaseRotation;
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
* Tries to delete the building under the mouse
|
/**
|
||||||
*/
|
* Tries to delete the building under the mouse
|
||||||
|
*/
|
||||||
deleteBelowCursor() {
|
deleteBelowCursor() {
|
||||||
const mousePosition = this.root.app.mousePosition;
|
const mousePosition = this.root.app.mousePosition;
|
||||||
if (!mousePosition) {
|
if (!mousePosition) {
|
||||||
@ -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];
|
||||||
|
@ -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
|
||||||
);
|
);
|
||||||
|
@ -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>
|
||||||
@ -91,7 +92,7 @@ export class HUDSettingsMenu extends BaseHUDPart {
|
|||||||
|
|
||||||
buildingsPlacedElement.innerText = formatBigNumberFull(
|
buildingsPlacedElement.innerText = formatBigNumberFull(
|
||||||
this.root.entityMgr.getAllWithComponent(StaticMapEntityComponent).length -
|
this.root.entityMgr.getAllWithComponent(StaticMapEntityComponent).length -
|
||||||
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
||||||
);
|
);
|
||||||
|
|
||||||
beltsPlacedElement.innerText = formatBigNumberFull(
|
beltsPlacedElement.innerText = formatBigNumberFull(
|
||||||
@ -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: {
|
||||||
|
@ -44,12 +44,13 @@ export class HUDWaypoints extends BaseHUDPart {
|
|||||||
* @param {HTMLElement} parent
|
* @param {HTMLElement} parent
|
||||||
*/
|
*/
|
||||||
createElements(parent) {
|
createElements(parent) {
|
||||||
// Create the helper box on the lower right when zooming out
|
// Create the helper box on the lower right when zooming out
|
||||||
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(
|
||||||
"<keybinding>",
|
"<keybinding>",
|
||||||
|
@ -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
|
||||||
|
@ -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,
|
||||||
|
@ -93,7 +93,7 @@ export const BOOL_TRUE_SINGLETON = new BooleanItem(1);
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function isTrueItem(item) {
|
export function isTrueItem(item) {
|
||||||
return item && item.getItemType() === "boolean" && !!( /** @type {BooleanItem} */ (item).value);
|
return item && item.getItemType() === "boolean" && !!(/** @type {BooleanItem} */ (item).value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -107,7 +107,7 @@ export function isTruthyItem(item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.getItemType() === "boolean") {
|
if (item.getItemType() === "boolean") {
|
||||||
return !!( /** @type {BooleanItem} */ (item).value);
|
return !!(/** @type {BooleanItem} */ (item).value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -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 {
|
||||||
|
@ -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) {
|
||||||
|
@ -142,9 +142,9 @@ export class MetaBuilding {
|
|||||||
getPreviewSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
getPreviewSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
||||||
return Loader.getSprite(
|
return Loader.getSprite(
|
||||||
"sprites/buildings/" +
|
"sprites/buildings/" +
|
||||||
this.id +
|
this.id +
|
||||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||||
".png"
|
".png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,9 +155,9 @@ export class MetaBuilding {
|
|||||||
getBlueprintSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
getBlueprintSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
||||||
return Loader.getSprite(
|
return Loader.getSprite(
|
||||||
"sprites/blueprints/" +
|
"sprites/blueprints/" +
|
||||||
this.id +
|
this.id +
|
||||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||||
".png"
|
".png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,9 +232,9 @@ export class MetaBuilding {
|
|||||||
getSprite(rotationVariant, variant) {
|
getSprite(rotationVariant, variant) {
|
||||||
return Loader.getSprite(
|
return Loader.getSprite(
|
||||||
"sprites/buildings/" +
|
"sprites/buildings/" +
|
||||||
this.id +
|
this.id +
|
||||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||||
".png"
|
".png"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,115 +321,117 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// DEMO STOPS HERE
|
// DEMO STOPS HERE
|
||||||
...(limitedVersion ?
|
...(limitedVersion
|
||||||
[{
|
? [
|
||||||
shape: "RpRpRpRp:CwCwCwCw",
|
{
|
||||||
required: 0,
|
shape: "RpRpRpRp:CwCwCwCw",
|
||||||
reward: enumHubGoalRewards.reward_demo_end,
|
required: 0,
|
||||||
}, ] :
|
reward: enumHubGoalRewards.reward_demo_end,
|
||||||
[
|
},
|
||||||
// 14
|
]
|
||||||
// Belt reader
|
: [
|
||||||
{
|
// 14
|
||||||
shape: "--Cg----:--Cr----", // unused
|
// Belt reader
|
||||||
required: 8, // Per second!
|
{
|
||||||
reward: enumHubGoalRewards.reward_belt_reader,
|
shape: "--Cg----:--Cr----", // unused
|
||||||
throughputOnly: true,
|
required: 8, // Per second!
|
||||||
},
|
reward: enumHubGoalRewards.reward_belt_reader,
|
||||||
|
throughputOnly: true,
|
||||||
|
},
|
||||||
|
|
||||||
// 15
|
// 15
|
||||||
// Storage
|
// Storage
|
||||||
{
|
{
|
||||||
shape: "SrSrSrSr:CyCyCyCy", // unused
|
shape: "SrSrSrSr:CyCyCyCy", // unused
|
||||||
required: 10000,
|
required: 10000,
|
||||||
reward: enumHubGoalRewards.reward_storage,
|
reward: enumHubGoalRewards.reward_storage,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 16
|
// 16
|
||||||
// Quad Cutter
|
// Quad Cutter
|
||||||
{
|
{
|
||||||
shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", // belts t4 (two variants)
|
shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", // belts t4 (two variants)
|
||||||
required: 6000,
|
required: 6000,
|
||||||
reward: enumHubGoalRewards.reward_cutter_quad,
|
reward: enumHubGoalRewards.reward_cutter_quad,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 17
|
// 17
|
||||||
// Double painter
|
// Double painter
|
||||||
{
|
{
|
||||||
shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
|
shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
|
||||||
required: 20000,
|
required: 20000,
|
||||||
reward: enumHubGoalRewards.reward_painter_double,
|
reward: enumHubGoalRewards.reward_painter_double,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 18
|
// 18
|
||||||
// Rotater (180deg)
|
// Rotater (180deg)
|
||||||
{
|
{
|
||||||
shape: "Sg----Sg:CgCgCgCg:--CyCy--", // unused
|
shape: "Sg----Sg:CgCgCgCg:--CyCy--", // unused
|
||||||
required: 20000,
|
required: 20000,
|
||||||
reward: enumHubGoalRewards.reward_rotater_180,
|
reward: enumHubGoalRewards.reward_rotater_180,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 19
|
// 19
|
||||||
// Compact splitter
|
// Compact splitter
|
||||||
{
|
{
|
||||||
shape: "CpRpCp--:SwSwSwSw",
|
shape: "CpRpCp--:SwSwSwSw",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_splitter,
|
reward: enumHubGoalRewards.reward_splitter,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 20
|
// 20
|
||||||
// WIRES
|
// WIRES
|
||||||
{
|
{
|
||||||
shape: finalGameShape,
|
shape: finalGameShape,
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_wires_painter_and_levers,
|
reward: enumHubGoalRewards.reward_wires_painter_and_levers,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 21
|
// 21
|
||||||
// Filter
|
// Filter
|
||||||
{
|
{
|
||||||
shape: "CrCwCrCw:CwCrCwCr:CrCwCrCw:CwCrCwCr",
|
shape: "CrCwCrCw:CwCrCwCr:CrCwCrCw:CwCrCwCr",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_filter,
|
reward: enumHubGoalRewards.reward_filter,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 22
|
// 22
|
||||||
// Constant signal
|
// Constant signal
|
||||||
{
|
{
|
||||||
shape: "Cg----Cr:Cw----Cw:Sy------:Cy----Cy",
|
shape: "Cg----Cr:Cw----Cw:Sy------:Cy----Cy",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_constant_signal,
|
reward: enumHubGoalRewards.reward_constant_signal,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 23
|
// 23
|
||||||
// Display
|
// Display
|
||||||
{
|
{
|
||||||
shape: "CcSyCcSy:SyCcSyCc:CcSyCcSy",
|
shape: "CcSyCcSy:SyCcSyCc:CcSyCcSy",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_display,
|
reward: enumHubGoalRewards.reward_display,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 24 Logic gates
|
// 24 Logic gates
|
||||||
{
|
{
|
||||||
shape: "CcRcCcRc:RwCwRwCw:Sr--Sw--:CyCyCyCy",
|
shape: "CcRcCcRc:RwCwRwCw:Sr--Sw--:CyCyCyCy",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_logic_gates,
|
reward: enumHubGoalRewards.reward_logic_gates,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 25 Virtual Processing
|
// 25 Virtual Processing
|
||||||
{
|
{
|
||||||
shape: "Rg--Rg--:CwRwCwRw:--Rg--Rg",
|
shape: "Rg--Rg--:CwRwCwRw:--Rg--Rg",
|
||||||
required: 25000,
|
required: 25000,
|
||||||
reward: enumHubGoalRewards.reward_virtual_processing,
|
reward: enumHubGoalRewards.reward_virtual_processing,
|
||||||
},
|
},
|
||||||
|
|
||||||
// 26 Freeplay
|
// 26 Freeplay
|
||||||
{
|
{
|
||||||
shape: "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw",
|
shape: "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw",
|
||||||
required: 50000,
|
required: 50000,
|
||||||
reward: enumHubGoalRewards.reward_freeplay,
|
reward: enumHubGoalRewards.reward_freeplay,
|
||||||
},
|
},
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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();
|
||||||
|
@ -502,7 +502,7 @@ export class BeltSystem extends GameSystemWithFilter {
|
|||||||
// 126 / 42 is the exact animation speed of the png animation
|
// 126 / 42 is the exact animation speed of the png animation
|
||||||
const animationIndex = Math.floor(
|
const animationIndex = Math.floor(
|
||||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||||
globalConfig.itemSpacingOnBelts
|
globalConfig.itemSpacingOnBelts
|
||||||
);
|
);
|
||||||
const contents = chunk.containedEntitiesByLayer.regular;
|
const contents = chunk.containedEntitiesByLayer.regular;
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,14 +282,16 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
|||||||
// SYNC with systems/belt.js:drawSingleEntity!
|
// SYNC with systems/belt.js:drawSingleEntity!
|
||||||
const animationIndex = Math.floor(
|
const animationIndex = Math.floor(
|
||||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||||
globalConfig.itemSpacingOnBelts
|
globalConfig.itemSpacingOnBelts
|
||||||
);
|
);
|
||||||
parameters.context.translate(x, y);
|
parameters.context.translate(x, y);
|
||||||
parameters.context.rotate(angleRadians);
|
parameters.context.rotate(angleRadians);
|
||||||
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
|
||||||
|
@ -86,7 +86,7 @@ DisplaySystem.displayItemType = {
|
|||||||
|
|
||||||
DisplaySystem.displayItem = {
|
DisplaySystem.displayItem = {
|
||||||
color: (parameters, value, origin, globalConfig) =>
|
color: (parameters, value, origin, globalConfig) =>
|
||||||
DisplaySystem.displaySprites[ /** @type {ColorItem} */ (value).color].drawCachedCentered(
|
DisplaySystem.displaySprites[/** @type {ColorItem} */ (value).color].drawCachedCentered(
|
||||||
parameters,
|
parameters,
|
||||||
(origin.x + 0.5) * globalConfig.tileSize,
|
(origin.x + 0.5) * globalConfig.tileSize,
|
||||||
(origin.y + 0.5) * globalConfig.tileSize,
|
(origin.y + 0.5) * globalConfig.tileSize,
|
||||||
|
@ -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;
|
||||||
|
@ -35,23 +35,23 @@ export class HubSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
// Set hub goal
|
// Set hub goal
|
||||||
const entity = this.allEntities[i];
|
const entity = this.allEntities[i];
|
||||||
const pinsComp = entity.components.WiredPins;
|
const pinsComp = entity.components.WiredPins;
|
||||||
pinsComp.slots[0].value = this.root.shapeDefinitionMgr.getShapeItemFromDefinition(
|
pinsComp.slots[0].value = this.root.shapeDefinitionMgr.getShapeItemFromDefinition(
|
||||||
this.root.hubGoals.currentGoal.definition
|
this.root.hubGoals.currentGoal.definition
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
*
|
/**
|
||||||
* @param {HTMLCanvasElement} canvas
|
*
|
||||||
* @param {CanvasRenderingContext2D} context
|
* @param {HTMLCanvasElement} canvas
|
||||||
* @param {number} w
|
* @param {CanvasRenderingContext2D} context
|
||||||
* @param {number} h
|
* @param {number} w
|
||||||
* @param {number} dpi
|
* @param {number} h
|
||||||
*/
|
* @param {number} dpi
|
||||||
|
*/
|
||||||
redrawHubBaseTexture(canvas, context, w, h, dpi) {
|
redrawHubBaseTexture(canvas, context, w, h, dpi) {
|
||||||
// This method is quite ugly, please ignore it!
|
// This method is quite ugly, please ignore it!
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ export class ItemProcessorOverlaysSystem extends GameSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemProcessorOverlaysSystem.processorOverlayStatic = {
|
ItemProcessorOverlaysSystem.processorOverlayStatic = {
|
||||||
[enumItemProcessorRequirements.painterQuad]: function(parameters, chunk, entity, processorComp) {
|
[enumItemProcessorRequirements.painterQuad]: function (parameters, chunk, entity, processorComp) {
|
||||||
this.drawConnectedSlotRequirement(parameters, entity, { drawIfFalse: true });
|
this.drawConnectedSlotRequirement(parameters, entity, { drawIfFalse: true });
|
||||||
},
|
},
|
||||||
};
|
};
|
@ -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,32 +340,28 @@ 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
|
||||||
{
|
? BOOL_TRUE_SINGLETON
|
||||||
return /** @type {ColorItem} */ (itemA).color === /** @type {ColorItem} */ (itemB).color ?
|
: BOOL_FALSE_SINGLETON;
|
||||||
BOOL_TRUE_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());
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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);
|
||||||
|
@ -217,10 +217,12 @@ export class WireSystem extends GameSystemWithFilter {
|
|||||||
currentNetwork.uid,
|
currentNetwork.uid,
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
const entitiesToVisit = [{
|
const entitiesToVisit = [
|
||||||
entity: initialEntity,
|
{
|
||||||
slot,
|
entity: initialEntity,
|
||||||
}, ];
|
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,13 +247,14 @@ 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 " +
|
||||||
currentNetwork.uid +
|
currentNetwork.uid +
|
||||||
" @ " +
|
" @ " +
|
||||||
staticComp.origin.toString()
|
staticComp.origin.toString()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!wireComp.linkedNetwork) {
|
if (!wireComp.linkedNetwork) {
|
||||||
@ -287,11 +290,12 @@ 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 " +
|
||||||
currentNetwork.uid
|
currentNetwork.uid
|
||||||
);
|
);
|
||||||
if (!slot.linkedNetwork) {
|
if (!slot.linkedNetwork) {
|
||||||
// This one is new
|
// This one is new
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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([
|
||||||
|
@ -15,7 +15,7 @@ import { addVanillaSystemsToAPI } from "./game/game_system_manager";
|
|||||||
import { addVanillaGameModesToAPI } from "./game/game_mode_registry";
|
import { addVanillaGameModesToAPI } from "./game/game_mode_registry";
|
||||||
import { getIPCRenderer } from "./core/utils";
|
import { getIPCRenderer } from "./core/utils";
|
||||||
const logger = createLogger("main");
|
const logger = createLogger("main");
|
||||||
window.onload = async() => {
|
window.onload = async () => {
|
||||||
if (window.coreThreadLoadedCb) {
|
if (window.coreThreadLoadedCb) {
|
||||||
logger.log("Javascript parsed, calling html thread");
|
logger.log("Javascript parsed, calling html thread");
|
||||||
window.coreThreadLoadedCb();
|
window.coreThreadLoadedCb();
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
|
@ -112,14 +112,14 @@ export class ModManager {
|
|||||||
});
|
});
|
||||||
} else
|
} else
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
setTimeout(reject, 60 * 1000);
|
setTimeout(reject, 60 * 1000);
|
||||||
}),
|
}),
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
cache: "no-cache",
|
cache: "no-cache",
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
.then(res => res.text())
|
.then(res => res.text())
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
assert(this, "Failed to load mod:", err);
|
assert(this, "Failed to load mod:", err);
|
||||||
@ -208,9 +208,9 @@ export class ModManager {
|
|||||||
if (isMissingDependecie) {
|
if (isMissingDependecie) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"Mod with mod id: " +
|
"Mod with mod id: " +
|
||||||
mod.id +
|
mod.id +
|
||||||
" is disabled because it's missings the dependecie " +
|
" is disabled because it's missings the dependecie " +
|
||||||
missingDependecie
|
missingDependecie
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
} else sorter.add(id, mod.dependencies);
|
} else sorter.add(id, mod.dependencies);
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
@ -150,9 +154,9 @@ export const allApplicationSettings = () => {
|
|||||||
category: enumCategories.userInterface,
|
category: enumCategories.userInterface,
|
||||||
restartRequired: false,
|
restartRequired: false,
|
||||||
changeCb:
|
changeCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
(app, id) => app.updateAfterUiScaleChanged(),
|
(app, id) => app.updateAfterUiScaleChanged(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -208,17 +212,17 @@ export const allApplicationSettings = () => {
|
|||||||
category: enumCategories.userInterface,
|
category: enumCategories.userInterface,
|
||||||
restartRequired: false,
|
restartRequired: false,
|
||||||
changeCb:
|
changeCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
(app, id) => {
|
(app, id) => {
|
||||||
applyGameTheme(id);
|
applyGameTheme(id);
|
||||||
document.documentElement.setAttribute("data-theme", id);
|
document.documentElement.setAttribute("data-theme", id);
|
||||||
},
|
},
|
||||||
enabledCb:
|
enabledCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
app => app.restrictionMgr.getHasExtendedSettings(),
|
app => app.restrictionMgr.getHasExtendedSettings(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -229,9 +233,9 @@ export const allApplicationSettings = () => {
|
|||||||
category: enumCategories.advanced,
|
category: enumCategories.advanced,
|
||||||
restartRequired: false,
|
restartRequired: false,
|
||||||
changeCb:
|
changeCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
(app, id) => null,
|
(app, id) => null,
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -242,9 +246,9 @@ export const allApplicationSettings = () => {
|
|||||||
category: enumCategories.advanced,
|
category: enumCategories.advanced,
|
||||||
restartRequired: false,
|
restartRequired: false,
|
||||||
changeCb:
|
changeCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
(app, id) => app.updateAfterUiScaleChanged(),
|
(app, id) => app.updateAfterUiScaleChanged(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -278,9 +282,9 @@ export const allApplicationSettings = () => {
|
|||||||
restartRequired: false,
|
restartRequired: false,
|
||||||
changeCb: (app, id) => {},
|
changeCb: (app, id) => {},
|
||||||
enabledCb:
|
enabledCb:
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
app => app.restrictionMgr.getHasExtendedSettings(),
|
app => app.restrictionMgr.getHasExtendedSettings(),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@ -372,7 +376,7 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.writeAsync());
|
.then(() => this.writeAsync());
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save() {
|
||||||
@ -510,12 +514,12 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
* @param {string} id
|
* @param {string} id
|
||||||
*/
|
*/
|
||||||
resetKeybindingOverride(id) {
|
resetKeybindingOverride(id) {
|
||||||
delete this.getAllSettings().keybindingOverrides[id];
|
delete this.getAllSettings().keybindingOverrides[id];
|
||||||
return this.writeAsync();
|
return this.writeAsync();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Resets all keybinding overrides
|
* Resets all keybinding overrides
|
||||||
*/
|
*/
|
||||||
resetKeybindingOverrides() {
|
resetKeybindingOverrides() {
|
||||||
this.getAllSettings().keybindingOverrides = {};
|
this.getAllSettings().keybindingOverrides = {};
|
||||||
return this.writeAsync();
|
return this.writeAsync();
|
||||||
@ -537,14 +541,14 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
if (!setting.validate(storedValue)) {
|
if (!setting.validate(storedValue)) {
|
||||||
return ExplainedResult.bad(
|
return ExplainedResult.bad(
|
||||||
"Bad setting value for " +
|
"Bad setting value for " +
|
||||||
setting.id +
|
setting.id +
|
||||||
": " +
|
": " +
|
||||||
storedValue +
|
storedValue +
|
||||||
" @ settings version " +
|
" @ settings version " +
|
||||||
data.version +
|
data.version +
|
||||||
" (latest is " +
|
" (latest is " +
|
||||||
this.getCurrentVersion() +
|
this.getCurrentVersion() +
|
||||||
")"
|
")"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
@ -145,8 +146,8 @@ export class EnumSetting extends BaseSetting {
|
|||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
getHtml(app) {
|
getHtml(app) {
|
||||||
const available = this.getIsAvailable(app);
|
const available = this.getIsAvailable(app);
|
||||||
return `
|
return `
|
||||||
<div class="setting cardbox ${available ? "enabled" : "disabled"}">
|
<div class="setting cardbox ${available ? "enabled" : "disabled"}">
|
||||||
${available ? "" : `<span class="standaloneOnlyHint">${T.demo.settingNotAvailable}</span>`}
|
${available ? "" : `<span class="standaloneOnlyHint">${T.demo.settingNotAvailable}</span>`}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -151,12 +151,12 @@ export class Savegame extends ReadWriteProxy {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isSaveable() {
|
isSaveable() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Returns the statistics of the savegame
|
* Returns the statistics of the savegame
|
||||||
* @returns {import("./savegame_typedefs").SavegameStats}
|
* @returns {import("./savegame_typedefs").SavegameStats}
|
||||||
*/
|
*/
|
||||||
getStatistics() {
|
getStatistics() {
|
||||||
return this.currentData.stats;
|
return this.currentData.stats;
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
},
|
},
|
||||||
|
@ -699,7 +699,7 @@ export class TypeClassData extends BaseDataType {
|
|||||||
for (let i = 0; i < entries.length; ++i) {
|
for (let i = 0; i < entries.length; ++i) {
|
||||||
const entry = entries[i];
|
const entry = entries[i];
|
||||||
options.push(
|
options.push(
|
||||||
schemaToJsonSchema( /** @type {typeof BasicSerializableObject} */ (entry).getCachedSchema())
|
schemaToJsonSchema(/** @type {typeof BasicSerializableObject} */ (entry).getCachedSchema())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return { oneOf: options };
|
return { oneOf: options };
|
||||||
@ -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(),
|
||||||
|
@ -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(() => {
|
||||||
|
@ -32,15 +32,15 @@ export class MainMenuState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getInnerHTML() {
|
getInnerHTML() {
|
||||||
const bannerHtml = `
|
const bannerHtml = `
|
||||||
<h3>${T.demoBanners.title}</h3>
|
<h3>${T.demoBanners.title}</h3>
|
||||||
<p>${T.demoBanners.intro}</p>
|
<p>${T.demoBanners.intro}</p>
|
||||||
<a href="#" class="steamLink ${A_B_TESTING_LINK_TYPE}" target="_blank">Get the shapez.io standalone!</a>
|
<a href="#" class="steamLink ${A_B_TESTING_LINK_TYPE}" target="_blank">Get the shapez.io standalone!</a>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const showDemoBadges = this.app.restrictionMgr.getIsStandaloneMarketingActive();
|
const showDemoBadges = this.app.restrictionMgr.getIsStandaloneMarketingActive();
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="topButtons">
|
<div class="topButtons">
|
||||||
<button class="languageChoose" data-languageicon="${this.app.settings.getLanguage()}"></button>
|
<button class="languageChoose" data-languageicon="${this.app.settings.getLanguage()}"></button>
|
||||||
<button class="settingsButton"></button>
|
<button class="settingsButton"></button>
|
||||||
|
@ -68,43 +68,43 @@ export class PreloadState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
startLoading() {
|
startLoading() {
|
||||||
this.setStatus("Booting")
|
this.setStatus("Booting")
|
||||||
|
|
||||||
.then(() => this.setStatus("Creating platform wrapper"))
|
.then(() => this.setStatus("Creating platform wrapper"))
|
||||||
.then(() => this.app.platformWrapper.initialize())
|
.then(() => this.app.platformWrapper.initialize())
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing local storage"))
|
.then(() => this.setStatus("Initializing local storage"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const wrapper = this.app.platformWrapper;
|
const wrapper = this.app.platformWrapper;
|
||||||
if (wrapper instanceof PlatformWrapperImplBrowser) {
|
if (wrapper instanceof PlatformWrapperImplBrowser) {
|
||||||
try {
|
try {
|
||||||
window.localStorage.setItem("local_storage_test", "1");
|
window.localStorage.setItem("local_storage_test", "1");
|
||||||
window.localStorage.removeItem("local_storage_test");
|
window.localStorage.removeItem("local_storage_test");
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
logger.error("Failed to read/write local storage:", ex);
|
logger.error("Failed to read/write local storage:", ex);
|
||||||
return new Promise(() => {
|
return new Promise(() => {
|
||||||
alert(`Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n
|
alert(`Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n
|
||||||
In Chrome this setting is called "Block third-party cookies and site data".\n\n
|
In Chrome this setting is called "Block third-party cookies and site data".\n\n
|
||||||
Please allow third party cookies and then reload the page.`);
|
Please allow third party cookies and then reload the page.`);
|
||||||
// Never return
|
// Never return
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Creating storage"))
|
.then(() => this.setStatus("Creating storage"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.storage.initialize();
|
return this.app.storage.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing libraries"))
|
.then(() => this.setStatus("Initializing libraries"))
|
||||||
.then(() => this.app.analytics.initialize())
|
.then(() => this.app.analytics.initialize())
|
||||||
.then(() => this.app.gameAnalytics.initialize())
|
.then(() => this.app.gameAnalytics.initialize())
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing settings"))
|
.then(() => this.setStatus("Initializing settings"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.settings.initialize();
|
return this.app.settings.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Initialize fullscreen
|
// Initialize fullscreen
|
||||||
@ -114,84 +114,84 @@ export class PreloadState extends GameState {
|
|||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing language"))
|
.then(() => this.setStatus("Initializing language"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.app.settings.getLanguage() === "auto-detect") {
|
if (this.app.settings.getLanguage() === "auto-detect") {
|
||||||
const language = autoDetectLanguageId();
|
const language = autoDetectLanguageId();
|
||||||
logger.log("Setting language to", language);
|
logger.log("Setting language to", language);
|
||||||
return this.app.settings.updateLanguage(language);
|
return this.app.settings.updateLanguage(language);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const language = this.app.settings.getLanguage();
|
const language = this.app.settings.getLanguage();
|
||||||
updateApplicationLanguage(language);
|
updateApplicationLanguage(language);
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing sounds"))
|
.then(() => this.setStatus("Initializing sounds"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
// Notice: We don't await the sounds loading itself
|
// Notice: We don't await the sounds loading itself
|
||||||
return this.app.sound.initialize();
|
return this.app.sound.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.app.backgroundResourceLoader.startLoading();
|
this.app.backgroundResourceLoader.startLoading();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing restrictions"))
|
.then(() => this.setStatus("Initializing restrictions"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.restrictionMgr.initialize();
|
return this.app.restrictionMgr.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing savegame"))
|
.then(() => this.setStatus("Initializing savegame"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.savegameMgr.initialize().catch(err => {
|
return this.app.savegameMgr.initialize().catch(err => {
|
||||||
logger.error("Failed to initialize savegames:", err);
|
logger.error("Failed to initialize savegames:", err);
|
||||||
alert(
|
alert(
|
||||||
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
|
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
|
||||||
);
|
);
|
||||||
return this.app.savegameMgr.writeAsync();
|
return this.app.savegameMgr.writeAsync();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Downloading resources"))
|
.then(() => this.setStatus("Downloading resources"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
return this.app.backgroundResourceLoader.getPromiseForBareGame();
|
return this.app.backgroundResourceLoader.getPromiseForBareGame();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Checking changelog"))
|
.then(() => this.setStatus("Checking changelog"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (G_IS_DEV && globalConfig.debug.disableUpgradeNotification) {
|
if (G_IS_DEV && globalConfig.debug.disableUpgradeNotification) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.app.storage
|
||||||
|
.readFileAsync("lastversion.bin")
|
||||||
|
.catch(err => {
|
||||||
|
logger.warn("Failed to read lastversion:", err);
|
||||||
|
return G_BUILD_VERSION;
|
||||||
|
})
|
||||||
|
.then(version => {
|
||||||
|
logger.log("Last version:", version, "App version:", G_BUILD_VERSION);
|
||||||
|
this.app.storage.writeFileAsync("lastversion.bin", G_BUILD_VERSION);
|
||||||
|
return version;
|
||||||
|
})
|
||||||
|
.then(version => {
|
||||||
|
let changelogEntries = [];
|
||||||
|
logger.log("Last seen version:", version);
|
||||||
|
|
||||||
|
for (let i = 0; i < CHANGELOG.length; ++i) {
|
||||||
|
if (CHANGELOG[i].version === version) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
changelogEntries.push(CHANGELOG[i]);
|
||||||
|
}
|
||||||
|
if (changelogEntries.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.app.storage
|
let dialogHtml = T.dialogs.updateSummary.desc;
|
||||||
.readFileAsync("lastversion.bin")
|
for (let i = 0; i < changelogEntries.length; ++i) {
|
||||||
.catch(err => {
|
const entry = changelogEntries[i];
|
||||||
logger.warn("Failed to read lastversion:", err);
|
dialogHtml += `
|
||||||
return G_BUILD_VERSION;
|
|
||||||
})
|
|
||||||
.then(version => {
|
|
||||||
logger.log("Last version:", version, "App version:", G_BUILD_VERSION);
|
|
||||||
this.app.storage.writeFileAsync("lastversion.bin", G_BUILD_VERSION);
|
|
||||||
return version;
|
|
||||||
})
|
|
||||||
.then(version => {
|
|
||||||
let changelogEntries = [];
|
|
||||||
logger.log("Last seen version:", version);
|
|
||||||
|
|
||||||
for (let i = 0; i < CHANGELOG.length; ++i) {
|
|
||||||
if (CHANGELOG[i].version === version) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
changelogEntries.push(CHANGELOG[i]);
|
|
||||||
}
|
|
||||||
if (changelogEntries.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let dialogHtml = T.dialogs.updateSummary.desc;
|
|
||||||
for (let i = 0; i < changelogEntries.length; ++i) {
|
|
||||||
const entry = changelogEntries[i];
|
|
||||||
dialogHtml += `
|
|
||||||
<div class="changelogDialogEntry">
|
<div class="changelogDialogEntry">
|
||||||
<span class="version">${entry.version}</span>
|
<span class="version">${entry.version}</span>
|
||||||
<span class="date">${entry.date}</span>
|
<span class="date">${entry.date}</span>
|
||||||
|
@ -12,7 +12,7 @@ export class SettingsState extends TextualGameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getMainContentHTML() {
|
getMainContentHTML() {
|
||||||
return `<div class="sidebar">
|
return `<div class="sidebar">
|
||||||
${this.getCategoryButtonsHtml()}
|
${this.getCategoryButtonsHtml()}
|
||||||
${
|
${
|
||||||
this.app.platformWrapper.getSupportsKeyboard()
|
this.app.platformWrapper.getSupportsKeyboard()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"lib": ["ES2018","WebWorker"]
|
"lib": ["ES2018", "WebWorker"]
|
||||||
},
|
},
|
||||||
"exclude": [],
|
"exclude": [],
|
||||||
"extends": "../tsconfig",
|
"extends": "../tsconfig",
|
||||||
|
Loading…
Reference in New Issue
Block a user