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
|
||||
@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;
|
||||
@ -25,14 +25,14 @@
|
||||
$impSuffix: "!important";
|
||||
}
|
||||
$v1: D($v1);
|
||||
@if $v2 !="" {
|
||||
@if $v2 != "" {
|
||||
$v2: D($v2);
|
||||
}
|
||||
@if $v3 !="" {
|
||||
@if $v3 != "" {
|
||||
$v3: D($v3);
|
||||
}
|
||||
@if $v4 !="" {
|
||||
@if $v4 != "" {
|
||||
$v4: D($v4);
|
||||
}
|
||||
#{$propName}: #{$v1} #{$v2} #{$v3} #{$v4} #{$impSuffix};
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,6 @@
|
||||
$buildings: belt,
|
||||
cutter,
|
||||
miner,
|
||||
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;
|
||||
$buildings: belt, cutter, miner, 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 {
|
||||
[data-icon="building_icons/#{$building}.png"] {
|
||||
/* @load-async */
|
||||
@ -29,41 +8,11 @@ item_producer;
|
||||
}
|
||||
}
|
||||
|
||||
$buildingsAndVariants: belt,
|
||||
balancer,
|
||||
underground_belt,
|
||||
underground_belt-tier2,
|
||||
miner,
|
||||
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;
|
||||
$buildingsAndVariants: belt, balancer, underground_belt, underground_belt-tier2, miner, 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 {
|
||||
[data-icon="building_tutorials/#{$building}.png"] {
|
||||
/* @load-async */
|
||||
@ -108,9 +57,7 @@ comparator;
|
||||
background-image: uiResource("res/ui/building_tutorials/virtual_processor-cutter.png") !important;
|
||||
}
|
||||
|
||||
$icons: notification_saved,
|
||||
notification_success,
|
||||
notification_upgrade;
|
||||
$icons: notification_saved, notification_success, notification_upgrade;
|
||||
@each $icon in $icons {
|
||||
[data-icon="icons/#{$icon}.png"] {
|
||||
/* @load-async */
|
||||
@ -118,34 +65,8 @@ notification_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
$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,
|
||||
th,
|
||||
hu,
|
||||
pl,
|
||||
ja,
|
||||
kor,
|
||||
no,
|
||||
pt-PT;
|
||||
$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,
|
||||
th, hu, pl, ja, kor, no, pt-PT;
|
||||
@each $language in $languages {
|
||||
[data-languageicon="#{$language}"] {
|
||||
/* @load-async */
|
||||
@ -153,7 +74,6 @@ pt-PT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
PRICE
|
||||
*/
|
||||
@ -166,4 +86,4 @@ PRICE
|
||||
.steam_2_npr {
|
||||
/* @load-async */
|
||||
background-image: uiResource("get_on_steam.png") !important;
|
||||
}
|
||||
}
|
||||
|
@ -277,7 +277,7 @@
|
||||
grid-row: 2 / 3;
|
||||
@include SuperSmallText;
|
||||
opacity: 0.5;
|
||||
>span {
|
||||
> span {
|
||||
display: inline-flex;
|
||||
@include S(max-width, 140px);
|
||||
overflow: hidden;
|
||||
@ -290,7 +290,7 @@
|
||||
@include PlainText;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
>span {
|
||||
> span {
|
||||
display: inline-flex;
|
||||
@include S(max-width, 140px);
|
||||
overflow: hidden;
|
||||
@ -429,7 +429,7 @@
|
||||
$linkBg: #fdfdff;
|
||||
$linkBgHover: darken($linkBg, 2);
|
||||
$linkColor: #55586a;
|
||||
>.boxLink {
|
||||
> .boxLink {
|
||||
display: grid;
|
||||
align-items: center;
|
||||
grid-template-columns: 1fr auto;
|
||||
@ -470,14 +470,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
>.sidelinks {
|
||||
> .sidelinks {
|
||||
display: grid;
|
||||
align-items: flex-start;
|
||||
justify-content: flex-start;
|
||||
grid-template-rows: 1fr 1fr 1fr;
|
||||
@include S(grid-gap, 3px);
|
||||
@include S(height, 60px);
|
||||
>a {
|
||||
> a {
|
||||
color: $linkColor;
|
||||
background: $linkBg;
|
||||
height: 100%;
|
||||
@ -524,8 +524,8 @@
|
||||
}
|
||||
}
|
||||
.footer {
|
||||
>a,
|
||||
.sidelinks>a {
|
||||
> a,
|
||||
.sidelinks > a {
|
||||
background-color: $darkModeControlsBackground;
|
||||
color: #eee;
|
||||
&:hover {
|
||||
@ -534,7 +534,7 @@
|
||||
}
|
||||
.author {
|
||||
color: #bdbdbd;
|
||||
>a {
|
||||
> a {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
@ -543,4 +543,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,46 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>shapez.io - Build automated factories to build, combine and color shapes!</title>
|
||||
|
||||
<head>
|
||||
<title>shapez.io - Build automated factories to build, combine and color shapes!</title>
|
||||
<!-- mobile stuff -->
|
||||
<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 -->
|
||||
<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" />
|
||||
<!-- seo -->
|
||||
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
|
||||
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
|
||||
<meta
|
||||
name="description"
|
||||
content="shapez.io is an open-source factory building game about combining and producing different types of shapes."
|
||||
/>
|
||||
<meta
|
||||
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 -->
|
||||
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
|
||||
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
|
||||
<meta name="description" content="shapez.io is an open-source factory building game about combining and producing different types of shapes." />
|
||||
<meta 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" />
|
||||
<!-- 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>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
</html>
|
||||
<body oncontextmenu="return false" style="background: #393747;"></body>
|
||||
</html>
|
||||
|
@ -411,4 +411,4 @@ Application.states = {
|
||||
KeybindingsState,
|
||||
AboutState,
|
||||
ChangelogState,
|
||||
};
|
||||
};
|
||||
|
@ -1,7 +1,8 @@
|
||||
/**
|
||||
* @type {Array<{version: string, date: string, entries: Array<String>}>} changelog
|
||||
*/
|
||||
export const CHANGELOG = [{
|
||||
export const CHANGELOG = [
|
||||
{
|
||||
version: "1.2.3",
|
||||
date: "unreleased",
|
||||
entries: [
|
||||
@ -314,4 +315,4 @@ export const CHANGELOG = [{
|
||||
date: "21.05.2020",
|
||||
entries: ["Initial release!"],
|
||||
},
|
||||
];
|
||||
];
|
||||
|
@ -77,4 +77,4 @@ export class AnimationFrame {
|
||||
|
||||
window.requestAnimationFrame(this.boundMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function initAssert() {
|
||||
* @param {Boolean} condition
|
||||
* @param {...String} failureMessage
|
||||
*/
|
||||
window.assert = function(condition, ...failureMessage) {
|
||||
window.assert = function (condition, ...failureMessage) {
|
||||
if (!condition) {
|
||||
logger.error("assertion failed:", ...failureMessage);
|
||||
if (!assertionErrorShown) {
|
||||
@ -32,4 +32,4 @@ function initAssert() {
|
||||
};
|
||||
}
|
||||
|
||||
initAssert();
|
||||
initAssert();
|
||||
|
@ -118,4 +118,4 @@ class AsynCompression {
|
||||
}
|
||||
}
|
||||
|
||||
export const asyncCompressor = new AsynCompression();
|
||||
export const asyncCompressor = new AsynCompression();
|
||||
|
@ -47,4 +47,4 @@ export const atlasFiles = require
|
||||
.keys()
|
||||
.map(f => f.replace(/^\.\//gi, ""))
|
||||
.map(f => require("../../../res_built/atlas/" + f))
|
||||
.map(data => new AtlasDefinition(data));
|
||||
.map(data => new AtlasDefinition(data));
|
||||
|
@ -107,10 +107,10 @@ export class BackgroundResourcesLoader {
|
||||
internalStartLoadingEssentialsForBareGame() {
|
||||
logger.log("⏰ Start load: bare game");
|
||||
this.internalLoadSpritesAndSounds(
|
||||
essentialBareGameSprites,
|
||||
essentialBareGameSounds,
|
||||
essentialBareGameAtlases
|
||||
)
|
||||
essentialBareGameSprites,
|
||||
essentialBareGameSounds,
|
||||
essentialBareGameAtlases
|
||||
)
|
||||
.then(() => this.internalPreloadCss("async-resources.scss"))
|
||||
.catch(err => {
|
||||
logger.warn("⏰ Failed to load essentials for bare game:", err);
|
||||
@ -174,13 +174,13 @@ export class BackgroundResourcesLoader {
|
||||
this.soundsLoaded.push(sounds[i]);
|
||||
promises.push(
|
||||
this.app.sound
|
||||
.loadSound(sounds[i])
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load sound:", sounds[i]);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
.loadSound(sounds[i])
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load sound:", sounds[i]);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@ -192,12 +192,12 @@ export class BackgroundResourcesLoader {
|
||||
this.spritesLoaded.push(sprites[i]);
|
||||
promises.push(
|
||||
Loader.preloadCSSSprite(sprites[i])
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load css sprite:", sprites[i]);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load css sprite:", sprites[i]);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@ -205,28 +205,28 @@ export class BackgroundResourcesLoader {
|
||||
const atlas = atlases[i];
|
||||
promises.push(
|
||||
Loader.preloadAtlas(atlas)
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load atlas:", atlas.sourceFileName);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
.catch(err => {
|
||||
logger.warn("Failed to load atlas:", atlas.sourceFileName);
|
||||
})
|
||||
.then(() => {
|
||||
this.numAssetsLoaded++;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
Promise.all(promises)
|
||||
|
||||
// // Remove some pressure by waiting a bit
|
||||
// .then(() => {
|
||||
// return new Promise(resolve => {
|
||||
// setTimeout(resolve, 200);
|
||||
// });
|
||||
// })
|
||||
.then(() => {
|
||||
this.numAssetsToLoadTotal = 0;
|
||||
this.numAssetsLoaded = 0;
|
||||
})
|
||||
// // Remove some pressure by waiting a bit
|
||||
// .then(() => {
|
||||
// return new Promise(resolve => {
|
||||
// setTimeout(resolve, 200);
|
||||
// });
|
||||
// })
|
||||
.then(() => {
|
||||
this.numAssetsToLoadTotal = 0;
|
||||
this.numAssetsLoaded = 0;
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,4 +168,4 @@ export class BufferMaintainer {
|
||||
});
|
||||
return canvas;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,4 @@ export class DrawParameters {
|
||||
/** @type {import("../game/root").GameRoot} */
|
||||
this.root = root;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { Rectangle } from "./rectangle";
|
||||
const logger = createLogger("draw_utils");
|
||||
|
||||
export function initDrawUtils() {
|
||||
CanvasRenderingContext2D.prototype.beginRoundedRect = function(x, y, w, h, r) {
|
||||
CanvasRenderingContext2D.prototype.beginRoundedRect = function (x, y, w, h, r) {
|
||||
this.beginPath();
|
||||
|
||||
if (r < 0.05) {
|
||||
@ -28,7 +28,7 @@ export function initDrawUtils() {
|
||||
this.arcTo(x, y, x + w, y, r);
|
||||
};
|
||||
|
||||
CanvasRenderingContext2D.prototype.beginCircle = function(x, y, r) {
|
||||
CanvasRenderingContext2D.prototype.beginCircle = function (x, y, r) {
|
||||
this.beginPath();
|
||||
|
||||
if (r < 0.05) {
|
||||
@ -113,4 +113,4 @@ export function drawSpriteClipped({ parameters, sprite, x, y, w, h, originalW, o
|
||||
intersection.w,
|
||||
intersection.h
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -29,4 +29,4 @@ export let gItemRegistry = new Factory("item");
|
||||
*/
|
||||
export function initBuildingsByCategory(buildings) {
|
||||
gBuildingsByCategory = buildings;
|
||||
}
|
||||
}
|
||||
|
@ -240,4 +240,4 @@ export class InputDistributor {
|
||||
alt: event.altKey,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,4 +222,4 @@ class LoaderImpl {
|
||||
}
|
||||
}
|
||||
|
||||
export const Loader = new LoaderImpl();
|
||||
export const Loader = new LoaderImpl();
|
||||
|
@ -111,9 +111,9 @@ export class ReadWriteProxy {
|
||||
const checksum = decompressed.substring(0, 40);
|
||||
const jsonString = decompressed.substr(40);
|
||||
|
||||
const desiredChecksum = checksum.startsWith(CRC_PREFIX) ?
|
||||
computeCrc(jsonString + salt) :
|
||||
sha1(jsonString + salt);
|
||||
const desiredChecksum = checksum.startsWith(CRC_PREFIX)
|
||||
? computeCrc(jsonString + salt)
|
||||
: sha1(jsonString + salt);
|
||||
|
||||
if (desiredChecksum !== checksum) {
|
||||
// Checksum mismatch
|
||||
@ -165,141 +165,141 @@ export class ReadWriteProxy {
|
||||
// Start read request
|
||||
return (
|
||||
this.app.storage
|
||||
.readFileAsync(this.filename)
|
||||
.readFileAsync(this.filename)
|
||||
|
||||
// Check for errors during read
|
||||
.catch(err => {
|
||||
if (err === FILE_NOT_FOUND) {
|
||||
logger.log("File not found, using default data");
|
||||
// Check for errors during read
|
||||
.catch(err => {
|
||||
if (err === FILE_NOT_FOUND) {
|
||||
logger.log("File not found, using default data");
|
||||
|
||||
// File not found or unreadable, assume default file
|
||||
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");
|
||||
// File not found or unreadable, assume default file
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
// Compare stored checksum with actual checksum
|
||||
const checksum = decompressed.substring(0, 40);
|
||||
const jsonString = decompressed.substr(40);
|
||||
return Promise.reject("file-error: " + err);
|
||||
})
|
||||
|
||||
const desiredChecksum = checksum.startsWith(CRC_PREFIX) ?
|
||||
computeCrc(jsonString + salt) :
|
||||
sha1(jsonString + salt);
|
||||
// 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 (desiredChecksum !== checksum) {
|
||||
// Checksum mismatch
|
||||
return Promise.reject(
|
||||
"bad-content / checksum-mismatch: " + desiredChecksum + " vs " + checksum
|
||||
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
|
||||
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) {
|
||||
return Promise.reject("bad-content / missing-compression");
|
||||
})
|
||||
|
||||
// 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 rawData;
|
||||
})
|
||||
return contents;
|
||||
})
|
||||
|
||||
// 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");
|
||||
}
|
||||
})
|
||||
|
||||
// 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);
|
||||
// Check version and migrate if required
|
||||
.then(contents => {
|
||||
if (contents.version > this.getCurrentVersion()) {
|
||||
return Promise.reject("stored-data-is-newer");
|
||||
}
|
||||
}
|
||||
return contents;
|
||||
})
|
||||
|
||||
// Verify
|
||||
.then(contents => {
|
||||
const verifyResult = this.internalVerifyEntry(contents);
|
||||
if (!verifyResult.result) {
|
||||
logger.error(
|
||||
"Read invalid data from",
|
||||
this.filename,
|
||||
"reason:",
|
||||
verifyResult.reason,
|
||||
"contents:",
|
||||
contents
|
||||
);
|
||||
return Promise.reject("invalid-data: " + verifyResult.reason);
|
||||
}
|
||||
return contents;
|
||||
})
|
||||
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;
|
||||
})
|
||||
|
||||
// Store
|
||||
.then(contents => {
|
||||
this.currentData = contents;
|
||||
logger.log("📄 Read data with version", this.currentData.version, "from", this.filename);
|
||||
return contents;
|
||||
})
|
||||
// Verify
|
||||
.then(contents => {
|
||||
const verifyResult = this.internalVerifyEntry(contents);
|
||||
if (!verifyResult.result) {
|
||||
logger.error(
|
||||
"Read invalid data from",
|
||||
this.filename,
|
||||
"reason:",
|
||||
verifyResult.reason,
|
||||
"contents:",
|
||||
contents
|
||||
);
|
||||
return Promise.reject("invalid-data: " + verifyResult.reason);
|
||||
}
|
||||
return contents;
|
||||
})
|
||||
|
||||
// Catchall
|
||||
.catch(err => {
|
||||
return Promise.reject("Failed to read " + this.filename + ": " + err);
|
||||
})
|
||||
// Store
|
||||
.then(contents => {
|
||||
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);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
@ -341,4 +341,4 @@ export class ReadWriteProxy {
|
||||
}
|
||||
return this.verify(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,4 +94,4 @@ export class SingletonFactory {
|
||||
getNumEntries() {
|
||||
return this.entries.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,8 @@ export class StateManager {
|
||||
|
||||
this.app.analytics.trackStateEnter(key);
|
||||
|
||||
window.history.pushState({
|
||||
window.history.pushState(
|
||||
{
|
||||
key,
|
||||
},
|
||||
key
|
||||
@ -117,4 +118,4 @@ export class StateManager {
|
||||
getCurrentState() {
|
||||
return this.currentState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,4 +153,4 @@ export class TextualGameState extends GameState {
|
||||
|
||||
this.onEnter(payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -334,9 +334,9 @@ export function formatBigNumberFull(num, divider = T.global.thousandsDivider) {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export function waitNextFrame() {
|
||||
return new Promise(function(resolve) {
|
||||
window.requestAnimationFrame(function() {
|
||||
window.requestAnimationFrame(function() {
|
||||
return new Promise(function (resolve) {
|
||||
window.requestAnimationFrame(function () {
|
||||
window.requestAnimationFrame(function () {
|
||||
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='.')
|
||||
*/
|
||||
export function formatItemsPerSecond(speed, double = false, separator = T.global.decimalSeparator) {
|
||||
return speed === 1.0 ?
|
||||
T.ingame.buildingPlacement.infoTexts.oneItemPerSecond :
|
||||
T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace(
|
||||
"<x>",
|
||||
round2Digits(speed).toString().replace(".", separator)
|
||||
) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");
|
||||
return speed === 1.0
|
||||
? T.ingame.buildingPlacement.infoTexts.oneItemPerSecond
|
||||
: T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace(
|
||||
"<x>",
|
||||
round2Digits(speed).toString().replace(".", separator)
|
||||
) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -781,4 +781,4 @@ export function getRomanNumber(number) {
|
||||
|
||||
romanLiteralsCache[number] = formatted;
|
||||
return formatted;
|
||||
}
|
||||
}
|
||||
|
@ -100,4 +100,4 @@ export class BaseItem extends BasicSerializableObject {
|
||||
abstract;
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,4 +165,4 @@ export class Blueprint {
|
||||
return anyPlaced;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ export const gBuildingVariants = {
|
||||
*/
|
||||
export function registerBuildingVariant(
|
||||
meta,
|
||||
variant = "default" /* @TODO: Circular dependency, actually its defaultBuildingVariant */ ,
|
||||
variant = "default" /* @TODO: Circular dependency, actually its defaultBuildingVariant */,
|
||||
rotationVariant = 0
|
||||
) {
|
||||
// @ts-ignore
|
||||
@ -67,4 +67,4 @@ export function getBuildingDataFromCode(code) {
|
||||
*/
|
||||
export function getCodeFromBuildingData(metaBuilding, variant, rotationVariant = 0) {
|
||||
return metaBuilding.getId() + "/" + variant + "/" + rotationVariant;
|
||||
}
|
||||
}
|
||||
|
@ -117,33 +117,34 @@ export class MetaAnalyzerBuilding extends MetaBuilding {
|
||||
|
||||
MetaAnalyzerBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.analyzer,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.analyzer,
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaAnalyzerBuilding.silhouetteColors = {
|
||||
@ -186,7 +187,8 @@ MetaAnalyzerBuilding.layerPreview = {
|
||||
|
||||
MetaAnalyzerBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -205,4 +207,4 @@ MetaAnalyzerBuilding.componentVariations = {
|
||||
|
||||
entity.components.LogicGate.type = enumLogicGateType.analyzer;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -130,27 +130,27 @@ export class MetaBalancerBuilding extends MetaBuilding {
|
||||
|
||||
MetaBalancerBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [], // set later
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [], // set later
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.balancer,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.balancer,
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [], // set later
|
||||
renderFloatingItems: false,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [], // set later
|
||||
renderFloatingItems: false,
|
||||
})
|
||||
),
|
||||
|
||||
entity => entity.addComponent(new BeltUnderlaysComponent({ underlays: [] })),
|
||||
];
|
||||
@ -297,7 +297,8 @@ MetaBalancerBuilding.silhouetteColors = {
|
||||
|
||||
MetaBalancerBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
@ -319,7 +320,8 @@ MetaBalancerBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaBalancerBuilding.variants.merger]: (entity, rotationVariant) => {
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
@ -335,7 +337,8 @@ MetaBalancerBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaBalancerBuilding.variants.mergerInverse]: (entity, rotationVariant) => {
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
@ -352,12 +355,15 @@ MetaBalancerBuilding.componentVariations = {
|
||||
|
||||
[MetaBalancerBuilding.variants.splitter]: (entity, rotationVariant) => {
|
||||
{
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([{
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
@ -375,12 +381,15 @@ MetaBalancerBuilding.componentVariations = {
|
||||
|
||||
[MetaBalancerBuilding.variants.splitterInverse]: (entity, rotationVariant) => {
|
||||
{
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([{
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
@ -395,4 +404,4 @@ MetaBalancerBuilding.componentVariations = {
|
||||
];
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -138,43 +138,35 @@ export class MetaBeltBuilding extends MetaBuilding {
|
||||
|
||||
getPreviewSprite(rotationVariant) {
|
||||
switch (MetaBeltBuilding.variantToRotation[rotationVariant]) {
|
||||
case enumDirection.top:
|
||||
{
|
||||
return Loader.getSprite("sprites/buildings/belt_top.png");
|
||||
}
|
||||
case enumDirection.left:
|
||||
{
|
||||
return Loader.getSprite("sprites/buildings/belt_left.png");
|
||||
}
|
||||
case enumDirection.right:
|
||||
{
|
||||
return Loader.getSprite("sprites/buildings/belt_right.png");
|
||||
}
|
||||
default:
|
||||
{
|
||||
assertAlways(false, "Invalid belt rotation variant");
|
||||
}
|
||||
case enumDirection.top: {
|
||||
return Loader.getSprite("sprites/buildings/belt_top.png");
|
||||
}
|
||||
case enumDirection.left: {
|
||||
return Loader.getSprite("sprites/buildings/belt_left.png");
|
||||
}
|
||||
case enumDirection.right: {
|
||||
return Loader.getSprite("sprites/buildings/belt_right.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid belt rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getBlueprintSprite(rotationVariant) {
|
||||
switch (MetaBeltBuilding.variantToRotation[rotationVariant]) {
|
||||
case enumDirection.top:
|
||||
{
|
||||
return Loader.getSprite("sprites/blueprints/belt_top.png");
|
||||
}
|
||||
case enumDirection.left:
|
||||
{
|
||||
return Loader.getSprite("sprites/blueprints/belt_left.png");
|
||||
}
|
||||
case enumDirection.right:
|
||||
{
|
||||
return Loader.getSprite("sprites/blueprints/belt_right.png");
|
||||
}
|
||||
default:
|
||||
{
|
||||
assertAlways(false, "Invalid belt rotation variant");
|
||||
}
|
||||
case enumDirection.top: {
|
||||
return Loader.getSprite("sprites/blueprints/belt_top.png");
|
||||
}
|
||||
case enumDirection.left: {
|
||||
return Loader.getSprite("sprites/blueprints/belt_left.png");
|
||||
}
|
||||
case enumDirection.right: {
|
||||
return Loader.getSprite("sprites/blueprints/belt_right.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid belt rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,11 +292,11 @@ export class MetaBeltBuilding extends MetaBuilding {
|
||||
|
||||
MetaBeltBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new BeltComponent({
|
||||
direction: enumDirection.top, // updated later
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new BeltComponent({
|
||||
direction: enumDirection.top, // updated later
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaBeltBuilding.silhouetteColors = {
|
||||
@ -371,4 +363,4 @@ MetaBeltBuilding.additionalStatistics = {
|
||||
[defaultBuildingVariant]: root => [
|
||||
[T.ingame.buildingPlacement.infoTexts.speed, formatItemsPerSecond(root.hubGoals.getBeltBaseSpeed())],
|
||||
],
|
||||
};
|
||||
};
|
||||
|
@ -118,32 +118,33 @@ export class MetaComparatorBuilding extends MetaBuilding {
|
||||
|
||||
MetaComparatorBuilding.setupEntityComponents = [
|
||||
(entity, rotationVariant) =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
(entity, rotationVariant) =>
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.compare,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.compare,
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaComparatorBuilding.overlayMatrices = {
|
||||
@ -185,7 +186,8 @@ MetaComparatorBuilding.layerByVariant = {
|
||||
|
||||
MetaComparatorBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -204,4 +206,4 @@ MetaComparatorBuilding.componentVariations = {
|
||||
|
||||
entity.components.LogicGate.type = enumLogicGateType.compare;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -118,15 +118,17 @@ export class MetaConstantSignalBuilding extends MetaBuilding {
|
||||
|
||||
MetaConstantSignalBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new ConstantSignalComponent({})),
|
||||
];
|
||||
|
||||
@ -170,10 +172,12 @@ MetaConstantSignalBuilding.layerPreview = {
|
||||
|
||||
MetaConstantSignalBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -89,23 +89,25 @@ export class MetaCutterBuilding extends MetaBuilding {
|
||||
}
|
||||
MetaCutterBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.cutter,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.cutter,
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new ItemEjectorComponent({})),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaCutterBuilding.variants = {
|
||||
@ -197,4 +199,4 @@ MetaCutterBuilding.componentVariations = {
|
||||
]);
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.cutterQuad;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -105,15 +105,17 @@ export class MetaDisplayBuilding extends MetaBuilding {
|
||||
|
||||
MetaDisplayBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new DisplayComponent()),
|
||||
];
|
||||
|
||||
@ -155,10 +157,12 @@ MetaDisplayBuilding.renderPins = {
|
||||
|
||||
MetaDisplayBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -130,40 +130,45 @@ export class MetaFilterBuilding extends MetaBuilding {
|
||||
|
||||
MetaFilterBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
direction: enumDirection.right,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
direction: enumDirection.right,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity => entity.addComponent(new FilterComponent()),
|
||||
];
|
||||
@ -212,18 +217,23 @@ MetaFilterBuilding.renderPins = {
|
||||
|
||||
MetaFilterBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemEjector.setSlots([{
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
@ -233,4 +243,4 @@ MetaFilterBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -122,100 +122,103 @@ MetaHubBuilding.canPipet = () => false;
|
||||
MetaHubBuilding.setupEntityComponents = [
|
||||
entity => entity.addComponent(new HubComponent()),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.hub,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.hub,
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 2),
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
direction: enumDirection.left,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 2),
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
direction: enumDirection.left,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.top, enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(2, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 0),
|
||||
directions: [enumDirection.top, enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 3),
|
||||
directions: [enumDirection.bottom, enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 3),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(2, 3),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 3),
|
||||
directions: [enumDirection.bottom, enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 2),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 3),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 1),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 2),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 3),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.top, enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(2, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 0),
|
||||
directions: [enumDirection.top, enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 3),
|
||||
directions: [enumDirection.bottom, enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 3),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(2, 3),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 3),
|
||||
directions: [enumDirection.bottom, enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 2),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 3),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 1),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 2),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(3, 3),
|
||||
directions: [enumDirection.right],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaHubBuilding.silhouetteColors = {
|
||||
@ -256,13 +259,16 @@ MetaHubBuilding.componentVariations = {
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.hub;
|
||||
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 2),
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
direction: enumDirection.left,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 2),
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
direction: enumDirection.left,
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.top, enumDirection.left],
|
||||
filter: "shape",
|
||||
@ -334,4 +340,4 @@ MetaHubBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -98,21 +98,23 @@ export class MetaItemProducerBuilding extends MetaBuilding {
|
||||
|
||||
MetaItemProducerBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
direction: enumDirection.bottom,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
direction: enumDirection.bottom,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
|
||||
entity => entity.addComponent(new ItemProducerComponent()),
|
||||
];
|
||||
@ -153,10 +155,12 @@ MetaItemProducerBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.ItemEjector.setSlots([{ pos: new Vector(0, 0), direction: enumDirection.top }]);
|
||||
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
direction: enumDirection.bottom,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
direction: enumDirection.bottom,
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -121,15 +121,17 @@ export class MetaLeverBuilding extends MetaBuilding {
|
||||
|
||||
MetaLeverBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new LeverComponent({})),
|
||||
];
|
||||
|
||||
@ -172,10 +174,12 @@ MetaLeverBuilding.renderPins = {
|
||||
|
||||
MetaLeverBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
}, ]);
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -117,11 +117,11 @@ export class MetaLogicGateBuilding extends MetaBuilding {
|
||||
}
|
||||
MetaLogicGateBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new LogicGateComponent({})),
|
||||
];
|
||||
|
||||
@ -202,7 +202,8 @@ MetaLogicGateBuilding.layerPreview = {
|
||||
|
||||
MetaLogicGateBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -223,7 +224,8 @@ MetaLogicGateBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaLogicGateBuilding.variants.xor]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -244,7 +246,8 @@ MetaLogicGateBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaLogicGateBuilding.variants.or]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -264,7 +267,8 @@ MetaLogicGateBuilding.componentVariations = {
|
||||
entity.components.LogicGate.type = enumLogicGateType.or;
|
||||
},
|
||||
[MetaLogicGateBuilding.variants.not]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -278,4 +282,4 @@ MetaLogicGateBuilding.componentVariations = {
|
||||
|
||||
entity.components.LogicGate.type = enumLogicGateType.not;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -115,11 +115,11 @@ export class MetaMinerBuilding extends MetaBuilding {
|
||||
MetaMinerBuilding.setupEntityComponents = [
|
||||
entity => entity.addComponent(new MinerComponent({})),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
];
|
||||
MetaMinerBuilding.variants = {
|
||||
chainable: "chainable",
|
||||
@ -189,4 +189,4 @@ MetaMinerBuilding.componentVariations = {
|
||||
[MetaMinerBuilding.variants.chainable]: (entity, rotationVariant) => {
|
||||
entity.components.Miner.chainable = true;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -115,35 +115,36 @@ export class MetaMixerBuilding extends MetaBuilding {
|
||||
|
||||
MetaMixerBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 2,
|
||||
processorType: enumItemProcessorTypes.mixer,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 2,
|
||||
processorType: enumItemProcessorTypes.mixer,
|
||||
})
|
||||
),
|
||||
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaMixerBuilding.silhouetteColors = {
|
||||
@ -195,7 +196,8 @@ MetaMixerBuilding.componentVariations = {
|
||||
|
||||
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),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "color",
|
||||
@ -207,4 +209,4 @@ MetaMixerBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -121,27 +121,28 @@ export class MetaPainterBuilding extends MetaBuilding {
|
||||
MetaPainterBuilding.setupEntityComponents = [
|
||||
entity => entity.addComponent(new ItemProcessorComponent({})),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(1, 0), direction: enumDirection.right }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(1, 0), direction: enumDirection.right }],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "color",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.top],
|
||||
filter: "color",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaPainterBuilding.variants = {
|
||||
@ -251,7 +252,8 @@ MetaPainterBuilding.componentVariations = {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
@ -275,7 +277,8 @@ MetaPainterBuilding.componentVariations = {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
@ -299,7 +302,8 @@ MetaPainterBuilding.componentVariations = {
|
||||
entity.removeComponent(WiredPinsComponent);
|
||||
}
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
@ -328,7 +332,8 @@ MetaPainterBuilding.componentVariations = {
|
||||
entity.addComponent(new WiredPinsComponent({ slots: [] }));
|
||||
}
|
||||
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
@ -350,7 +355,8 @@ MetaPainterBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.left],
|
||||
filter: "shape",
|
||||
@ -383,4 +389,4 @@ MetaPainterBuilding.componentVariations = {
|
||||
entity.components.ItemProcessor.processingRequirement = enumItemProcessorRequirements.painterQuad;
|
||||
entity.components.ItemProcessor.inputsPerCharge = 5;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -132,55 +132,62 @@ export class MetaReaderBuilding extends MetaBuilding {
|
||||
|
||||
MetaReaderBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
processorType: enumItemProcessorTypes.reader,
|
||||
inputsPerCharge: 1,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
processorType: enumItemProcessorTypes.reader,
|
||||
inputsPerCharge: 1,
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new BeltUnderlaysComponent({
|
||||
underlays: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new BeltUnderlaysComponent({
|
||||
underlays: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new BeltReaderComponent()),
|
||||
];
|
||||
|
||||
@ -229,23 +236,29 @@ MetaReaderBuilding.renderPins = {
|
||||
|
||||
MetaReaderBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
|
||||
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.ItemProcessor.inputsPerCharge = 1;
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.reader;
|
||||
|
||||
entity.components.BeltUnderlays.underlays = [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
}, ];
|
||||
entity.components.BeltUnderlays.underlays = [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -129,28 +129,30 @@ export class MetaRotaterBuilding extends MetaBuilding {
|
||||
|
||||
MetaRotaterBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.rotater,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.rotater,
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaRotaterBuilding.variants = {
|
||||
@ -262,4 +264,4 @@ MetaRotaterBuilding.componentVariations = {
|
||||
[MetaRotaterBuilding.variants.rotate180]: (entity, rotationVariant) => {
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.rotater180;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -129,34 +129,35 @@ export class MetaStackerBuilding extends MetaBuilding {
|
||||
|
||||
MetaStackerBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 2,
|
||||
processorType: enumItemProcessorTypes.stacker,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 2,
|
||||
processorType: enumItemProcessorTypes.stacker,
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{ pos: new Vector(0, 0), direction: enumDirection.top }],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaStackerBuilding.dimensions = {
|
||||
@ -216,7 +217,8 @@ MetaStackerBuilding.componentVariations = {
|
||||
|
||||
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),
|
||||
directions: [enumDirection.bottom],
|
||||
filter: "shape",
|
||||
@ -228,4 +230,4 @@ MetaStackerBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -132,56 +132,59 @@ export class MetaStorageBuilding extends MetaBuilding {
|
||||
|
||||
MetaStorageBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
// Required, since the item processor needs this.
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
// Required, since the item processor needs this.
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 1),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
{
|
||||
pos: new Vector(1, 1),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new StorageComponent({
|
||||
maximumStorage: storageSize,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new StorageComponent({
|
||||
maximumStorage: storageSize,
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(1, 1),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(1, 1),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaStorageBuilding.dimensions = {
|
||||
@ -232,7 +235,8 @@ MetaStorageBuilding.renderPins = {
|
||||
|
||||
MetaStorageBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.ItemEjector.setSlots([{
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
@ -241,7 +245,8 @@ MetaStorageBuilding.componentVariations = {
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
]);
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 1),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
@ -251,7 +256,8 @@ MetaStorageBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
entity.components.Storage.maximumStorage = storageSize;
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(1, 1),
|
||||
direction: enumDirection.right,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -263,4 +269,4 @@ MetaStorageBuilding.componentVariations = {
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -118,32 +118,33 @@ export class MetaTransistorBuilding extends MetaBuilding {
|
||||
|
||||
MetaTransistorBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.bottom,
|
||||
type: enumPinSlotType.logicalAcceptor,
|
||||
},
|
||||
],
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.transistor,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new LogicGateComponent({
|
||||
type: enumLogicGateType.transistor,
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaTransistorBuilding.variants = {
|
||||
@ -206,4 +207,4 @@ MetaTransistorBuilding.componentVariations = {
|
||||
[MetaTransistorBuilding.variants.mirrored]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.slots[1].direction = enumDirection.right;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -120,26 +120,28 @@ export class MetaTrashBuilding extends MetaBuilding {
|
||||
|
||||
MetaTrashBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [
|
||||
enumDirection.top,
|
||||
enumDirection.right,
|
||||
enumDirection.bottom,
|
||||
enumDirection.left,
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [
|
||||
enumDirection.top,
|
||||
enumDirection.right,
|
||||
enumDirection.bottom,
|
||||
enumDirection.left,
|
||||
],
|
||||
},
|
||||
],
|
||||
}, ],
|
||||
})
|
||||
),
|
||||
})
|
||||
),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.trash,
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemProcessorComponent({
|
||||
inputsPerCharge: 1,
|
||||
processorType: enumItemProcessorTypes.trash,
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaTrashBuilding.overlayMatrices = {
|
||||
@ -182,18 +184,20 @@ MetaTrashBuilding.avaibleVariants = {
|
||||
|
||||
MetaTrashBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [
|
||||
enumDirection.top,
|
||||
enumDirection.right,
|
||||
enumDirection.bottom,
|
||||
enumDirection.left,
|
||||
],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [
|
||||
enumDirection.top,
|
||||
enumDirection.right,
|
||||
enumDirection.bottom,
|
||||
enumDirection.left,
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
entity.components.ItemProcessor.inputsPerCharge = 1;
|
||||
|
||||
entity.components.ItemProcessor.type = enumItemProcessorTypes.trash;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -188,7 +188,8 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
const targetSenderRotation = rotation;
|
||||
|
||||
for (
|
||||
let searchOffset = 1; searchOffset <= globalConfig.undergroundBeltMaxTilesByTier[tier];
|
||||
let searchOffset = 1;
|
||||
searchOffset <= globalConfig.undergroundBeltMaxTilesByTier[tier];
|
||||
++searchOffset
|
||||
) {
|
||||
tile = tile.addScalars(searchVector.x, searchVector.y);
|
||||
@ -245,18 +246,18 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
|
||||
MetaUndergroundBeltBuilding.setupEntityComponents = [
|
||||
// Required, since the item processor needs this.
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemEjectorComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new UndergroundBeltComponent({})),
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new ItemAcceptorComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
];
|
||||
|
||||
MetaUndergroundBeltBuilding.rotationVariants = [0, 1];
|
||||
@ -360,18 +361,22 @@ MetaUndergroundBeltBuilding.componentVariationsByRotation = {
|
||||
[enumUndergroundBeltMode.sender]: (entity, rotationVariant) => {
|
||||
entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.sender;
|
||||
entity.components.ItemEjector.setSlots([]);
|
||||
entity.components.ItemAcceptor.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
}, ]);
|
||||
entity.components.ItemAcceptor.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
directions: [enumDirection.bottom],
|
||||
},
|
||||
]);
|
||||
},
|
||||
|
||||
[enumUndergroundBeltMode.receiver]: (entity, rotationVariant) => {
|
||||
entity.components.UndergroundBelt.mode = enumUndergroundBeltMode.receiver;
|
||||
entity.components.ItemAcceptor.setSlots([]);
|
||||
entity.components.ItemEjector.setSlots([{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
}, ]);
|
||||
entity.components.ItemEjector.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
},
|
||||
]);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -121,11 +121,11 @@ export class MetaVirtualProcessorBuilding extends MetaBuilding {
|
||||
|
||||
MetaVirtualProcessorBuilding.setupEntityComponents = [
|
||||
entity =>
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity.addComponent(
|
||||
new WiredPinsComponent({
|
||||
slots: [],
|
||||
})
|
||||
),
|
||||
entity => entity.addComponent(new LogicGateComponent({})),
|
||||
];
|
||||
|
||||
@ -219,7 +219,8 @@ MetaVirtualProcessorBuilding.silhouetteColors = {
|
||||
|
||||
MetaVirtualProcessorBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -240,7 +241,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaVirtualProcessorBuilding.variants.rotater]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -256,7 +258,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaVirtualProcessorBuilding.variants.unstacker]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.left,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -277,7 +280,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaVirtualProcessorBuilding.variants.stacker]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -298,7 +302,8 @@ MetaVirtualProcessorBuilding.componentVariations = {
|
||||
},
|
||||
|
||||
[MetaVirtualProcessorBuilding.variants.painter]: (entity, rotationVariant) => {
|
||||
entity.components.WiredPins.setSlots([{
|
||||
entity.components.WiredPins.setSlots([
|
||||
{
|
||||
pos: new Vector(0, 0),
|
||||
direction: enumDirection.top,
|
||||
type: enumPinSlotType.logicalEjector,
|
||||
@ -317,4 +322,4 @@ MetaVirtualProcessorBuilding.componentVariations = {
|
||||
|
||||
entity.components.LogicGate.type = enumLogicGateType.painter;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -151,26 +151,21 @@ export class MetaWireBuilding extends MetaBuilding {
|
||||
getPreviewSprite(rotationVariant, variant) {
|
||||
const wireVariant = MetaWireBuilding.wireVariantToVariant[variant];
|
||||
switch (MetaWireBuilding.rotationVariantToType[rotationVariant]) {
|
||||
case enumWireType.forward:
|
||||
{
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_forward.png");
|
||||
}
|
||||
case enumWireType.turn:
|
||||
{
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_turn.png");
|
||||
}
|
||||
case enumWireType.split:
|
||||
{
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png");
|
||||
}
|
||||
case enumWireType.cross:
|
||||
{
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png");
|
||||
}
|
||||
default:
|
||||
{
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
case enumWireType.forward: {
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_forward.png");
|
||||
}
|
||||
case enumWireType.turn: {
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_turn.png");
|
||||
}
|
||||
case enumWireType.split: {
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_split.png");
|
||||
}
|
||||
case enumWireType.cross: {
|
||||
return Loader.getSprite("sprites/wires/sets/" + wireVariant + "_cross.png");
|
||||
}
|
||||
default: {
|
||||
assertAlways(false, "Invalid wire rotation variant");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,4 +393,4 @@ MetaWireBuilding.componentVariations = {
|
||||
entity.components.Wire.type = MetaWireBuilding.rotationVariantToType[rotationVariant];
|
||||
entity.components.Wire.variant = "second";
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -157,4 +157,4 @@ MetaWireTunnelBuilding.layerByVariant = {
|
||||
|
||||
MetaWireTunnelBuilding.componentVariations = {
|
||||
[defaultBuildingVariant]: (entity, rotationVariant) => {},
|
||||
};
|
||||
};
|
||||
|
@ -71,4 +71,4 @@ export function initComponentRegistry() {
|
||||
);
|
||||
|
||||
console.log("📦 There are", gComponentRegistry.getNumEntries(), "components");
|
||||
}
|
||||
}
|
||||
|
@ -66,18 +66,16 @@ export class BeltComponent extends Component {
|
||||
assert(progress <= 1.02, "Invalid progress: " + progress);
|
||||
return new Vector(0, 0.5 - progress);
|
||||
|
||||
case enumDirection.right:
|
||||
{
|
||||
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 2: " + progress);
|
||||
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));
|
||||
}
|
||||
case enumDirection.left:
|
||||
{
|
||||
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 3: " + progress);
|
||||
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));
|
||||
}
|
||||
case enumDirection.right: {
|
||||
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 2: " + progress);
|
||||
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));
|
||||
}
|
||||
case enumDirection.left: {
|
||||
assert(progress <= BeltComponent.curvedBeltLength + 0.02, "Invalid progress 3: " + progress);
|
||||
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:
|
||||
assertAlways(false, "Invalid belt direction: " + this.direction);
|
||||
return new Vector(0, 0);
|
||||
@ -115,4 +113,4 @@ BeltComponent.fake_belt_ejector_slot_by_direction = {
|
||||
item: null,
|
||||
progress: 0,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -41,4 +41,4 @@ export class BeltReaderComponent extends Component {
|
||||
*/
|
||||
this.lastThroughputComputation = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -201,38 +201,34 @@ export class StaticMapEntityComponent extends Component {
|
||||
const size = this.getTileSize();
|
||||
|
||||
switch (this.rotation) {
|
||||
case 0:
|
||||
{
|
||||
x = this.origin.x;
|
||||
y = this.origin.y;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
break;
|
||||
}
|
||||
case 90:
|
||||
{
|
||||
x = this.origin.x - size.y + 1;
|
||||
y = this.origin.y;
|
||||
w = size.y;
|
||||
h = size.x;
|
||||
break;
|
||||
}
|
||||
case 180:
|
||||
{
|
||||
x = this.origin.x - size.x + 1;
|
||||
y = this.origin.y - size.y + 1;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
break;
|
||||
}
|
||||
case 270:
|
||||
{
|
||||
x = this.origin.x;
|
||||
y = this.origin.y - size.x + 1;
|
||||
w = size.y;
|
||||
h = size.x;
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
x = this.origin.x;
|
||||
y = this.origin.y;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
break;
|
||||
}
|
||||
case 90: {
|
||||
x = this.origin.x - size.y + 1;
|
||||
y = this.origin.y;
|
||||
w = size.y;
|
||||
h = size.x;
|
||||
break;
|
||||
}
|
||||
case 180: {
|
||||
x = this.origin.x - size.x + 1;
|
||||
y = this.origin.y - size.y + 1;
|
||||
w = size.x;
|
||||
h = size.y;
|
||||
break;
|
||||
}
|
||||
case 270: {
|
||||
x = this.origin.x;
|
||||
y = this.origin.y - size.x + 1;
|
||||
w = size.y;
|
||||
h = size.x;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
assert(false, "Invalid rotation");
|
||||
}
|
||||
@ -281,7 +277,9 @@ export class StaticMapEntityComponent extends Component {
|
||||
parameters.context.translate(rotationCenterX, rotationCenterY);
|
||||
parameters.context.rotate(Math.radians(this.rotation));
|
||||
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.y + 2 * extrudePixels * size.y,
|
||||
false // no clipping possible here
|
||||
@ -290,4 +288,4 @@ export class StaticMapEntityComponent extends Component {
|
||||
parameters.context.translate(-rotationCenterX, -rotationCenterY);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,4 +34,4 @@ export class WireComponent extends Component {
|
||||
*/
|
||||
this.linkedNetwork = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -422,7 +422,9 @@ export class GameCore {
|
||||
// Transform to world space
|
||||
|
||||
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);
|
||||
@ -521,11 +523,11 @@ export class GameCore {
|
||||
context.fillStyle = "blue";
|
||||
context.fillText(
|
||||
"Atlas: " +
|
||||
desiredAtlasScale +
|
||||
" / Zoom: " +
|
||||
round2Digits(zoomLevel) +
|
||||
" / Effective Zoom: " +
|
||||
round2Digits(effectiveZoomLevel),
|
||||
desiredAtlasScale +
|
||||
" / Zoom: " +
|
||||
round2Digits(zoomLevel) +
|
||||
" / Effective Zoom: " +
|
||||
round2Digits(effectiveZoomLevel),
|
||||
20,
|
||||
600
|
||||
);
|
||||
@ -534,31 +536,31 @@ export class GameCore {
|
||||
|
||||
context.fillText(
|
||||
"Maintained Buffers: " +
|
||||
stats.rootKeys +
|
||||
" root keys / " +
|
||||
stats.subKeys +
|
||||
" buffers / VRAM: " +
|
||||
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
||||
" MB",
|
||||
stats.rootKeys +
|
||||
" root keys / " +
|
||||
stats.subKeys +
|
||||
" buffers / VRAM: " +
|
||||
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
||||
" MB",
|
||||
20,
|
||||
620
|
||||
);
|
||||
const internalStats = getBufferStats();
|
||||
context.fillText(
|
||||
"Total Buffers: " +
|
||||
internalStats.bufferCount +
|
||||
" buffers / " +
|
||||
internalStats.backlogSize +
|
||||
" backlog / " +
|
||||
internalStats.backlogKeys +
|
||||
" keys in backlog / VRAM " +
|
||||
round2Digits(internalStats.vramUsage / (1024 * 1024)) +
|
||||
" MB / Backlog " +
|
||||
round2Digits(internalStats.backlogVramUsage / (1024 * 1024)) +
|
||||
" MB / Created " +
|
||||
internalStats.numCreated +
|
||||
" / Reused " +
|
||||
internalStats.numReused,
|
||||
internalStats.bufferCount +
|
||||
" buffers / " +
|
||||
internalStats.backlogSize +
|
||||
" backlog / " +
|
||||
internalStats.backlogKeys +
|
||||
" keys in backlog / VRAM " +
|
||||
round2Digits(internalStats.vramUsage / (1024 * 1024)) +
|
||||
" MB / Backlog " +
|
||||
round2Digits(internalStats.backlogVramUsage / (1024 * 1024)) +
|
||||
" MB / Created " +
|
||||
internalStats.numCreated +
|
||||
" / Reused " +
|
||||
internalStats.numReused,
|
||||
20,
|
||||
640
|
||||
);
|
||||
@ -572,4 +574,4 @@ export class GameCore {
|
||||
context.stroke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -235,4 +235,4 @@ export class Entity extends BasicSerializableObject {
|
||||
drawImpl(parameters) {
|
||||
abstract;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,4 +238,4 @@ export class EntityManager extends BasicSerializableObject {
|
||||
assert(false, "Trying to destroy entity twice");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,4 +73,4 @@ export class GameMode {
|
||||
getIsFreeplayAvailable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,4 +10,4 @@ export function initGameModeRegistry() {
|
||||
if (!shapezAPI.ingame.gamemodes.hasOwnProperty(gamemodeKey)) continue;
|
||||
gGameModeRegistry.register(shapezAPI.ingame.gamemodes[gamemodeKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,4 +14,4 @@ export function initGameSpeedRegistry() {
|
||||
if (!shapezAPI.ingame.gamespeed.hasOwnProperty(gamespeedKey)) continue;
|
||||
gGameSpeedRegistry.register(shapezAPI.ingame.gamespeed[gamespeedKey]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,4 +48,4 @@ export class GameSystem {
|
||||
startDraw(parameters) {
|
||||
this.draw(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -164,4 +164,4 @@ export class GameSystemManager {
|
||||
system.refreshCaches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,4 +134,4 @@ export class GameSystemWithFilter extends GameSystem {
|
||||
arrayDelete(this.allEntities, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,8 @@ export class HubGoals extends BasicSerializableObject {
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isEndOfDemoReached() {
|
||||
return (!this.root.gameMode.getIsFreeplayAvailable() &&
|
||||
return (
|
||||
!this.root.gameMode.getIsFreeplayAvailable() &&
|
||||
this.level >= this.root.gameMode.getLevelDefinitions().length
|
||||
);
|
||||
}
|
||||
@ -506,13 +507,13 @@ export class HubGoals extends BasicSerializableObject {
|
||||
HubGoals.getProcessorBaseSpeed = {
|
||||
trash: processorType => 1e30,
|
||||
hub: processorType => 1e30,
|
||||
balancer: function(processorType) {
|
||||
balancer: function (processorType) {
|
||||
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt * 2;
|
||||
},
|
||||
reader: function(processorType) {
|
||||
reader: function (processorType) {
|
||||
return globalConfig.beltSpeedItemsPerSecond * this.upgradeImprovements.belt;
|
||||
},
|
||||
mixer: function(processorType) {
|
||||
mixer: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -523,7 +524,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
painter: function(processorType) {
|
||||
painter: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -534,7 +535,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
painterDouble: function(processorType) {
|
||||
painterDouble: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -545,7 +546,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
painterQuad: function(processorType) {
|
||||
painterQuad: function (processorType) {
|
||||
assert(
|
||||
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(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -568,7 +569,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
cutterQuad: function(processorType) {
|
||||
cutterQuad: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -579,7 +580,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
rotater: function(processorType) {
|
||||
rotater: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -590,7 +591,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
rotaterCCW: function(processorType) {
|
||||
rotaterCCW: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -601,7 +602,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
rotater180: function(processorType) {
|
||||
rotater180: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -612,7 +613,7 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
stacker: function(processorType) {
|
||||
stacker: function (processorType) {
|
||||
assert(
|
||||
globalConfig.buildingSpeeds[processorType],
|
||||
"Processor type has no speed set in globalConfig.buildingSpeeds:()=> " + processorType
|
||||
@ -623,4 +624,4 @@ HubGoals.getProcessorBaseSpeed = {
|
||||
globalConfig.buildingSpeeds[processorType]
|
||||
);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -164,4 +164,4 @@ export class BaseHUDPart {
|
||||
"mapMoveLeft",
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,4 +342,4 @@ export class GameHUD {
|
||||
this.signals[key].removeAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
||||
* @param {Layer=} param0.layer
|
||||
*/
|
||||
constructor(
|
||||
root, { primaryBuildings, secondaryBuildings = [], visibilityCondition, htmlElementId, layer = "regular" }
|
||||
root,
|
||||
{ primaryBuildings, secondaryBuildings = [], visibilityCondition, htmlElementId, layer = "regular" }
|
||||
) {
|
||||
super(root);
|
||||
|
||||
@ -81,7 +82,8 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
||||
|
||||
const itemContainer = makeDiv(
|
||||
this.primaryBuildings.includes(allBuildings[i]) ? rowPrimary : rowSecondary,
|
||||
null, ["building"]
|
||||
null,
|
||||
["building"]
|
||||
);
|
||||
itemContainer.setAttribute("data-icon", "building_icons/" + metaBuilding.getId() + ".png");
|
||||
itemContainer.setAttribute("data-id", metaBuilding.getId());
|
||||
@ -159,9 +161,9 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
||||
|
||||
let newBuildingFound = false;
|
||||
let newIndex = this.lastSelectedIndex;
|
||||
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed ?
|
||||
-1 :
|
||||
1;
|
||||
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed
|
||||
? -1
|
||||
: 1;
|
||||
|
||||
for (let i = 0; i <= this.primaryBuildings.length; ++i) {
|
||||
newIndex = safeModulo(newIndex + direction, this.primaryBuildings.length);
|
||||
@ -227,4 +229,4 @@ export class HUDBaseToolbar extends BaseHUDPart {
|
||||
this.root.hud.signals.buildingSelectedForPlacement.dispatch(metaBuilding);
|
||||
this.onSelectedPlacementBuildingChanged(metaBuilding);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
this.buildingInfoElements.descText = makeDiv(this.buildingInfoElements.desc, null, ["text"], "");
|
||||
this.buildingInfoElements.additionalInfo = makeDiv(
|
||||
this.buildingInfoElements.desc,
|
||||
null, ["additionalInfo"],
|
||||
null,
|
||||
["additionalInfo"],
|
||||
""
|
||||
);
|
||||
this.buildingInfoElements.hotkey = makeDiv(this.buildingInfoElements.desc, null, ["hotkey"], "");
|
||||
@ -135,9 +136,9 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
this.buildingInfoElements.tutorialImage.setAttribute(
|
||||
"data-icon",
|
||||
"building_tutorials/" +
|
||||
metaBuilding.getId() +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
metaBuilding.getId() +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
);
|
||||
|
||||
removeAllChildren(this.buildingInfoElements.additionalInfo);
|
||||
@ -189,14 +190,15 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
|
||||
makeDiv(
|
||||
this.variantsElement,
|
||||
null, ["explanation"],
|
||||
null,
|
||||
["explanation"],
|
||||
T.ingame.buildingPlacement.cycleBuildingVariants.replace(
|
||||
"<key>",
|
||||
"<code class='keybinding'>" +
|
||||
this.root.keyMapper
|
||||
.getBinding(KEYMAPPINGS.placement.cycleBuildingVariants)
|
||||
.getKeyCodeString() +
|
||||
"</code>"
|
||||
this.root.keyMapper
|
||||
.getBinding(KEYMAPPINGS.placement.cycleBuildingVariants)
|
||||
.getKeyCodeString() +
|
||||
"</code>"
|
||||
)
|
||||
);
|
||||
|
||||
@ -442,10 +444,12 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
parameters.context.translate(worldPos.x, worldPos.y);
|
||||
parameters.context.rotate(angle);
|
||||
parameters.context.drawImage(
|
||||
arrowSprite, -6, -globalConfig.halfTileSize -
|
||||
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
|
||||
globalConfig.halfTileSize -
|
||||
6,
|
||||
arrowSprite,
|
||||
-6,
|
||||
-globalConfig.halfTileSize -
|
||||
clamp((this.root.time.realtimeNow() * 1.5) % 1.0, 0, 1) * 1 * globalConfig.tileSize +
|
||||
globalConfig.halfTileSize -
|
||||
6,
|
||||
12,
|
||||
12
|
||||
);
|
||||
@ -498,7 +502,8 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
|
||||
// Go over all slots
|
||||
for (
|
||||
let acceptorDirectionIndex = 0; acceptorDirectionIndex < slot.directions.length;
|
||||
let acceptorDirectionIndex = 0;
|
||||
acceptorDirectionIndex < slot.directions.length;
|
||||
++acceptorDirectionIndex
|
||||
) {
|
||||
const direction = slot.directions[acceptorDirectionIndex];
|
||||
@ -529,7 +534,7 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
} else if (
|
||||
sourceBeltComp &&
|
||||
sourceStaticComp.localDirectionToWorld(sourceBeltComp.direction) ===
|
||||
enumInvertedDirections[worldDirection]
|
||||
enumInvertedDirections[worldDirection]
|
||||
) {
|
||||
// Belt connected
|
||||
isConnected = true;
|
||||
@ -615,4 +620,4 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic {
|
||||
parameters.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -279,20 +279,20 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
* Tries to rotate the current building
|
||||
*/
|
||||
tryRotate() {
|
||||
const selectedBuilding = this.currentMetaBuilding.get();
|
||||
if (selectedBuilding) {
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
||||
this.currentBaseRotation = (this.currentBaseRotation + 270) % 360;
|
||||
} else {
|
||||
this.currentBaseRotation = (this.currentBaseRotation + 90) % 360;
|
||||
}
|
||||
const staticComp = this.fakeEntity.components.StaticMapEntity;
|
||||
staticComp.rotation = this.currentBaseRotation;
|
||||
const selectedBuilding = this.currentMetaBuilding.get();
|
||||
if (selectedBuilding) {
|
||||
if (this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier).pressed) {
|
||||
this.currentBaseRotation = (this.currentBaseRotation + 270) % 360;
|
||||
} else {
|
||||
this.currentBaseRotation = (this.currentBaseRotation + 90) % 360;
|
||||
}
|
||||
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() {
|
||||
const mousePosition = this.root.app.mousePosition;
|
||||
if (!mousePosition) {
|
||||
@ -443,7 +443,8 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
}
|
||||
|
||||
// Check if we should stop placement
|
||||
if (!metaBuilding.getStayInPlacementMode() &&
|
||||
if (
|
||||
!metaBuilding.getStayInPlacementMode() &&
|
||||
!this.root.keyMapper.getBinding(KEYMAPPINGS.placementModifiers.placeMultiple).pressed &&
|
||||
!this.root.app.settings.getAllSettings().alwaysMultiplace
|
||||
) {
|
||||
@ -471,9 +472,9 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
console.warn("Invalid variant selected:", this.currentVariant.get());
|
||||
}
|
||||
const direction = this.root.keyMapper.getBinding(KEYMAPPINGS.placement.rotateInverseModifier)
|
||||
.pressed ?
|
||||
-1 :
|
||||
1;
|
||||
.pressed
|
||||
? -1
|
||||
: 1;
|
||||
|
||||
const newIndex = safeModulo(index + direction, availableVariants.length);
|
||||
const newVariant = availableVariants[newIndex];
|
||||
@ -804,4 +805,4 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
||||
|
||||
this.abortDragging();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,4 +52,4 @@ HUDBuildingsToolbar.bar = {
|
||||
MetaDisplayBuilding,
|
||||
],
|
||||
htmlElementId: "ingame_HUD_BuildingsToolbar",
|
||||
};
|
||||
};
|
||||
|
@ -103,9 +103,9 @@ export class HUDMinerHighlight extends BaseHUDPart {
|
||||
parameters.context.globalAlpha = 0.6;
|
||||
parameters.context.font = "bold " + scale * 8 + "px GameFont";
|
||||
parameters.context.fillText(
|
||||
connectedEntities.length === 1 ?
|
||||
T.ingame.connectedMiners.one_miner :
|
||||
T.ingame.connectedMiners.n_miners.replace("<amount>", String(connectedEntities.length)),
|
||||
connectedEntities.length === 1
|
||||
? T.ingame.connectedMiners.one_miner
|
||||
: T.ingame.connectedMiners.n_miners.replace("<amount>", String(connectedEntities.length)),
|
||||
tooltipLocation.x + 10 * scale,
|
||||
tooltipLocation.y + 22 * scale
|
||||
);
|
||||
@ -173,4 +173,4 @@ export class HUDMinerHighlight extends BaseHUDPart {
|
||||
|
||||
return results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ export class HUDSettingsMenu extends BaseHUDPart {
|
||||
|
||||
this.statsElement = makeDiv(
|
||||
this.background,
|
||||
null, ["statsElement"],
|
||||
null,
|
||||
["statsElement"],
|
||||
`
|
||||
<strong>${T.ingame.settingsMenu.beltsPlaced}</strong><span class="beltsPlaced"></span>
|
||||
<strong>${T.ingame.settingsMenu.buildingsPlaced}</strong><span class="buildingsPlaced"></span>
|
||||
@ -91,7 +92,7 @@ export class HUDSettingsMenu extends BaseHUDPart {
|
||||
|
||||
buildingsPlacedElement.innerText = formatBigNumberFull(
|
||||
this.root.entityMgr.getAllWithComponent(StaticMapEntityComponent).length -
|
||||
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
||||
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
||||
);
|
||||
|
||||
beltsPlacedElement.innerText = formatBigNumberFull(
|
||||
@ -110,7 +111,8 @@ export class HUDSettingsMenu extends BaseHUDPart {
|
||||
}
|
||||
}
|
||||
|
||||
HUDSettingsMenu.buttons = [{
|
||||
HUDSettingsMenu.buttons = [
|
||||
{
|
||||
id: "continue",
|
||||
action: hudSettingsMenu => () => hudSettingsMenu.close(),
|
||||
options: {
|
||||
@ -131,4 +133,4 @@ HUDSettingsMenu.buttons = [{
|
||||
preventDefault: false,
|
||||
},
|
||||
},
|
||||
];
|
||||
];
|
||||
|
@ -244,4 +244,4 @@ export class HUDShop extends BaseHUDPart {
|
||||
isBlockingOverlay() {
|
||||
return this.visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,12 +44,13 @@ export class HUDWaypoints extends BaseHUDPart {
|
||||
* @param {HTMLElement} parent
|
||||
*/
|
||||
createElements(parent) {
|
||||
// Create the helper box on the lower right when zooming out
|
||||
if (this.root.app.settings.getAllSettings().offerHints) {
|
||||
this.hintElement = makeDiv(
|
||||
parent,
|
||||
"ingame_HUD_Waypoints_Hint", [],
|
||||
`
|
||||
// Create the helper box on the lower right when zooming out
|
||||
if (this.root.app.settings.getAllSettings().offerHints) {
|
||||
this.hintElement = makeDiv(
|
||||
parent,
|
||||
"ingame_HUD_Waypoints_Hint",
|
||||
[],
|
||||
`
|
||||
<strong class='title'>${T.ingame.waypoints.waypoints}</strong>
|
||||
<span class='desc'>${T.ingame.waypoints.description.replace(
|
||||
"<keybinding>",
|
||||
@ -643,4 +644,4 @@ export class HUDWaypoints extends BaseHUDPart {
|
||||
parameters.context.textBaseline = "alphabetic";
|
||||
parameters.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,8 @@ export class HUDWireInfo extends BaseHUDPart {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.root.camera.getIsMapOverlayActive() &&
|
||||
if (
|
||||
!this.root.camera.getIsMapOverlayActive() &&
|
||||
!this.root.logic.getIsEntityIntersectedWithMatrix(entity, worldPos)
|
||||
) {
|
||||
// Detailed intersection check
|
||||
@ -115,4 +116,4 @@ export class HUDWireInfo extends BaseHUDPart {
|
||||
}
|
||||
parameters.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,9 +146,9 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
||||
parameters.context.globalCompositeOperation = "source-over";
|
||||
|
||||
parameters.context.scale(scaleFactor, scaleFactor);
|
||||
parameters.context.fillStyle = hasTileGrid ?
|
||||
this.cachedPatternBackground :
|
||||
"rgba(78, 137, 125, 0.75)";
|
||||
parameters.context.fillStyle = hasTileGrid
|
||||
? this.cachedPatternBackground
|
||||
: "rgba(78, 137, 125, 0.75)";
|
||||
parameters.context.fillRect(
|
||||
bounds.x / scaleFactor,
|
||||
bounds.y / scaleFactor,
|
||||
@ -159,4 +159,4 @@ export class HUDWiresOverlay extends BaseHUDPart {
|
||||
|
||||
parameters.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,4 +45,4 @@ HUDWiresToolbar.bar = {
|
||||
MetaDisplayBuilding,
|
||||
],
|
||||
htmlElementId: "ingame_HUD_wires_toolbar",
|
||||
};
|
||||
};
|
||||
|
@ -15,4 +15,4 @@ export function initItemRegistry() {
|
||||
const itemClass = shapezAPI.ingame.items[itemId];
|
||||
gItemRegistry.register(itemClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,4 +19,4 @@ export function itemResolverSingleton(root, data) {
|
||||
assertAlways(false, "Unknown item type: " + itemType);
|
||||
}
|
||||
|
||||
export const typeItemSingleton = types.obj(gItemRegistry, itemResolverSingleton);
|
||||
export const typeItemSingleton = types.obj(gItemRegistry, itemResolverSingleton);
|
||||
|
@ -93,7 +93,7 @@ export const BOOL_TRUE_SINGLETON = new BooleanItem(1);
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isTrueItem(item) {
|
||||
return item && item.getItemType() === "boolean" && !!( /** @type {BooleanItem} */ (item).value);
|
||||
return item && item.getItemType() === "boolean" && !!(/** @type {BooleanItem} */ (item).value);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -107,8 +107,8 @@ export function isTruthyItem(item) {
|
||||
}
|
||||
|
||||
if (item.getItemType() === "boolean") {
|
||||
return !!( /** @type {BooleanItem} */ (item).value);
|
||||
return !!(/** @type {BooleanItem} */ (item).value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -102,4 +102,4 @@ ColorItem.ITEM_SINGLETONS = {};
|
||||
|
||||
for (const color in enumColors) {
|
||||
ColorItem.ITEM_SINGLETONS[color] = new ColorItem(color);
|
||||
}
|
||||
}
|
||||
|
@ -79,4 +79,4 @@ export class ShapeItem extends BaseItem {
|
||||
|
||||
ShapeItem.resolveSingleton = (root, itemData) => {
|
||||
return root.shapeDefinitionMgr.getShapeItemFromShortKey(itemData);
|
||||
};
|
||||
};
|
||||
|
@ -264,9 +264,9 @@ export function getStringForKeyCode(code) {
|
||||
return "'";
|
||||
}
|
||||
|
||||
return (48 <= code && code <= 57) || (65 <= code && code <= 90) ?
|
||||
String.fromCharCode(code) :
|
||||
"[" + code + "]";
|
||||
return (48 <= code && code <= 57) || (65 <= code && code <= 90)
|
||||
? String.fromCharCode(code)
|
||||
: "[" + code + "]";
|
||||
}
|
||||
|
||||
export class Keybinding {
|
||||
@ -478,4 +478,4 @@ export class KeyActionMapper {
|
||||
assert(this.keybindings[id], "Keybinding " + id + " not known!");
|
||||
return this.keybindings[id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -430,4 +430,4 @@ export class GameLogic {
|
||||
}
|
||||
return { ejectors, acceptors };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,9 +142,9 @@ export class MapChunkView extends MapChunk {
|
||||
*/
|
||||
generateOverlayBuffer(canvas, context, w, h, dpi) {
|
||||
context.fillStyle =
|
||||
this.containedEntities.length > 0 ?
|
||||
THEME.map.chunkOverview.filled :
|
||||
THEME.map.chunkOverview.empty;
|
||||
this.containedEntities.length > 0
|
||||
? THEME.map.chunkOverview.filled
|
||||
: THEME.map.chunkOverview.empty;
|
||||
context.fillRect(0, 0, w, h);
|
||||
|
||||
if (this.root.app.settings.getAllSettings().displayChunkBorders) {
|
||||
@ -350,4 +350,4 @@ export class MapChunkView extends MapChunk {
|
||||
system.drawChunk_ForegroundLayer(parameters, this, layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -216,4 +216,4 @@ export class MapView extends BaseMap {
|
||||
|
||||
this.drawVisibleChunks(parameters, MapChunkView.prototype.drawBackgroundLayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,9 +142,9 @@ export class MetaBuilding {
|
||||
getPreviewSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
||||
return Loader.getSprite(
|
||||
"sprites/buildings/" +
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
);
|
||||
}
|
||||
|
||||
@ -155,9 +155,9 @@ export class MetaBuilding {
|
||||
getBlueprintSprite(rotationVariant = 0, variant = defaultBuildingVariant) {
|
||||
return Loader.getSprite(
|
||||
"sprites/blueprints/" +
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
);
|
||||
}
|
||||
|
||||
@ -232,9 +232,9 @@ export class MetaBuilding {
|
||||
getSprite(rotationVariant, variant) {
|
||||
return Loader.getSprite(
|
||||
"sprites/buildings/" +
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
this.id +
|
||||
(variant === defaultBuildingVariant ? "" : "-" + variant) +
|
||||
".png"
|
||||
);
|
||||
}
|
||||
|
||||
@ -279,4 +279,4 @@ export class MetaBuilding {
|
||||
setupEntityComponents(entity, root) {
|
||||
abstract;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,4 +187,4 @@ export function initBuildingCodesAfterResourcesLoaded() {
|
||||
variant.rotationVariant
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,8 @@ function generateUpgrades(limitedVersion = false) {
|
||||
}
|
||||
|
||||
const upgrades = {
|
||||
belt: [{
|
||||
belt: [
|
||||
{
|
||||
required: [{ shape: "CuCuCuCu", amount: 30 }],
|
||||
},
|
||||
{
|
||||
@ -72,7 +73,8 @@ function generateUpgrades(limitedVersion = false) {
|
||||
...generateInfiniteUnlocks(),
|
||||
],
|
||||
|
||||
miner: [{
|
||||
miner: [
|
||||
{
|
||||
required: [{ shape: "RuRuRuRu", amount: 300 }],
|
||||
},
|
||||
{
|
||||
@ -101,7 +103,8 @@ function generateUpgrades(limitedVersion = false) {
|
||||
...generateInfiniteUnlocks(),
|
||||
],
|
||||
|
||||
processors: [{
|
||||
processors: [
|
||||
{
|
||||
required: [{ shape: "SuSuSuSu", amount: 500 }],
|
||||
},
|
||||
{
|
||||
@ -130,7 +133,8 @@ function generateUpgrades(limitedVersion = false) {
|
||||
...generateInfiniteUnlocks(),
|
||||
],
|
||||
|
||||
painting: [{
|
||||
painting: [
|
||||
{
|
||||
required: [{ shape: "RbRb----", amount: 600 }],
|
||||
},
|
||||
{
|
||||
@ -317,115 +321,117 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
},
|
||||
|
||||
// DEMO STOPS HERE
|
||||
...(limitedVersion ?
|
||||
[{
|
||||
shape: "RpRpRpRp:CwCwCwCw",
|
||||
required: 0,
|
||||
reward: enumHubGoalRewards.reward_demo_end,
|
||||
}, ] :
|
||||
[
|
||||
// 14
|
||||
// Belt reader
|
||||
{
|
||||
shape: "--Cg----:--Cr----", // unused
|
||||
required: 8, // Per second!
|
||||
reward: enumHubGoalRewards.reward_belt_reader,
|
||||
throughputOnly: true,
|
||||
},
|
||||
...(limitedVersion
|
||||
? [
|
||||
{
|
||||
shape: "RpRpRpRp:CwCwCwCw",
|
||||
required: 0,
|
||||
reward: enumHubGoalRewards.reward_demo_end,
|
||||
},
|
||||
]
|
||||
: [
|
||||
// 14
|
||||
// Belt reader
|
||||
{
|
||||
shape: "--Cg----:--Cr----", // unused
|
||||
required: 8, // Per second!
|
||||
reward: enumHubGoalRewards.reward_belt_reader,
|
||||
throughputOnly: true,
|
||||
},
|
||||
|
||||
// 15
|
||||
// Storage
|
||||
{
|
||||
shape: "SrSrSrSr:CyCyCyCy", // unused
|
||||
required: 10000,
|
||||
reward: enumHubGoalRewards.reward_storage,
|
||||
},
|
||||
// 15
|
||||
// Storage
|
||||
{
|
||||
shape: "SrSrSrSr:CyCyCyCy", // unused
|
||||
required: 10000,
|
||||
reward: enumHubGoalRewards.reward_storage,
|
||||
},
|
||||
|
||||
// 16
|
||||
// Quad Cutter
|
||||
{
|
||||
shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", // belts t4 (two variants)
|
||||
required: 6000,
|
||||
reward: enumHubGoalRewards.reward_cutter_quad,
|
||||
},
|
||||
// 16
|
||||
// Quad Cutter
|
||||
{
|
||||
shape: "SrSrSrSr:CyCyCyCy:SwSwSwSw", // belts t4 (two variants)
|
||||
required: 6000,
|
||||
reward: enumHubGoalRewards.reward_cutter_quad,
|
||||
},
|
||||
|
||||
// 17
|
||||
// Double painter
|
||||
{
|
||||
shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
|
||||
required: 20000,
|
||||
reward: enumHubGoalRewards.reward_painter_double,
|
||||
},
|
||||
// 17
|
||||
// Double painter
|
||||
{
|
||||
shape: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
|
||||
required: 20000,
|
||||
reward: enumHubGoalRewards.reward_painter_double,
|
||||
},
|
||||
|
||||
// 18
|
||||
// Rotater (180deg)
|
||||
{
|
||||
shape: "Sg----Sg:CgCgCgCg:--CyCy--", // unused
|
||||
required: 20000,
|
||||
reward: enumHubGoalRewards.reward_rotater_180,
|
||||
},
|
||||
// 18
|
||||
// Rotater (180deg)
|
||||
{
|
||||
shape: "Sg----Sg:CgCgCgCg:--CyCy--", // unused
|
||||
required: 20000,
|
||||
reward: enumHubGoalRewards.reward_rotater_180,
|
||||
},
|
||||
|
||||
// 19
|
||||
// Compact splitter
|
||||
{
|
||||
shape: "CpRpCp--:SwSwSwSw",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_splitter,
|
||||
},
|
||||
// 19
|
||||
// Compact splitter
|
||||
{
|
||||
shape: "CpRpCp--:SwSwSwSw",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_splitter,
|
||||
},
|
||||
|
||||
// 20
|
||||
// WIRES
|
||||
{
|
||||
shape: finalGameShape,
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_wires_painter_and_levers,
|
||||
},
|
||||
// 20
|
||||
// WIRES
|
||||
{
|
||||
shape: finalGameShape,
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_wires_painter_and_levers,
|
||||
},
|
||||
|
||||
// 21
|
||||
// Filter
|
||||
{
|
||||
shape: "CrCwCrCw:CwCrCwCr:CrCwCrCw:CwCrCwCr",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_filter,
|
||||
},
|
||||
// 21
|
||||
// Filter
|
||||
{
|
||||
shape: "CrCwCrCw:CwCrCwCr:CrCwCrCw:CwCrCwCr",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_filter,
|
||||
},
|
||||
|
||||
// 22
|
||||
// Constant signal
|
||||
{
|
||||
shape: "Cg----Cr:Cw----Cw:Sy------:Cy----Cy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_constant_signal,
|
||||
},
|
||||
// 22
|
||||
// Constant signal
|
||||
{
|
||||
shape: "Cg----Cr:Cw----Cw:Sy------:Cy----Cy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_constant_signal,
|
||||
},
|
||||
|
||||
// 23
|
||||
// Display
|
||||
{
|
||||
shape: "CcSyCcSy:SyCcSyCc:CcSyCcSy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_display,
|
||||
},
|
||||
// 23
|
||||
// Display
|
||||
{
|
||||
shape: "CcSyCcSy:SyCcSyCc:CcSyCcSy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_display,
|
||||
},
|
||||
|
||||
// 24 Logic gates
|
||||
{
|
||||
shape: "CcRcCcRc:RwCwRwCw:Sr--Sw--:CyCyCyCy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_logic_gates,
|
||||
},
|
||||
// 24 Logic gates
|
||||
{
|
||||
shape: "CcRcCcRc:RwCwRwCw:Sr--Sw--:CyCyCyCy",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_logic_gates,
|
||||
},
|
||||
|
||||
// 25 Virtual Processing
|
||||
{
|
||||
shape: "Rg--Rg--:CwRwCwRw:--Rg--Rg",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_virtual_processing,
|
||||
},
|
||||
// 25 Virtual Processing
|
||||
{
|
||||
shape: "Rg--Rg--:CwRwCwRw:--Rg--Rg",
|
||||
required: 25000,
|
||||
reward: enumHubGoalRewards.reward_virtual_processing,
|
||||
},
|
||||
|
||||
// 26 Freeplay
|
||||
{
|
||||
shape: "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw",
|
||||
required: 50000,
|
||||
reward: enumHubGoalRewards.reward_freeplay,
|
||||
},
|
||||
]),
|
||||
// 26 Freeplay
|
||||
{
|
||||
shape: "CbCuCbCu:Sr------:--CrSrCr:CwCwCwCw",
|
||||
required: 50000,
|
||||
reward: enumHubGoalRewards.reward_freeplay,
|
||||
},
|
||||
]),
|
||||
];
|
||||
|
||||
if (G_IS_DEV) {
|
||||
@ -457,9 +463,9 @@ export class RegularGameMode extends GameMode {
|
||||
}
|
||||
|
||||
getUpgrades() {
|
||||
return this.root.app.restrictionMgr.getHasExtendedUpgrades() ?
|
||||
fullVersionUpgrades :
|
||||
demoVersionUpgrades;
|
||||
return this.root.app.restrictionMgr.getHasExtendedUpgrades()
|
||||
? fullVersionUpgrades
|
||||
: demoVersionUpgrades;
|
||||
}
|
||||
|
||||
getIsFreeplayAvailable() {
|
||||
@ -471,8 +477,8 @@ export class RegularGameMode extends GameMode {
|
||||
}
|
||||
|
||||
getLevelDefinitions() {
|
||||
return this.root.app.restrictionMgr.getHasExtendedLevelsAndFreeplay() ?
|
||||
fullVersionLevels :
|
||||
demoVersionLevels;
|
||||
return this.root.app.restrictionMgr.getHasExtendedLevelsAndFreeplay()
|
||||
? fullVersionLevels
|
||||
: demoVersionLevels;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,4 +131,4 @@ export class ProductionAnalytics extends BasicSerializableObject {
|
||||
this.startNewSlice();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -222,4 +222,4 @@ export class GameRoot {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -607,10 +607,12 @@ ShapeDefinition.renderQuad = {
|
||||
context.beginPath();
|
||||
context.moveTo(insetPadding + -quadrantHalfSize, -insetPadding + quadrantHalfSize);
|
||||
context.arc(
|
||||
insetPadding + -quadrantHalfSize, -insetPadding + quadrantHalfSize,
|
||||
quadrantSize * layerScale, -Math.PI * 0.5,
|
||||
insetPadding + -quadrantHalfSize,
|
||||
-insetPadding + quadrantHalfSize,
|
||||
quadrantSize * layerScale,
|
||||
-Math.PI * 0.5,
|
||||
0
|
||||
);
|
||||
context.closePath();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
@ -502,7 +502,7 @@ export class BeltSystem extends GameSystemWithFilter {
|
||||
// 126 / 42 is the exact animation speed of the png animation
|
||||
const animationIndex = Math.floor(
|
||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||
globalConfig.itemSpacingOnBelts
|
||||
globalConfig.itemSpacingOnBelts
|
||||
);
|
||||
const contents = chunk.containedEntitiesByLayer.regular;
|
||||
|
||||
@ -555,4 +555,4 @@ export class BeltSystem extends GameSystemWithFilter {
|
||||
this.beltPaths[i].drawDebug(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ export class BeltReaderSystem extends GameSystemWithFilter {
|
||||
pinsComp.slots[1].value = readerComp.lastItem;
|
||||
pinsComp.slots[0].value =
|
||||
(readerComp.lastItemTimes[readerComp.lastItemTimes.length - 1] || 0) >
|
||||
minimumTimeForThroughput ?
|
||||
BOOL_TRUE_SINGLETON :
|
||||
BOOL_FALSE_SINGLETON;
|
||||
minimumTimeForThroughput
|
||||
? BOOL_TRUE_SINGLETON
|
||||
: BOOL_FALSE_SINGLETON;
|
||||
|
||||
if (now - readerComp.lastThroughputComputation > 0.5) {
|
||||
// Compute throughput
|
||||
@ -56,4 +56,4 @@ export class BeltReaderSystem extends GameSystemWithFilter {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -252,12 +252,14 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
||||
}
|
||||
|
||||
// Culling, Part 2: Check if the overlay is visible
|
||||
if (!parameters.visibleRect.containsRect4Params(
|
||||
if (
|
||||
!parameters.visibleRect.containsRect4Params(
|
||||
destX,
|
||||
destY,
|
||||
globalConfig.tileSize,
|
||||
globalConfig.tileSize
|
||||
)) {
|
||||
)
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -280,14 +282,16 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
||||
// SYNC with systems/belt.js:drawSingleEntity!
|
||||
const animationIndex = Math.floor(
|
||||
((this.root.time.realtimeNow() * speedMultiplier * BELT_ANIM_COUNT * 126) / 42) *
|
||||
globalConfig.itemSpacingOnBelts
|
||||
globalConfig.itemSpacingOnBelts
|
||||
);
|
||||
parameters.context.translate(x, y);
|
||||
parameters.context.rotate(angleRadians);
|
||||
this.underlayBeltSprites[
|
||||
animationIndex % this.underlayBeltSprites.length
|
||||
].drawCachedWithClipRect(
|
||||
parameters, -globalConfig.halfTileSize, -globalConfig.halfTileSize,
|
||||
parameters,
|
||||
-globalConfig.halfTileSize,
|
||||
-globalConfig.halfTileSize,
|
||||
globalConfig.tileSize,
|
||||
globalConfig.tileSize,
|
||||
clipRect
|
||||
@ -297,4 +301,4 @@ export class BeltUnderlaysSystem extends GameSystemWithFilter {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -172,4 +172,4 @@ export class ConstantSignalSystem extends GameSystemWithFilter {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ DisplaySystem.displayItemType = {
|
||||
|
||||
DisplaySystem.displayItem = {
|
||||
color: (parameters, value, origin, globalConfig) =>
|
||||
DisplaySystem.displaySprites[ /** @type {ColorItem} */ (value).color].drawCachedCentered(
|
||||
DisplaySystem.displaySprites[/** @type {ColorItem} */ (value).color].drawCachedCentered(
|
||||
parameters,
|
||||
(origin.x + 0.5) * globalConfig.tileSize,
|
||||
(origin.y + 0.5) * globalConfig.tileSize,
|
||||
@ -104,4 +104,4 @@ DisplaySystem.displayItem = {
|
||||
};
|
||||
|
||||
DisplaySystem.shapeRadius = () => 30;
|
||||
DisplaySystem.shapeBackground = () => true;
|
||||
DisplaySystem.shapeBackground = () => true;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user