mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-12-12 17:51:50 +00:00
Merge remote-tracking branch 'origin/master' into better-building-variants
This commit is contained in:
commit
88d457af0e
@ -64,7 +64,7 @@ This project is based on ES5. Some ES2015 features are used but most of them are
|
|||||||
5. Add a constructor. **The constructor must be called with optional parameters only!** `new MyFancyComponent({})` should always work.
|
5. Add a constructor. **The constructor must be called with optional parameters only!** `new MyFancyComponent({})` should always work.
|
||||||
6. Add any props you need in the constructor.
|
6. Add any props you need in the constructor.
|
||||||
7. Add the component in `src/js/game/component_registry.js`
|
7. Add the component in `src/js/game/component_registry.js`
|
||||||
8. Add the componetn in `src/js/game/entity_components.js`
|
8. Add the component in `src/js/game/entity_components.js`
|
||||||
9. Done! You can use your component now
|
9. Done! You can use your component now
|
||||||
|
|
||||||
#### Adding a new building
|
#### Adding a new building
|
||||||
@ -96,6 +96,6 @@ This project is based on ES5. Some ES2015 features are used but most of them are
|
|||||||
|
|
||||||
For most assets I use Adobe Photoshop, you can find them in `assets/`.
|
For most assets I use Adobe Photoshop, you can find them in `assets/`.
|
||||||
|
|
||||||
You will need a <a href="https://www.codeandweb.com/texturepacker" target="_blank">Texture Packer</a> license in order to regenerate the atlas. If you don't have one but want to contribute assets, let me know and I might compile it for you. I'm currently switching to an open source solution but I can't give an estimate when thats done.
|
You will need a <a href="https://www.codeandweb.com/texturepacker" target="_blank">Texture Packer</a> license in order to regenerate the atlas. If you don't have one but want to contribute assets, let me know and I might compile it for you. I'm currently switching to an open source solution but I can't give an estimate when that's done.
|
||||||
|
|
||||||
<img src="https://i.imgur.com/W25Fkl0.png" alt="shapez.io Screenshot">
|
<img src="https://i.imgur.com/W25Fkl0.png" alt="shapez.io Screenshot">
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 281 KiB After Width: | Height: | Size: 276 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 661 KiB After Width: | Height: | Size: 688 KiB |
@ -283,6 +283,7 @@
|
|||||||
<key type="filename">sprites/blueprints/virtual_processor-analyzer.png</key>
|
<key type="filename">sprites/blueprints/virtual_processor-analyzer.png</key>
|
||||||
<key type="filename">sprites/blueprints/virtual_processor-rotater.png</key>
|
<key type="filename">sprites/blueprints/virtual_processor-rotater.png</key>
|
||||||
<key type="filename">sprites/blueprints/virtual_processor-shapecompare.png</key>
|
<key type="filename">sprites/blueprints/virtual_processor-shapecompare.png</key>
|
||||||
|
<key type="filename">sprites/blueprints/virtual_processor-stacker.png</key>
|
||||||
<key type="filename">sprites/blueprints/virtual_processor-unstacker.png</key>
|
<key type="filename">sprites/blueprints/virtual_processor-unstacker.png</key>
|
||||||
<key type="filename">sprites/blueprints/virtual_processor.png</key>
|
<key type="filename">sprites/blueprints/virtual_processor.png</key>
|
||||||
<key type="filename">sprites/blueprints/wire_tunnel-coating.png</key>
|
<key type="filename">sprites/blueprints/wire_tunnel-coating.png</key>
|
||||||
@ -310,6 +311,7 @@
|
|||||||
<key type="filename">sprites/buildings/virtual_processor-analyzer.png</key>
|
<key type="filename">sprites/buildings/virtual_processor-analyzer.png</key>
|
||||||
<key type="filename">sprites/buildings/virtual_processor-rotater.png</key>
|
<key type="filename">sprites/buildings/virtual_processor-rotater.png</key>
|
||||||
<key type="filename">sprites/buildings/virtual_processor-shapecompare.png</key>
|
<key type="filename">sprites/buildings/virtual_processor-shapecompare.png</key>
|
||||||
|
<key type="filename">sprites/buildings/virtual_processor-stacker.png</key>
|
||||||
<key type="filename">sprites/buildings/virtual_processor-unstacker.png</key>
|
<key type="filename">sprites/buildings/virtual_processor-unstacker.png</key>
|
||||||
<key type="filename">sprites/buildings/virtual_processor.png</key>
|
<key type="filename">sprites/buildings/virtual_processor.png</key>
|
||||||
<key type="filename">sprites/buildings/wire_tunnel-coating.png</key>
|
<key type="filename">sprites/buildings/wire_tunnel-coating.png</key>
|
||||||
|
|||||||
@ -468,13 +468,24 @@ canvas {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
position: absolute;
|
||||||
|
@include S(left, 20px);
|
||||||
|
@include S(right, 20px);
|
||||||
|
@include S(bottom, 60px);
|
||||||
|
@include Text;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.loadingStatus {
|
.loadingStatus {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include S(left, 20px);
|
@include S(left, 20px);
|
||||||
@include S(right, 20px);
|
@include S(right, 20px);
|
||||||
@include S(bottom, 30px);
|
@include S(bottom, 30px);
|
||||||
@include Text;
|
@include Text;
|
||||||
@include TextShadow3D(#aaa);
|
@include PlainText;
|
||||||
|
color: #aaa;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
|||||||
@ -1,43 +1,79 @@
|
|||||||
#ingame_HUD_EntityDebugger {
|
#ingame_HUD_EntityDebugger {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
background: $ingameHudBg;
|
||||||
|
@include S(padding, 5px);
|
||||||
@include S(right, 30px);
|
@include S(right, 30px);
|
||||||
@include S(top, 200px);
|
|
||||||
|
|
||||||
font-size: 14px;
|
top: 50%;
|
||||||
line-height: 16px;
|
transform: translateY(-50%);
|
||||||
color: #fff;
|
|
||||||
background: rgba(0, 10, 20, 0.7);
|
@include SuperSmallText;
|
||||||
padding: 10px;
|
color: #eee;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
> label {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
&,
|
&,
|
||||||
* {
|
* {
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.flag {
|
.propertyTable {
|
||||||
display: inline-block;
|
@include S(margin-top, 8px);
|
||||||
background: #333438;
|
|
||||||
@include S(padding, 2px);
|
|
||||||
@include S(margin-right, 2px);
|
|
||||||
|
|
||||||
u {
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.components {
|
.propertyTable,
|
||||||
@include S(margin-top, 4px);
|
.entityComponents,
|
||||||
|
.entityComponents .object > div {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr auto;
|
||||||
@include S(grid-gap, 3px);
|
@include S(column-gap, 10px);
|
||||||
.component {
|
}
|
||||||
@include S(padding, 2px);
|
|
||||||
background: #333;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
.data {
|
.entityComponents {
|
||||||
@include S(width, 150px);
|
grid-column: 1 / 3;
|
||||||
@include S(height, 130px);
|
@include S(margin-top, 5px);
|
||||||
|
|
||||||
|
font-family: "Roboto Mono", "Fira Code", monospace;
|
||||||
|
font-size: 90%;
|
||||||
|
@include S(letter-spacing, -0.5px);
|
||||||
|
|
||||||
|
label,
|
||||||
|
span {
|
||||||
|
line-height: 1.5em;
|
||||||
|
|
||||||
|
&:not(span) {
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&,
|
||||||
|
* {
|
||||||
|
@include SuperSmallText;
|
||||||
|
@include S(font-size, 7px, $important: true);
|
||||||
|
@include S(line-height, 12px, $important: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
.object {
|
||||||
|
grid-column: 1 / 3;
|
||||||
|
line-height: 1.5em;
|
||||||
|
|
||||||
|
> summary {
|
||||||
|
transition: opacity 0.1s ease-in-out;
|
||||||
|
cursor: pointer;
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
> div {
|
||||||
|
@include S(margin-left, 4px);
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,6 +56,17 @@
|
|||||||
transform: scale(1.1, 1.1);
|
transform: scale(1.1, 1.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.saving {
|
||||||
|
@include InlineAnimation(0.4s ease-in-out infinite) {
|
||||||
|
50% {
|
||||||
|
opacity: 0.5;
|
||||||
|
transform: scale(0.8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pointer-events: none;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.settings {
|
&.settings {
|
||||||
|
|||||||
@ -1,138 +1,137 @@
|
|||||||
#ingame_HUD_PinnedShapes {
|
#ingame_HUD_PinnedShapes {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include S(left, 9px);
|
@include S(left, 9px);
|
||||||
@include S(top, 150px);
|
@include S(top, 150px);
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
|
|
||||||
> .shape {
|
> .shape {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: grid;
|
display: grid;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
grid-template-columns: auto 1fr;
|
grid-template-columns: auto 1fr;
|
||||||
grid-template-rows: 1fr 1fr;
|
grid-template-rows: 1fr 1fr;
|
||||||
@include S(margin-bottom, 4px);
|
@include S(margin-bottom, 4px);
|
||||||
color: #333438;
|
color: #333438;
|
||||||
// text-shadow: #{D(1px)} #{D(1px)} 0 rgba(0, 10, 20, 0.2);
|
// text-shadow: #{D(1px)} #{D(1px)} 0 rgba(0, 10, 20, 0.2);
|
||||||
filter: drop-shadow(#{D(1px)} #{D(1px)} 0 rgba(0, 10, 20, 0.2));
|
|
||||||
|
&.unpinable {
|
||||||
&.unpinable {
|
> canvas {
|
||||||
> canvas {
|
cursor: pointer;
|
||||||
cursor: pointer;
|
pointer-events: all;
|
||||||
pointer-events: all;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
> canvas {
|
||||||
> canvas {
|
@include S(width, 25px);
|
||||||
@include S(width, 25px);
|
@include S(height, 25px);
|
||||||
@include S(height, 25px);
|
grid-column: 1 / 2;
|
||||||
grid-column: 1 / 2;
|
grid-row: 1 / 3;
|
||||||
grid-row: 1 / 3;
|
pointer-events: all;
|
||||||
pointer-events: all;
|
transition: transform 0.1s ease-in-out;
|
||||||
transition: transform 0.1s ease-in-out;
|
transform-origin: D(2px) center;
|
||||||
transform-origin: D(2px) center;
|
will-change: transform;
|
||||||
will-change: transform;
|
position: relative;
|
||||||
position: relative;
|
z-index: 20;
|
||||||
z-index: 20;
|
&:hover {
|
||||||
&:hover {
|
transform: scale(2);
|
||||||
transform: scale(2);
|
z-index: 21;
|
||||||
z-index: 21;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
> .amountLabel,
|
||||||
> .amountLabel,
|
> .goalLabel {
|
||||||
> .goalLabel {
|
@include S(margin-left, 5px);
|
||||||
@include S(margin-left, 5px);
|
@include SuperSmallText;
|
||||||
@include SuperSmallText;
|
font-weight: bold;
|
||||||
font-weight: bold;
|
display: inline-flex;
|
||||||
display: inline-flex;
|
align-items: center;
|
||||||
align-items: center;
|
flex-direction: row;
|
||||||
flex-direction: row;
|
grid-column: 2 / 3;
|
||||||
grid-column: 2 / 3;
|
@include S(height, 9px);
|
||||||
@include S(height, 9px);
|
|
||||||
|
@include DarkThemeOverride {
|
||||||
@include DarkThemeOverride {
|
color: #eee;
|
||||||
color: #eee;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
> .goalLabel {
|
||||||
> .goalLabel {
|
@include S(font-size, 7px);
|
||||||
@include S(font-size, 7px);
|
opacity: 0.9;
|
||||||
opacity: 0.9;
|
align-self: start;
|
||||||
align-self: start;
|
justify-self: start;
|
||||||
justify-self: start;
|
font-weight: normal;
|
||||||
font-weight: normal;
|
grid-row: 2 / 3;
|
||||||
grid-row: 2 / 3;
|
}
|
||||||
}
|
|
||||||
|
> .amountLabel {
|
||||||
> .amountLabel {
|
align-self: end;
|
||||||
align-self: end;
|
justify-self: start;
|
||||||
justify-self: start;
|
grid-row: 1 / 2;
|
||||||
grid-row: 1 / 2;
|
}
|
||||||
}
|
|
||||||
|
> .infoButton {
|
||||||
> .infoButton {
|
@include S(width, 8px);
|
||||||
@include S(width, 8px);
|
@include S(height, 8px);
|
||||||
@include S(height, 8px);
|
background: uiResource("icons/info_button.png") center center / 95% no-repeat;
|
||||||
background: uiResource("icons/info_button.png") center center / 95% no-repeat;
|
position: absolute;
|
||||||
position: absolute;
|
opacity: 0.7;
|
||||||
opacity: 0.7;
|
@include S(top, 13px);
|
||||||
@include S(top, 13px);
|
@include S(left, -7px);
|
||||||
@include S(left, -7px);
|
@include DarkThemeInvert;
|
||||||
@include DarkThemeInvert;
|
@include IncreasedClickArea(2px);
|
||||||
@include IncreasedClickArea(2px);
|
transition: opacity 0.12s ease-in-out;
|
||||||
transition: opacity 0.12s ease-in-out;
|
z-index: 100;
|
||||||
z-index: 100;
|
|
||||||
|
&:hover {
|
||||||
&:hover {
|
opacity: 0.8;
|
||||||
opacity: 0.8;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
&.goal,
|
||||||
&.goal,
|
&.blueprint {
|
||||||
&.blueprint {
|
.amountLabel::after {
|
||||||
.amountLabel::after {
|
content: " ";
|
||||||
content: " ";
|
position: absolute;
|
||||||
position: absolute;
|
display: inline-block;
|
||||||
display: inline-block;
|
@include S(width, 8px);
|
||||||
@include S(width, 8px);
|
@include S(height, 8px);
|
||||||
@include S(height, 8px);
|
@include S(top, 4px);
|
||||||
@include S(top, 4px);
|
@include S(left, -7px);
|
||||||
@include S(left, -7px);
|
background: center center / contain no-repeat;
|
||||||
background: center center / contain no-repeat;
|
}
|
||||||
}
|
|
||||||
|
&.goal .amountLabel {
|
||||||
&.goal .amountLabel {
|
&::after {
|
||||||
&::after {
|
background-image: uiResource("icons/current_goal_marker.png");
|
||||||
background-image: uiResource("icons/current_goal_marker.png");
|
background-size: 90%;
|
||||||
background-size: 90%;
|
}
|
||||||
}
|
@include DarkThemeOverride {
|
||||||
@include DarkThemeOverride {
|
&::after {
|
||||||
&::after {
|
background-image: uiResource("icons/current_goal_marker_inverted.png") !important;
|
||||||
background-image: uiResource("icons/current_goal_marker_inverted.png") !important;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
&.blueprint .amountLabel {
|
||||||
&.blueprint .amountLabel {
|
&::after {
|
||||||
&::after {
|
background-image: uiResource("icons/blueprint_marker.png");
|
||||||
background-image: uiResource("icons/blueprint_marker.png");
|
background-size: 90%;
|
||||||
background-size: 90%;
|
}
|
||||||
}
|
@include DarkThemeOverride {
|
||||||
@include DarkThemeOverride {
|
&::after {
|
||||||
&::after {
|
background-image: uiResource("icons/blueprint_marker_inverted.png") !important;
|
||||||
background-image: uiResource("icons/blueprint_marker_inverted.png") !important;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
&.completed {
|
||||||
&.completed {
|
opacity: 0.5;
|
||||||
opacity: 0.5;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,161 +1,154 @@
|
|||||||
#ingame_HUD_ShapeViewer {
|
#ingame_HUD_ShapeViewer {
|
||||||
$dims: 170px;
|
$dims: 170px;
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
display: flex;
|
display: flex;
|
||||||
@include S(width, $dims);
|
@include S(width, $dims);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
|
|
||||||
&[data-layers="3"],
|
&[data-layers="3"],
|
||||||
&[data-layers="4"] {
|
&[data-layers="4"] {
|
||||||
@include S(width, 2 * $dims);
|
@include S(width, 2 * $dims);
|
||||||
.renderArea {
|
.renderArea {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
@include S(grid-row-gap, 15px);
|
@include S(grid-row-gap, 15px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.renderArea {
|
.renderArea {
|
||||||
display: grid;
|
display: grid;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@include S(grid-row-gap, 10px);
|
@include S(grid-row-gap, 10px);
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-items: center;
|
justify-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.infoArea {
|
.infoArea {
|
||||||
align-self: flex-end;
|
align-self: flex-end;
|
||||||
@include S(margin-top, 10px);
|
@include S(margin-top, 10px);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@include S(margin, 0);
|
@include S(margin, 0);
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.seperator {
|
.layer {
|
||||||
display: flex;
|
position: relative;
|
||||||
align-items: center;
|
background: #eee;
|
||||||
justify-content: center;
|
|
||||||
width: 100%;
|
@include DarkThemeOverride {
|
||||||
}
|
background: rgba(0, 10, 20, 0.2);
|
||||||
|
}
|
||||||
.layer {
|
@include S(width, 150px);
|
||||||
position: relative;
|
@include S(height, 100px);
|
||||||
background: #eee;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
@include DarkThemeOverride {
|
justify-content: center;
|
||||||
background: rgba(0, 10, 20, 0.2);
|
|
||||||
}
|
> canvas {
|
||||||
@include S(width, 150px);
|
@include S(width, 50px);
|
||||||
@include S(height, 100px);
|
@include S(height, 50px);
|
||||||
display: flex;
|
}
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
.quad {
|
||||||
|
position: absolute;
|
||||||
> canvas {
|
width: 50%;
|
||||||
@include S(width, 50px);
|
height: 50%;
|
||||||
@include S(height, 50px);
|
display: flex;
|
||||||
}
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
.quad {
|
box-sizing: border-box;
|
||||||
position: absolute;
|
|
||||||
width: 50%;
|
$arrowDims: 23px;
|
||||||
height: 50%;
|
$spacing: 9px;
|
||||||
display: flex;
|
@include S(padding, 6px);
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
.colorLabel {
|
||||||
box-sizing: border-box;
|
text-transform: uppercase;
|
||||||
|
@include SuperSmallText;
|
||||||
$arrowDims: 23px;
|
@include S(font-size, 9px);
|
||||||
$spacing: 9px;
|
}
|
||||||
@include S(padding, 6px);
|
|
||||||
|
.emptyLabel {
|
||||||
.colorLabel {
|
text-transform: uppercase;
|
||||||
text-transform: uppercase;
|
@include SuperSmallText;
|
||||||
@include SuperSmallText;
|
@include S(font-size, 9px);
|
||||||
@include S(font-size, 9px);
|
}
|
||||||
}
|
|
||||||
|
&::after {
|
||||||
.emptyLabel {
|
content: " ";
|
||||||
text-transform: uppercase;
|
background: rgba(0, 10, 20, 0.5);
|
||||||
@include SuperSmallText;
|
@include S(width, $arrowDims);
|
||||||
@include S(font-size, 9px);
|
@include S(height, 1px);
|
||||||
}
|
position: absolute;
|
||||||
|
transform: rotate(45deg);
|
||||||
&::after {
|
transform-origin: 50% 50%;
|
||||||
content: " ";
|
}
|
||||||
background: rgba(0, 10, 20, 0.5);
|
@include DarkThemeOverride {
|
||||||
@include S(width, $arrowDims);
|
&::after {
|
||||||
@include S(height, 1px);
|
background: rgba(255, 255, 255, 0.5);
|
||||||
position: absolute;
|
}
|
||||||
transform: rotate(45deg);
|
}
|
||||||
transform-origin: 50% 50%;
|
|
||||||
}
|
&.quad-0 {
|
||||||
@include DarkThemeOverride {
|
right: 0;
|
||||||
&::after {
|
top: 0;
|
||||||
background: rgba(255, 255, 255, 0.5);
|
align-items: flex-start;
|
||||||
}
|
justify-content: flex-end;
|
||||||
}
|
|
||||||
|
&::after {
|
||||||
&.quad-0 {
|
@include S(left, $spacing);
|
||||||
right: 0;
|
@include S(bottom, $arrowDims / 2 + $spacing);
|
||||||
top: 0;
|
transform: rotate(-45deg);
|
||||||
align-items: flex-start;
|
}
|
||||||
justify-content: flex-end;
|
}
|
||||||
|
&.quad-1 {
|
||||||
&::after {
|
bottom: 0;
|
||||||
@include S(left, $spacing);
|
right: 0;
|
||||||
@include S(bottom, $arrowDims / 2 + $spacing);
|
|
||||||
transform: rotate(-45deg);
|
align-items: flex-end;
|
||||||
}
|
justify-content: flex-end;
|
||||||
}
|
|
||||||
&.quad-1 {
|
&::after {
|
||||||
bottom: 0;
|
@include S(left, $spacing);
|
||||||
right: 0;
|
@include S(top, $arrowDims / 2 + $spacing);
|
||||||
|
transform: rotate(45deg);
|
||||||
align-items: flex-end;
|
}
|
||||||
justify-content: flex-end;
|
}
|
||||||
|
&.quad-2 {
|
||||||
&::after {
|
bottom: 0;
|
||||||
@include S(left, $spacing);
|
left: 0;
|
||||||
@include S(top, $arrowDims / 2 + $spacing);
|
|
||||||
transform: rotate(45deg);
|
align-items: flex-end;
|
||||||
}
|
justify-content: flex-start;
|
||||||
}
|
|
||||||
&.quad-2 {
|
&::after {
|
||||||
bottom: 0;
|
@include S(right, $spacing);
|
||||||
left: 0;
|
@include S(top, $arrowDims / 2 + $spacing);
|
||||||
|
transform: rotate(135deg);
|
||||||
align-items: flex-end;
|
}
|
||||||
justify-content: flex-start;
|
}
|
||||||
|
&.quad-3 {
|
||||||
&::after {
|
top: 0;
|
||||||
@include S(right, $spacing);
|
left: 0;
|
||||||
@include S(top, $arrowDims / 2 + $spacing);
|
|
||||||
transform: rotate(135deg);
|
align-items: flex-start;
|
||||||
}
|
justify-content: flex-start;
|
||||||
}
|
|
||||||
&.quad-3 {
|
&::after {
|
||||||
top: 0;
|
@include S(right, $spacing);
|
||||||
left: 0;
|
@include S(bottom, $arrowDims / 2 + $spacing);
|
||||||
|
transform: rotate(225deg);
|
||||||
align-items: flex-start;
|
}
|
||||||
justify-content: flex-start;
|
}
|
||||||
|
}
|
||||||
&::after {
|
}
|
||||||
@include S(right, $spacing);
|
}
|
||||||
@include S(bottom, $arrowDims / 2 + $spacing);
|
}
|
||||||
transform: rotate(225deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,37 +1,46 @@
|
|||||||
#state_InGameState {
|
#state_InGameState {
|
||||||
.gameLoadingOverlay {
|
.gameLoadingOverlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
display: flex;
|
display: flex;
|
||||||
background: $mainBgColor;
|
background: $mainBgColor;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ingame_Canvas {
|
.hint {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
@include S(bottom, 40px);
|
||||||
left: 0;
|
@include S(left, 20px);
|
||||||
right: 0;
|
@include S(right, 20px);
|
||||||
bottom: 0;
|
@include PlainText;
|
||||||
}
|
text-align: center;
|
||||||
#ingame_HUD_ModalDialogs {
|
}
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
#ingame_Canvas {
|
||||||
left: 0;
|
position: absolute;
|
||||||
right: 0;
|
top: 0;
|
||||||
bottom: 0;
|
left: 0;
|
||||||
}
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
@include DarkThemeOverride {
|
}
|
||||||
.gameLoadingOverlay {
|
#ingame_HUD_ModalDialogs {
|
||||||
background: $darkModeGameBackground;
|
position: absolute;
|
||||||
}
|
top: 0;
|
||||||
}
|
left: 0;
|
||||||
}
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include DarkThemeOverride {
|
||||||
|
.gameLoadingOverlay {
|
||||||
|
background: $darkModeGameBackground;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,145 +1,145 @@
|
|||||||
#state_PreloadState {
|
#state_PreloadState {
|
||||||
&.failure {
|
&.failure {
|
||||||
.loadingImage,
|
.loadingImage,
|
||||||
.loadingStatus {
|
.loadingStatus {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.changelogDialogEntry {
|
.changelogDialogEntry {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: #eef1f4;
|
background: #eef1f4;
|
||||||
|
|
||||||
@include DarkThemeOverride {
|
@include DarkThemeOverride {
|
||||||
background: #424242;
|
background: #424242;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version {
|
.version {
|
||||||
@include Heading;
|
@include Heading;
|
||||||
}
|
}
|
||||||
.date {
|
.date {
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
&::before {
|
&::before {
|
||||||
content: " | ";
|
content: " | ";
|
||||||
}
|
}
|
||||||
color: #aaabaf;
|
color: #aaabaf;
|
||||||
}
|
}
|
||||||
|
|
||||||
.changes {
|
.changes {
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
@include S(padding-left, 15px);
|
@include S(padding-left, 15px);
|
||||||
strong {
|
strong {
|
||||||
background: $colorBlueBright;
|
background: $colorBlueBright;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@include S(padding, 1px, 2px);
|
@include S(padding, 1px, 2px);
|
||||||
@include S(margin-right, 3px);
|
@include S(margin-right, 3px);
|
||||||
}
|
}
|
||||||
a {
|
a {
|
||||||
color: $colorBlueBright;
|
color: $colorBlueBright;
|
||||||
}
|
}
|
||||||
li {
|
li {
|
||||||
@include SuperSmallText;
|
@include SuperSmallText;
|
||||||
@include S(margin-bottom, 10px);
|
@include S(margin-bottom, 10px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.failureBox {
|
.failureBox {
|
||||||
.logo {
|
.logo {
|
||||||
img {
|
img {
|
||||||
@include S(width, 240px);
|
@include S(width, 240px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@include S(margin-bottom, 30px);
|
@include S(margin-bottom, 30px);
|
||||||
}
|
}
|
||||||
|
|
||||||
@include InlineAnimation(0.3s ease-in-out) {
|
@include InlineAnimation(0.3s ease-in-out) {
|
||||||
0% {
|
0% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.failureInner {
|
.failureInner {
|
||||||
// background: darken($mainBgColor, 6);
|
// background: darken($mainBgColor, 6);
|
||||||
@include S(max-width, 350px);
|
@include S(max-width, 350px);
|
||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
|
|
||||||
@include BoxShadow3D(#fff);
|
@include BoxShadow3D(#fff);
|
||||||
@include S(padding, 15px);
|
@include S(padding, 15px);
|
||||||
@include S(border-radius, $globalBorderRadius);
|
@include S(border-radius, $globalBorderRadius);
|
||||||
@include DropShadow;
|
@include DropShadow;
|
||||||
|
|
||||||
.errorHeader {
|
.errorHeader {
|
||||||
color: #ef5072;
|
color: #ef5072;
|
||||||
}
|
}
|
||||||
|
|
||||||
.errorMessage {
|
.errorMessage {
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
display: block;
|
display: block;
|
||||||
color: #666;
|
color: #666;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@include BreakText;
|
@include BreakText;
|
||||||
hyphens: auto;
|
hyphens: auto;
|
||||||
// border: dotted #666;
|
// border: dotted #666;
|
||||||
// @include S(border-width, 1px, 0);
|
// @include S(border-width, 1px, 0);
|
||||||
@include S(padding, 10px, 0);
|
@include S(padding, 10px, 0);
|
||||||
@include S(margin-top, 10px);
|
@include S(margin-top, 10px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.supportHelp {
|
.supportHelp {
|
||||||
@include S(margin-top, 10px);
|
@include S(margin-top, 10px);
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
|
|
||||||
.email {
|
.email {
|
||||||
color: $themeColor;
|
color: $themeColor;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
pointer-events: all;
|
pointer-events: all;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.lower {
|
.lower {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@include S(margin-top, 16px);
|
@include S(margin-top, 16px);
|
||||||
|
|
||||||
i {
|
i {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
color: #777;
|
color: #777;
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.resetApp {
|
button.resetApp {
|
||||||
@include Button3D($colorRedBright);
|
@include Button3D($colorRedBright);
|
||||||
@include PlainText;
|
@include PlainText;
|
||||||
@include S(padding, 5px, 8px, 4px);
|
@include S(padding, 5px, 8px, 4px);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Animations */
|
/* Animations */
|
||||||
.status {
|
.status {
|
||||||
transform: scale(0.7) $hardwareAcc;
|
transform: scale(0.7) $hardwareAcc;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@include StateAnim(transform, opacity);
|
@include StateAnim(transform, opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
&.arrived {
|
&.arrived {
|
||||||
.status {
|
.status {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,7 +109,7 @@ export const CHANGELOG = [
|
|||||||
date: "17.06.2020",
|
date: "17.06.2020",
|
||||||
entries: [
|
entries: [
|
||||||
"You can now place straight belts (and tunnels) by holding SHIFT! (For you, @giantwaffle ❤️)",
|
"You can now place straight belts (and tunnels) by holding SHIFT! (For you, @giantwaffle ❤️)",
|
||||||
"Added continue button to main menu and add seperate 'New game' button (by jaysc)",
|
"Added continue button to main menu and add separate 'New game' button (by jaysc)",
|
||||||
"Added setting to disable smart tunnel placement introduced with the last update",
|
"Added setting to disable smart tunnel placement introduced with the last update",
|
||||||
"Added setting to disable vignette",
|
"Added setting to disable vignette",
|
||||||
"Update translations",
|
"Update translations",
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { round1Digit } from "./utils";
|
|||||||
|
|
||||||
const logger = createLogger("buffers");
|
const logger = createLogger("buffers");
|
||||||
|
|
||||||
const bufferGcDurationSeconds = 5;
|
const bufferGcDurationSeconds = 0.5;
|
||||||
|
|
||||||
export class BufferMaintainer {
|
export class BufferMaintainer {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -25,17 +25,43 @@ export function disableImageSmoothing(context) {
|
|||||||
context.webkitImageSmoothingEnabled = false;
|
context.webkitImageSmoothingEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const registeredCanvas = [];
|
/**
|
||||||
const freeCanvasList = [];
|
* @typedef {{
|
||||||
|
* canvas: HTMLCanvasElement,
|
||||||
|
* context: CanvasRenderingContext2D
|
||||||
|
* }} CanvasCacheEntry
|
||||||
|
*/
|
||||||
|
|
||||||
let vramUsage = 0;
|
/**
|
||||||
let bufferCount = 0;
|
* @type {Array<CanvasCacheEntry>}
|
||||||
|
*/
|
||||||
|
const registeredCanvas = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Buckets for each width * height combination
|
||||||
|
* @type {Map<number, Array<CanvasCacheEntry>>}
|
||||||
|
*/
|
||||||
|
const freeCanvasBuckets = new Map();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Track statistics
|
||||||
|
*/
|
||||||
|
const stats = {
|
||||||
|
vramUsage: 0,
|
||||||
|
backlogVramUsage: 0,
|
||||||
|
bufferCount: 0,
|
||||||
|
numReused: 0,
|
||||||
|
numCreated: 0,
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {HTMLCanvasElement} canvas
|
* @param {HTMLCanvasElement} canvas
|
||||||
*/
|
*/
|
||||||
export function getBufferVramUsageBytes(canvas) {
|
export function getBufferVramUsageBytes(canvas) {
|
||||||
|
assert(canvas, "no canvas given");
|
||||||
|
assert(Number.isFinite(canvas.width), "bad canvas width: " + canvas.width);
|
||||||
|
assert(Number.isFinite(canvas.height), "bad canvas height" + canvas.height);
|
||||||
return canvas.width * canvas.height * 4;
|
return canvas.width * canvas.height * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,17 +69,31 @@ export function getBufferVramUsageBytes(canvas) {
|
|||||||
* Returns stats on the allocated buffers
|
* Returns stats on the allocated buffers
|
||||||
*/
|
*/
|
||||||
export function getBufferStats() {
|
export function getBufferStats() {
|
||||||
|
let numBuffersFree = 0;
|
||||||
|
freeCanvasBuckets.forEach(bucket => {
|
||||||
|
numBuffersFree += bucket.length;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
vramUsage,
|
...stats,
|
||||||
bufferCount,
|
backlogKeys: freeCanvasBuckets.size,
|
||||||
backlog: freeCanvasList.length,
|
backlogSize: numBuffersFree,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the backlog buffers if they grew too much
|
||||||
|
*/
|
||||||
export function clearBufferBacklog() {
|
export function clearBufferBacklog() {
|
||||||
while (freeCanvasList.length > 50) {
|
freeCanvasBuckets.forEach(bucket => {
|
||||||
freeCanvasList.pop();
|
while (bucket.length > 500) {
|
||||||
}
|
const entry = bucket[bucket.length - 1];
|
||||||
|
stats.backlogVramUsage -= getBufferVramUsageBytes(entry.canvas);
|
||||||
|
delete entry.canvas;
|
||||||
|
delete entry.context;
|
||||||
|
bucket.pop();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,53 +124,29 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe
|
|||||||
let canvas = null;
|
let canvas = null;
|
||||||
let context = null;
|
let context = null;
|
||||||
|
|
||||||
let bestMatchingOne = null;
|
|
||||||
let bestMatchingPixelsDiff = 1e50;
|
|
||||||
|
|
||||||
const currentPixels = w * h;
|
|
||||||
|
|
||||||
// Ok, search in cache first
|
// Ok, search in cache first
|
||||||
for (let i = 0; i < freeCanvasList.length; ++i) {
|
const bucket = freeCanvasBuckets.get(w * h) || [];
|
||||||
const { canvas: useableCanvas, context: useableContext } = freeCanvasList[i];
|
|
||||||
|
for (let i = 0; i < bucket.length; ++i) {
|
||||||
|
const { canvas: useableCanvas, context: useableContext } = bucket[i];
|
||||||
if (useableCanvas.width === w && useableCanvas.height === h) {
|
if (useableCanvas.width === w && useableCanvas.height === h) {
|
||||||
// Ok we found one
|
// Ok we found one
|
||||||
canvas = useableCanvas;
|
canvas = useableCanvas;
|
||||||
context = useableContext;
|
context = useableContext;
|
||||||
|
|
||||||
fastArrayDelete(freeCanvasList, i);
|
// Restore past state
|
||||||
|
context.restore();
|
||||||
|
context.save();
|
||||||
|
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
delete canvas.style.width;
|
||||||
|
delete canvas.style.height;
|
||||||
|
|
||||||
|
stats.numReused++;
|
||||||
|
stats.backlogVramUsage -= getBufferVramUsageBytes(canvas);
|
||||||
|
fastArrayDelete(bucket, i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const otherPixels = useableCanvas.width * useableCanvas.height;
|
|
||||||
const diff = Math.abs(otherPixels - currentPixels);
|
|
||||||
if (diff < bestMatchingPixelsDiff) {
|
|
||||||
bestMatchingPixelsDiff = diff;
|
|
||||||
bestMatchingOne = {
|
|
||||||
canvas: useableCanvas,
|
|
||||||
context: useableContext,
|
|
||||||
index: i,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ok none matching, reuse one though
|
|
||||||
if (!canvas && bestMatchingOne) {
|
|
||||||
canvas = bestMatchingOne.canvas;
|
|
||||||
context = bestMatchingOne.context;
|
|
||||||
canvas.width = w;
|
|
||||||
canvas.height = h;
|
|
||||||
fastArrayDelete(freeCanvasList, bestMatchingOne.index);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset context
|
|
||||||
if (context) {
|
|
||||||
// Restore past state
|
|
||||||
context.restore();
|
|
||||||
context.save();
|
|
||||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
||||||
|
|
||||||
delete canvas.style.width;
|
|
||||||
delete canvas.style.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// None found , create new one
|
// None found , create new one
|
||||||
@ -138,6 +154,8 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe
|
|||||||
canvas = document.createElement("canvas");
|
canvas = document.createElement("canvas");
|
||||||
context = canvas.getContext("2d" /*, { alpha } */);
|
context = canvas.getContext("2d" /*, { alpha } */);
|
||||||
|
|
||||||
|
stats.numCreated++;
|
||||||
|
|
||||||
canvas.width = w;
|
canvas.width = w;
|
||||||
canvas.height = h;
|
canvas.height = h;
|
||||||
|
|
||||||
@ -145,6 +163,7 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe
|
|||||||
context.save();
|
context.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
canvas.label = label;
|
canvas.label = label;
|
||||||
|
|
||||||
if (smooth) {
|
if (smooth) {
|
||||||
@ -167,8 +186,9 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe
|
|||||||
export function registerCanvas(canvas, context) {
|
export function registerCanvas(canvas, context) {
|
||||||
registeredCanvas.push({ canvas, context });
|
registeredCanvas.push({ canvas, context });
|
||||||
|
|
||||||
bufferCount += 1;
|
stats.bufferCount += 1;
|
||||||
vramUsage += getBufferVramUsageBytes(canvas);
|
const bytesUsed = getBufferVramUsageBytes(canvas);
|
||||||
|
stats.vramUsage += bytesUsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -180,6 +200,7 @@ export function freeCanvas(canvas) {
|
|||||||
|
|
||||||
let index = -1;
|
let index = -1;
|
||||||
let data = null;
|
let data = null;
|
||||||
|
|
||||||
for (let i = 0; i < registeredCanvas.length; ++i) {
|
for (let i = 0; i < registeredCanvas.length; ++i) {
|
||||||
if (registeredCanvas[i].canvas === canvas) {
|
if (registeredCanvas[i].canvas === canvas) {
|
||||||
index = i;
|
index = i;
|
||||||
@ -193,8 +214,18 @@ export function freeCanvas(canvas) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fastArrayDelete(registeredCanvas, index);
|
fastArrayDelete(registeredCanvas, index);
|
||||||
freeCanvasList.push(data);
|
|
||||||
|
|
||||||
bufferCount -= 1;
|
const key = canvas.width * canvas.height;
|
||||||
vramUsage -= getBufferVramUsageBytes(canvas);
|
const bucket = freeCanvasBuckets.get(key);
|
||||||
|
if (bucket) {
|
||||||
|
bucket.push(data);
|
||||||
|
} else {
|
||||||
|
freeCanvasBuckets.set(key, [data]);
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.bufferCount -= 1;
|
||||||
|
|
||||||
|
const bytesUsed = getBufferVramUsageBytes(canvas);
|
||||||
|
stats.vramUsage -= bytesUsed;
|
||||||
|
stats.backlogVramUsage += bytesUsed;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,8 +84,8 @@ export const globalConfig = {
|
|||||||
// Global game speed
|
// Global game speed
|
||||||
gameSpeed: 1,
|
gameSpeed: 1,
|
||||||
|
|
||||||
warmupTimeSecondsFast: 0.1,
|
warmupTimeSecondsFast: 0.5,
|
||||||
warmupTimeSecondsRegular: 1,
|
warmupTimeSecondsRegular: 3,
|
||||||
|
|
||||||
smoothing: {
|
smoothing: {
|
||||||
smoothMainCanvas: smoothCanvas && true,
|
smoothMainCanvas: smoothCanvas && true,
|
||||||
@ -132,5 +132,5 @@ if (G_IS_DEV && globalConfig.debug.renderForTrailer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (globalConfig.debug.fastGameEnter) {
|
if (globalConfig.debug.fastGameEnter) {
|
||||||
globalConfig.debug.noArtificalDelays = true;
|
globalConfig.debug.noArtificialDelays = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,230 +1,230 @@
|
|||||||
import { makeOffscreenBuffer } from "./buffer_utils";
|
import { makeOffscreenBuffer } from "./buffer_utils";
|
||||||
import { AtlasSprite, BaseSprite, RegularSprite, SpriteAtlasLink } from "./sprites";
|
import { AtlasSprite, BaseSprite, RegularSprite, SpriteAtlasLink } from "./sprites";
|
||||||
import { cachebust } from "./cachebust";
|
import { cachebust } from "./cachebust";
|
||||||
import { createLogger } from "./logging";
|
import { createLogger } from "./logging";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../application").Application} Application
|
* @typedef {import("../application").Application} Application
|
||||||
* @typedef {import("./atlas_definitions").AtlasDefinition} AtlasDefinition;
|
* @typedef {import("./atlas_definitions").AtlasDefinition} AtlasDefinition;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const logger = createLogger("loader");
|
const logger = createLogger("loader");
|
||||||
|
|
||||||
const missingSpriteIds = {};
|
const missingSpriteIds = {};
|
||||||
|
|
||||||
class LoaderImpl {
|
class LoaderImpl {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = null;
|
this.app = null;
|
||||||
|
|
||||||
/** @type {Map<string, BaseSprite>} */
|
/** @type {Map<string, BaseSprite>} */
|
||||||
this.sprites = new Map();
|
this.sprites = new Map();
|
||||||
|
|
||||||
this.rawImages = [];
|
this.rawImages = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Application} app
|
* @param {Application} app
|
||||||
*/
|
*/
|
||||||
linkAppAfterBoot(app) {
|
linkAppAfterBoot(app) {
|
||||||
this.app = app;
|
this.app = app;
|
||||||
this.makeSpriteNotFoundCanvas();
|
this.makeSpriteNotFoundCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches a given sprite from the cache
|
* Fetches a given sprite from the cache
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns {BaseSprite}
|
* @returns {BaseSprite}
|
||||||
*/
|
*/
|
||||||
getSpriteInternal(key) {
|
getSpriteInternal(key) {
|
||||||
const sprite = this.sprites.get(key);
|
const sprite = this.sprites.get(key);
|
||||||
if (!sprite) {
|
if (!sprite) {
|
||||||
if (!missingSpriteIds[key]) {
|
if (!missingSpriteIds[key]) {
|
||||||
// Only show error once
|
// Only show error once
|
||||||
missingSpriteIds[key] = true;
|
missingSpriteIds[key] = true;
|
||||||
logger.error("Sprite '" + key + "' not found!");
|
logger.error("Sprite '" + key + "' not found!");
|
||||||
}
|
}
|
||||||
return this.spriteNotFoundSprite;
|
return this.spriteNotFoundSprite;
|
||||||
}
|
}
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an atlas sprite from the cache
|
* Returns an atlas sprite from the cache
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns {AtlasSprite}
|
* @returns {AtlasSprite}
|
||||||
*/
|
*/
|
||||||
getSprite(key) {
|
getSprite(key) {
|
||||||
const sprite = this.getSpriteInternal(key);
|
const sprite = this.getSpriteInternal(key);
|
||||||
assert(sprite instanceof AtlasSprite || sprite === this.spriteNotFoundSprite, "Not an atlas sprite");
|
assert(sprite instanceof AtlasSprite || sprite === this.spriteNotFoundSprite, "Not an atlas sprite");
|
||||||
return /** @type {AtlasSprite} */ (sprite);
|
return /** @type {AtlasSprite} */ (sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a regular sprite from the cache
|
* Returns a regular sprite from the cache
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns {RegularSprite}
|
* @returns {RegularSprite}
|
||||||
*/
|
*/
|
||||||
getRegularSprite(key) {
|
getRegularSprite(key) {
|
||||||
const sprite = this.getSpriteInternal(key);
|
const sprite = this.getSpriteInternal(key);
|
||||||
assert(
|
assert(
|
||||||
sprite instanceof RegularSprite || sprite === this.spriteNotFoundSprite,
|
sprite instanceof RegularSprite || sprite === this.spriteNotFoundSprite,
|
||||||
"Not a regular sprite"
|
"Not a regular sprite"
|
||||||
);
|
);
|
||||||
return /** @type {RegularSprite} */ (sprite);
|
return /** @type {RegularSprite} */ (sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns {Promise<HTMLImageElement|null>}
|
* @returns {Promise<HTMLImageElement|null>}
|
||||||
*/
|
*/
|
||||||
internalPreloadImage(key) {
|
internalPreloadImage(key) {
|
||||||
const url = cachebust("res/" + key);
|
const url = cachebust("res/" + key);
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
|
|
||||||
let triesSoFar = 0;
|
let triesSoFar = 0;
|
||||||
|
|
||||||
return Promise.race([
|
return Promise.race([
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
setTimeout(reject, G_IS_DEV ? 500 : 10000);
|
setTimeout(reject, G_IS_DEV ? 500 : 10000);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new Promise(resolve => {
|
new Promise(resolve => {
|
||||||
image.onload = () => {
|
image.onload = () => {
|
||||||
image.onerror = null;
|
image.onerror = null;
|
||||||
image.onload = null;
|
image.onload = null;
|
||||||
|
|
||||||
if (typeof image.decode === "function") {
|
if (typeof image.decode === "function") {
|
||||||
// SAFARI: Image.decode() fails on safari with svgs -> we dont want to fail
|
// SAFARI: Image.decode() fails on safari with svgs -> we dont want to fail
|
||||||
// on that
|
// on that
|
||||||
// FIREFOX: Decode never returns if the image is in cache, so call it in background
|
// FIREFOX: Decode never returns if the image is in cache, so call it in background
|
||||||
image.decode().then(
|
image.decode().then(
|
||||||
() => null,
|
() => null,
|
||||||
() => null
|
() => null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
resolve(image);
|
resolve(image);
|
||||||
};
|
};
|
||||||
|
|
||||||
image.onerror = reason => {
|
image.onerror = reason => {
|
||||||
logger.warn("Failed to load '" + url + "':", reason);
|
logger.warn("Failed to load '" + url + "':", reason);
|
||||||
if (++triesSoFar < 4) {
|
if (++triesSoFar < 4) {
|
||||||
logger.log("Retrying to load image from", url);
|
logger.log("Retrying to load image from", url);
|
||||||
image.src = url + "?try=" + triesSoFar;
|
image.src = url + "?try=" + triesSoFar;
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Failed to load", url, "after", triesSoFar, "tries with reason", reason);
|
logger.warn("Failed to load", url, "after", triesSoFar, "tries with reason", reason);
|
||||||
image.onerror = null;
|
image.onerror = null;
|
||||||
image.onload = null;
|
image.onload = null;
|
||||||
resolve(null);
|
resolve(null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
image.src = url;
|
image.src = url;
|
||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preloads a sprite
|
* Preloads a sprite
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
preloadCSSSprite(key) {
|
preloadCSSSprite(key) {
|
||||||
return this.internalPreloadImage(key).then(image => {
|
return this.internalPreloadImage(key).then(image => {
|
||||||
if (key.indexOf("game_misc") >= 0) {
|
if (key.indexOf("game_misc") >= 0) {
|
||||||
// Allow access to regular sprites
|
// Allow access to regular sprites
|
||||||
this.sprites.set(key, new RegularSprite(image, image.width, image.height));
|
this.sprites.set(key, new RegularSprite(image, image.width, image.height));
|
||||||
}
|
}
|
||||||
this.rawImages.push(image);
|
this.rawImages.push(image);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preloads an atlas
|
* Preloads an atlas
|
||||||
* @param {AtlasDefinition} atlas
|
* @param {AtlasDefinition} atlas
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
preloadAtlas(atlas) {
|
preloadAtlas(atlas) {
|
||||||
return this.internalPreloadImage(atlas.getFullSourcePath()).then(image => {
|
return this.internalPreloadImage(atlas.getFullSourcePath()).then(image => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
image.label = atlas.sourceFileName;
|
image.label = atlas.sourceFileName;
|
||||||
return this.internalParseAtlas(atlas, image);
|
return this.internalParseAtlas(atlas, image);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {AtlasDefinition} atlas
|
* @param {AtlasDefinition} atlas
|
||||||
* @param {HTMLImageElement} loadedImage
|
* @param {HTMLImageElement} loadedImage
|
||||||
*/
|
*/
|
||||||
internalParseAtlas({ meta: { scale }, sourceData }, loadedImage) {
|
internalParseAtlas({ meta: { scale }, sourceData }, loadedImage) {
|
||||||
this.rawImages.push(loadedImage);
|
this.rawImages.push(loadedImage);
|
||||||
|
|
||||||
for (const spriteName in sourceData) {
|
for (const spriteName in sourceData) {
|
||||||
const { frame, sourceSize, spriteSourceSize } = sourceData[spriteName];
|
const { frame, sourceSize, spriteSourceSize } = sourceData[spriteName];
|
||||||
|
|
||||||
let sprite = /** @type {AtlasSprite} */ (this.sprites.get(spriteName));
|
let sprite = /** @type {AtlasSprite} */ (this.sprites.get(spriteName));
|
||||||
|
|
||||||
if (!sprite) {
|
if (!sprite) {
|
||||||
sprite = new AtlasSprite(spriteName);
|
sprite = new AtlasSprite(spriteName);
|
||||||
this.sprites.set(spriteName, sprite);
|
this.sprites.set(spriteName, sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
const link = new SpriteAtlasLink({
|
const link = new SpriteAtlasLink({
|
||||||
packedX: frame.x,
|
packedX: frame.x,
|
||||||
packedY: frame.y,
|
packedY: frame.y,
|
||||||
packedW: frame.w,
|
packedW: frame.w,
|
||||||
packedH: frame.h,
|
packedH: frame.h,
|
||||||
packOffsetX: spriteSourceSize.x,
|
packOffsetX: spriteSourceSize.x,
|
||||||
packOffsetY: spriteSourceSize.y,
|
packOffsetY: spriteSourceSize.y,
|
||||||
atlas: loadedImage,
|
atlas: loadedImage,
|
||||||
w: sourceSize.w,
|
w: sourceSize.w,
|
||||||
h: sourceSize.h,
|
h: sourceSize.h,
|
||||||
});
|
});
|
||||||
sprite.linksByResolution[scale] = link;
|
sprite.linksByResolution[scale] = link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes the canvas which shows the question mark, shown when a sprite was not found
|
* Makes the canvas which shows the question mark, shown when a sprite was not found
|
||||||
*/
|
*/
|
||||||
makeSpriteNotFoundCanvas() {
|
makeSpriteNotFoundCanvas() {
|
||||||
const dims = 128;
|
const dims = 128;
|
||||||
|
|
||||||
const [canvas, context] = makeOffscreenBuffer(dims, dims, {
|
const [canvas, context] = makeOffscreenBuffer(dims, dims, {
|
||||||
smooth: false,
|
smooth: false,
|
||||||
label: "not-found-sprite",
|
label: "not-found-sprite",
|
||||||
});
|
});
|
||||||
context.fillStyle = "#f77";
|
context.fillStyle = "#f77";
|
||||||
context.fillRect(0, 0, dims, dims);
|
context.fillRect(0, 0, dims, dims);
|
||||||
|
|
||||||
context.textAlign = "center";
|
context.textAlign = "center";
|
||||||
context.textBaseline = "middle";
|
context.textBaseline = "middle";
|
||||||
context.fillStyle = "#eee";
|
context.fillStyle = "#eee";
|
||||||
context.font = "25px Arial";
|
context.font = "25px Arial";
|
||||||
context.fillText("???", dims / 2, dims / 2);
|
context.fillText("???", dims / 2, dims / 2);
|
||||||
|
|
||||||
// TODO: Not sure why this is set here
|
// TODO: Not sure why this is set here
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
canvas.src = "not-found";
|
canvas.src = "not-found";
|
||||||
|
|
||||||
const sprite = new AtlasSprite("not-found");
|
const sprite = new AtlasSprite("not-found");
|
||||||
["0.1", "0.25", "0.5", "0.75", "1"].forEach(resolution => {
|
["0.1", "0.25", "0.5", "0.75", "1"].forEach(resolution => {
|
||||||
sprite.linksByResolution[resolution] = new SpriteAtlasLink({
|
sprite.linksByResolution[resolution] = new SpriteAtlasLink({
|
||||||
packedX: 0,
|
packedX: 0,
|
||||||
packedY: 0,
|
packedY: 0,
|
||||||
w: dims,
|
w: dims,
|
||||||
h: dims,
|
h: dims,
|
||||||
packOffsetX: 0,
|
packOffsetX: 0,
|
||||||
packOffsetY: 0,
|
packOffsetY: 0,
|
||||||
packedW: dims,
|
packedW: dims,
|
||||||
packedH: dims,
|
packedH: dims,
|
||||||
atlas: canvas,
|
atlas: canvas,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.spriteNotFoundSprite = sprite;
|
this.spriteNotFoundSprite = sprite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Loader = new LoaderImpl();
|
export const Loader = new LoaderImpl();
|
||||||
|
|||||||
@ -30,10 +30,10 @@ export class Dialog {
|
|||||||
* @param {string} param0.title Title of the dialog
|
* @param {string} param0.title Title of the dialog
|
||||||
* @param {string} param0.contentHTML Inner dialog html
|
* @param {string} param0.contentHTML Inner dialog html
|
||||||
* @param {Array<string>} param0.buttons
|
* @param {Array<string>} param0.buttons
|
||||||
* Button list, each button contains of up to 3 parts seperated by ':'.
|
* Button list, each button contains of up to 3 parts separated by ':'.
|
||||||
* Part 0: The id, one of the one defined in dialog_buttons.yaml
|
* Part 0: The id, one of the one defined in dialog_buttons.yaml
|
||||||
* Part 1: The style, either good, bad or misc
|
* Part 1: The style, either good, bad or misc
|
||||||
* Part 2 (optional): Additional parameters seperated by '/', available are:
|
* Part 2 (optional): Additional parameters separated by '/', available are:
|
||||||
* timeout: This button is only available after some waiting time
|
* timeout: This button is only available after some waiting time
|
||||||
* kb_enter: This button is triggered by the enter key
|
* kb_enter: This button is triggered by the enter key
|
||||||
* kb_escape This button is triggered by the escape key
|
* kb_escape This button is triggered by the escape key
|
||||||
|
|||||||
@ -224,7 +224,7 @@ export class ReadWriteProxy {
|
|||||||
return rawData;
|
return rawData;
|
||||||
})
|
})
|
||||||
|
|
||||||
// Parse JSON, this could throw but thats fine
|
// Parse JSON, this could throw but that's fine
|
||||||
.then(res => {
|
.then(res => {
|
||||||
try {
|
try {
|
||||||
return JSON.parse(res);
|
return JSON.parse(res);
|
||||||
|
|||||||
@ -5,6 +5,8 @@ import { round3Digits } from "./utils";
|
|||||||
export const ORIGINAL_SPRITE_SCALE = "0.75";
|
export const ORIGINAL_SPRITE_SCALE = "0.75";
|
||||||
export const FULL_CLIP_RECT = new Rectangle(0, 0, 1, 1);
|
export const FULL_CLIP_RECT = new Rectangle(0, 0, 1, 1);
|
||||||
|
|
||||||
|
const EXTRUDE = 0.1;
|
||||||
|
|
||||||
export class BaseSprite {
|
export class BaseSprite {
|
||||||
/**
|
/**
|
||||||
* Returns the raw handle
|
* Returns the raw handle
|
||||||
@ -206,15 +208,15 @@ export class AtlasSprite extends BaseSprite {
|
|||||||
srcX,
|
srcX,
|
||||||
srcY,
|
srcY,
|
||||||
|
|
||||||
// atlas src siize
|
// atlas src size
|
||||||
srcW,
|
srcW,
|
||||||
srcH,
|
srcH,
|
||||||
|
|
||||||
// dest pos and size
|
// dest pos and size
|
||||||
destX,
|
destX - EXTRUDE,
|
||||||
destY,
|
destY - EXTRUDE,
|
||||||
destW,
|
destW + 2 * EXTRUDE,
|
||||||
destH
|
destH + 2 * EXTRUDE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,10 +269,10 @@ export class AtlasSprite extends BaseSprite {
|
|||||||
srcH,
|
srcH,
|
||||||
|
|
||||||
// dest pos and size
|
// dest pos and size
|
||||||
destX,
|
destX - EXTRUDE,
|
||||||
destY,
|
destY - EXTRUDE,
|
||||||
destW,
|
destW + 2 * EXTRUDE,
|
||||||
destH
|
destH + 2 * EXTRUDE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -40,9 +40,9 @@ export class StaleAreaDetector {
|
|||||||
* Makes this detector recompute the area of an entity whenever
|
* Makes this detector recompute the area of an entity whenever
|
||||||
* it changes in any way
|
* it changes in any way
|
||||||
* @param {Array<typeof Component>} components
|
* @param {Array<typeof Component>} components
|
||||||
* @param {number} tilesAround
|
* @param {number} tilesAround How many tiles arround to expand the area
|
||||||
*/
|
*/
|
||||||
recomputeOnComponentsChanged(components, tilesAround = 1) {
|
recomputeOnComponentsChanged(components, tilesAround) {
|
||||||
const componentIds = components.map(component => component.getId());
|
const componentIds = components.map(component => component.getId());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,6 +50,10 @@ export class StaleAreaDetector {
|
|||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
*/
|
*/
|
||||||
const checker = entity => {
|
const checker = entity => {
|
||||||
|
if (!this.root.gameInitialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Check for all components
|
// Check for all components
|
||||||
for (let i = 0; i < componentIds.length; ++i) {
|
for (let i = 0; i < componentIds.length; ++i) {
|
||||||
if (entity.components[componentIds[i]]) {
|
if (entity.components[componentIds[i]]) {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { globalConfig } from "../core/config";
|
|||||||
import { DrawParameters } from "../core/draw_parameters";
|
import { DrawParameters } from "../core/draw_parameters";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { Rectangle } from "../core/rectangle";
|
import { Rectangle } from "../core/rectangle";
|
||||||
import { epsilonCompare, round4Digits, clamp } from "../core/utils";
|
import { clamp, epsilonCompare, round4Digits } from "../core/utils";
|
||||||
import { enumDirection, enumDirectionToVector, enumInvertedDirections, Vector } from "../core/vector";
|
import { enumDirection, enumDirectionToVector, enumInvertedDirections, Vector } from "../core/vector";
|
||||||
import { BasicSerializableObject, types } from "../savegame/serialization";
|
import { BasicSerializableObject, types } from "../savegame/serialization";
|
||||||
import { BaseItem } from "./base_item";
|
import { BaseItem } from "./base_item";
|
||||||
@ -1069,12 +1069,14 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
// Trigger animation on the acceptor comp
|
// Trigger animation on the acceptor comp
|
||||||
const targetAcceptorComp = this.acceptorTarget.entity.components.ItemAcceptor;
|
const targetAcceptorComp = this.acceptorTarget.entity.components.ItemAcceptor;
|
||||||
if (targetAcceptorComp) {
|
if (targetAcceptorComp) {
|
||||||
targetAcceptorComp.onItemAccepted(
|
if (!this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
this.acceptorTarget.slot,
|
targetAcceptorComp.onItemAccepted(
|
||||||
this.acceptorTarget.direction,
|
this.acceptorTarget.slot,
|
||||||
item,
|
this.acceptorTarget.direction,
|
||||||
remainingProgress
|
item,
|
||||||
);
|
remainingProgress
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -1091,7 +1093,7 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
computePositionFromProgress(progress) {
|
computePositionFromProgress(progress) {
|
||||||
let currentLength = 0;
|
let currentLength = 0;
|
||||||
|
|
||||||
// floating point issuses ..
|
// floating point issues ..
|
||||||
assert(progress <= this.totalLength + 0.02, "Progress too big: " + progress);
|
assert(progress <= this.totalLength + 0.02, "Progress too big: " + progress);
|
||||||
|
|
||||||
for (let i = 0; i < this.entityPath.length; ++i) {
|
for (let i = 0; i < this.entityPath.length; ++i) {
|
||||||
@ -1179,6 +1181,35 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
parameters.context.fillRect(firstItemIndicator.x - 3, firstItemIndicator.y - 1, 6, 2);
|
parameters.context.fillRect(firstItemIndicator.x - 3, firstItemIndicator.y - 1, 6, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if this belt path should render simplified
|
||||||
|
*/
|
||||||
|
checkIsPotatoMode() {
|
||||||
|
// POTATO Mode: Only show items when belt is hovered
|
||||||
|
if (!this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const mousePos = this.root.app.mousePosition;
|
||||||
|
if (!mousePos) {
|
||||||
|
// Mouse not registered
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const tile = this.root.camera.screenToWorld(mousePos).toTileSpace();
|
||||||
|
const contents = this.root.map.getLayerContentXY(tile.x, tile.y, "regular");
|
||||||
|
if (!contents || !contents.components.Belt) {
|
||||||
|
// Nothing below
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (contents.components.Belt.assignedPath !== this) {
|
||||||
|
// Not this path
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the path
|
* Draws the path
|
||||||
* @param {DrawParameters} parameters
|
* @param {DrawParameters} parameters
|
||||||
@ -1193,6 +1224,30 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.checkIsPotatoMode()) {
|
||||||
|
const firstItem = this.items[0];
|
||||||
|
if (this.entityPath.length > 1 && firstItem) {
|
||||||
|
const medianBeltIndex = clamp(
|
||||||
|
Math.round(this.entityPath.length / 2 - 1),
|
||||||
|
0,
|
||||||
|
this.entityPath.length - 1
|
||||||
|
);
|
||||||
|
const medianBelt = this.entityPath[medianBeltIndex];
|
||||||
|
const beltComp = medianBelt.components.Belt;
|
||||||
|
const staticComp = medianBelt.components.StaticMapEntity;
|
||||||
|
const centerPosLocal = beltComp.transformBeltToLocalSpace(
|
||||||
|
this.entityPath.length % 2 === 0 ? beltComp.getEffectiveLengthTiles() : 0.5
|
||||||
|
);
|
||||||
|
const centerPos = staticComp.localTileToWorld(centerPosLocal).toWorldSpaceCenterOfTile();
|
||||||
|
|
||||||
|
parameters.context.globalAlpha = 0.5;
|
||||||
|
firstItem[_item].drawItemCenteredClipped(centerPos.x, centerPos.y, parameters);
|
||||||
|
parameters.context.globalAlpha = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let currentItemPos = this.spacingToFirstItem;
|
let currentItemPos = this.spacingToFirstItem;
|
||||||
let currentItemIndex = 0;
|
let currentItemIndex = 0;
|
||||||
|
|
||||||
@ -1206,7 +1261,7 @@ export class BeltPath extends BasicSerializableObject {
|
|||||||
|
|
||||||
// Check if the current items are on the belt
|
// Check if the current items are on the belt
|
||||||
while (trackPos + beltLength >= currentItemPos - 1e-5) {
|
while (trackPos + beltLength >= currentItemPos - 1e-5) {
|
||||||
// Its on the belt, render it now
|
// It's on the belt, render it now
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
assert(
|
assert(
|
||||||
currentItemPos - trackPos >= 0,
|
currentItemPos - trackPos >= 0,
|
||||||
|
|||||||
@ -25,16 +25,27 @@ export const gBuildingVariants = {
|
|||||||
// Set later
|
// Set later
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mapping from 'metaBuildingId/variant/rotationVariant' to building code
|
||||||
|
* @type {Map<string, string>}
|
||||||
|
*/
|
||||||
|
const variantsCache = new Map();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a new variant
|
* Registers a new variant
|
||||||
* @param {number | string} id
|
* @param {number | string} code
|
||||||
* @param {typeof MetaBuilding} meta
|
* @param {typeof MetaBuilding} meta
|
||||||
* @param {typeof MetaBuildingVariant} variant
|
* @param {typeof MetaBuildingVariant} variant
|
||||||
* @param {number} rotationVariant
|
* @param {number} rotationVariant
|
||||||
*/
|
*/
|
||||||
export function registerBuildingVariant(id, meta, variant, rotationVariant = 0) {
|
export function registerBuildingVariant(
|
||||||
assert(!gBuildingVariants[id], "Duplicate id: " + id);
|
code,
|
||||||
gBuildingVariants[id.toString()] = {
|
meta,
|
||||||
|
variant,
|
||||||
|
rotationVariant = 0
|
||||||
|
) {
|
||||||
|
assert(!gBuildingVariants[code], "Duplicate id: " + code);
|
||||||
|
gBuildingVariants[code.toString()] = {
|
||||||
metaClass: meta,
|
metaClass: meta,
|
||||||
variant,
|
variant,
|
||||||
rotationVariant,
|
rotationVariant,
|
||||||
@ -53,31 +64,29 @@ export function getBuildingDataFromCode(code) {
|
|||||||
return gBuildingVariants[code];
|
return gBuildingVariants[code];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the cache for the codes
|
||||||
|
*/
|
||||||
|
export function buildBuildingCodeCache() {
|
||||||
|
for (const code in gBuildingVariants) {
|
||||||
|
const data = gBuildingVariants[code];
|
||||||
|
const hash = data.metaInstance.getId() + "/" + data.variant + "/" + data.rotationVariant;
|
||||||
|
variantsCache.set(hash, +code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds the code for a given variant
|
* Finds the code for a given variant
|
||||||
* @param {MetaBuilding} metaBuilding
|
* @param {MetaBuilding} metaBuilding
|
||||||
* @param {typeof MetaBuildingVariant} variant
|
* @param {typeof MetaBuildingVariant} variant
|
||||||
* @param {number} rotationVariant
|
* @param {number} rotationVariant
|
||||||
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
export function getCodeFromBuildingData(metaBuilding, variant, rotationVariant) {
|
export function getCodeFromBuildingData(metaBuilding, variant, rotationVariant) {
|
||||||
for (const key in gBuildingVariants) {
|
const hash = metaBuilding.getId() + "/" + variant.getId() + "/" + rotationVariant;
|
||||||
const data = gBuildingVariants[key];
|
const result = variantsCache.get(hash);
|
||||||
if (
|
if (G_IS_DEV) {
|
||||||
data.metaInstance.getId() === metaBuilding.getId() &&
|
assertAlways(!!result, "Building not found by data: " + hash);
|
||||||
data.variant === variant &&
|
|
||||||
data.rotationVariant === rotationVariant
|
|
||||||
) {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
assertAlways(
|
return result;
|
||||||
false,
|
|
||||||
"Building not found by data: " +
|
|
||||||
metaBuilding.getId() +
|
|
||||||
" / " +
|
|
||||||
variant.getId() +
|
|
||||||
" / " +
|
|
||||||
rotationVariant
|
|
||||||
);
|
|
||||||
return "0";
|
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,12 @@
|
|||||||
import { Application } from "../application";
|
import { Application } from "../application";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
import { BufferMaintainer } from "../core/buffer_maintainer";
|
import { BufferMaintainer } from "../core/buffer_maintainer";
|
||||||
import { disableImageSmoothing, enableImageSmoothing, registerCanvas } from "../core/buffer_utils";
|
import {
|
||||||
|
disableImageSmoothing,
|
||||||
|
enableImageSmoothing,
|
||||||
|
getBufferStats,
|
||||||
|
registerCanvas,
|
||||||
|
} from "../core/buffer_utils";
|
||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { getDeviceDPI, resizeHighDPICanvas } from "../core/dpi_manager";
|
import { getDeviceDPI, resizeHighDPICanvas } from "../core/dpi_manager";
|
||||||
import { DrawParameters } from "../core/draw_parameters";
|
import { DrawParameters } from "../core/draw_parameters";
|
||||||
@ -220,9 +225,6 @@ export class GameCore {
|
|||||||
lastContext.clearRect(0, 0, lastCanvas.width, lastCanvas.height);
|
lastContext.clearRect(0, 0, lastCanvas.width, lastCanvas.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// globalConfig.smoothing.smoothMainCanvas = getDeviceDPI() < 1.5;
|
|
||||||
// globalConfig.smoothing.smoothMainCanvas = true;
|
|
||||||
|
|
||||||
canvas.classList.toggle("smoothed", globalConfig.smoothing.smoothMainCanvas);
|
canvas.classList.toggle("smoothed", globalConfig.smoothing.smoothMainCanvas);
|
||||||
|
|
||||||
// Oof, use :not() instead
|
// Oof, use :not() instead
|
||||||
@ -375,9 +377,9 @@ export class GameCore {
|
|||||||
(zoomLevel / globalConfig.assetsDpi) * getDeviceDPI() * globalConfig.assetsSharpness;
|
(zoomLevel / globalConfig.assetsDpi) * getDeviceDPI() * globalConfig.assetsSharpness;
|
||||||
|
|
||||||
let desiredAtlasScale = "0.25";
|
let desiredAtlasScale = "0.25";
|
||||||
if (effectiveZoomLevel > 0.8 && !lowQuality) {
|
if (effectiveZoomLevel > 0.5 && !lowQuality) {
|
||||||
desiredAtlasScale = ORIGINAL_SPRITE_SCALE;
|
desiredAtlasScale = ORIGINAL_SPRITE_SCALE;
|
||||||
} else if (effectiveZoomLevel > 0.4 && !lowQuality) {
|
} else if (effectiveZoomLevel > 0.35 && !lowQuality) {
|
||||||
desiredAtlasScale = "0.5";
|
desiredAtlasScale = "0.5";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,18 +503,37 @@ export class GameCore {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const stats = this.root.buffers.getStats();
|
const stats = this.root.buffers.getStats();
|
||||||
|
|
||||||
context.fillText(
|
context.fillText(
|
||||||
"Buffers: " +
|
"Maintained Buffers: " +
|
||||||
stats.rootKeys +
|
stats.rootKeys +
|
||||||
" root keys, " +
|
" root keys / " +
|
||||||
stats.subKeys +
|
stats.subKeys +
|
||||||
" sub keys / buffers / VRAM: " +
|
" buffers / VRAM: " +
|
||||||
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
round2Digits(stats.vramBytes / (1024 * 1024)) +
|
||||||
" MB",
|
" MB",
|
||||||
|
|
||||||
20,
|
20,
|
||||||
620
|
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,
|
||||||
|
20,
|
||||||
|
640
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_IS_DEV && globalConfig.debug.testClipping) {
|
if (G_IS_DEV && globalConfig.debug.testClipping) {
|
||||||
|
|||||||
@ -1,229 +1,221 @@
|
|||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
import { DrawParameters } from "../core/draw_parameters";
|
import { DrawParameters } from "../core/draw_parameters";
|
||||||
import { Component } from "./component";
|
import { Component } from "./component";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
|
|
||||||
import { GameRoot } from "./root";
|
import { GameRoot } from "./root";
|
||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { enumDirectionToVector, enumDirectionToAngle } from "../core/vector";
|
import { enumDirectionToVector, enumDirectionToAngle } from "../core/vector";
|
||||||
import { BasicSerializableObject, types } from "../savegame/serialization";
|
import { BasicSerializableObject, types } from "../savegame/serialization";
|
||||||
import { EntityComponentStorage } from "./entity_components";
|
import { EntityComponentStorage } from "./entity_components";
|
||||||
import { Loader } from "../core/loader";
|
import { Loader } from "../core/loader";
|
||||||
import { drawRotatedSprite } from "../core/draw_utils";
|
import { drawRotatedSprite } from "../core/draw_utils";
|
||||||
import { gComponentRegistry } from "../core/global_registries";
|
import { gComponentRegistry } from "../core/global_registries";
|
||||||
|
|
||||||
export class Entity extends BasicSerializableObject {
|
export class Entity extends BasicSerializableObject {
|
||||||
/**
|
/**
|
||||||
* @param {GameRoot} root
|
* @param {GameRoot} root
|
||||||
*/
|
*/
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle to the global game root
|
* Handle to the global game root
|
||||||
*/
|
*/
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The components of the entity
|
* The components of the entity
|
||||||
*/
|
*/
|
||||||
this.components = new EntityComponentStorage();
|
this.components = new EntityComponentStorage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether this entity was registered on the @see EntityManager so far
|
* Whether this entity was registered on the @see EntityManager so far
|
||||||
*/
|
*/
|
||||||
this.registered = false;
|
this.registered = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On which layer this entity is
|
* On which layer this entity is
|
||||||
* @type {Layer}
|
* @type {Layer}
|
||||||
*/
|
*/
|
||||||
this.layer = "regular";
|
this.layer = "regular";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal entity unique id, set by the @see EntityManager
|
* Internal entity unique id, set by the @see EntityManager
|
||||||
*/
|
*/
|
||||||
this.uid = 0;
|
this.uid = 0;
|
||||||
|
|
||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores if this entity is destroyed, set by the @see EntityManager
|
* Stores if this entity is destroyed, set by the @see EntityManager
|
||||||
* @type {boolean} */
|
* @type {boolean} */
|
||||||
this.destroyed;
|
this.destroyed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores if this entity is queued to get destroyed in the next tick
|
* Stores if this entity is queued to get destroyed in the next tick
|
||||||
* of the @see EntityManager
|
* of the @see EntityManager
|
||||||
* @type {boolean} */
|
* @type {boolean} */
|
||||||
this.queuedForDestroy;
|
this.queuedForDestroy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores the reason why this entity was destroyed
|
* Stores the reason why this entity was destroyed
|
||||||
* @type {string} */
|
* @type {string} */
|
||||||
this.destroyReason;
|
this.destroyReason;
|
||||||
|
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
}
|
}
|
||||||
|
|
||||||
static getId() {
|
static getId() {
|
||||||
return "Entity";
|
return "Entity";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see BasicSerializableObject.getSchema
|
* @see BasicSerializableObject.getSchema
|
||||||
* @returns {import("../savegame/serialization").Schema}
|
* @returns {import("../savegame/serialization").Schema}
|
||||||
*/
|
*/
|
||||||
static getSchema() {
|
static getSchema() {
|
||||||
return {
|
return {
|
||||||
uid: types.uint,
|
uid: types.uint,
|
||||||
components: types.keyValueMap(types.objData(gComponentRegistry), false),
|
components: types.keyValueMap(types.objData(gComponentRegistry), false),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a clone of this entity without contents
|
* Returns a clone of this entity without contents
|
||||||
*/
|
*/
|
||||||
duplicateWithoutContents() {
|
duplicateWithoutContents() {
|
||||||
const clone = new Entity(this.root);
|
const clone = new Entity(this.root);
|
||||||
for (const key in this.components) {
|
for (const key in this.components) {
|
||||||
clone.components[key] = this.components[key].duplicateWithoutContents();
|
clone.components[key] = this.components[key].duplicateWithoutContents();
|
||||||
}
|
}
|
||||||
clone.layer = this.layer;
|
clone.layer = this.layer;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal destroy callback
|
* Adds a new component, only possible until the entity is registered on the entity manager,
|
||||||
*/
|
* after that use @see EntityManager.addDynamicComponent
|
||||||
internalDestroyCallback() {
|
* @param {Component} componentInstance
|
||||||
assert(!this.destroyed, "Can not destroy entity twice");
|
* @param {boolean} force Used by the entity manager. Internal parameter, do not change
|
||||||
this.destroyed = true;
|
*/
|
||||||
}
|
addComponent(componentInstance, force = false) {
|
||||||
|
if (!force && this.registered) {
|
||||||
/**
|
this.root.entityMgr.attachDynamicComponent(this, componentInstance);
|
||||||
* Adds a new component, only possible until the entity is registered on the entity manager,
|
return;
|
||||||
* after that use @see EntityManager.addDynamicComponent
|
}
|
||||||
* @param {Component} componentInstance
|
assert(force || !this.registered, "Entity already registered, use EntityManager.addDynamicComponent");
|
||||||
* @param {boolean} force Used by the entity manager. Internal parameter, do not change
|
const id = /** @type {typeof Component} */ (componentInstance.constructor).getId();
|
||||||
*/
|
assert(!this.components[id], "Component already present");
|
||||||
addComponent(componentInstance, force = false) {
|
this.components[id] = componentInstance;
|
||||||
if (!force && this.registered) {
|
}
|
||||||
this.root.entityMgr.attachDynamicComponent(this, componentInstance);
|
|
||||||
return;
|
/**
|
||||||
}
|
* Removes a given component, only possible until the entity is registered on the entity manager,
|
||||||
assert(force || !this.registered, "Entity already registered, use EntityManager.addDynamicComponent");
|
* after that use @see EntityManager.removeDynamicComponent
|
||||||
const id = /** @type {typeof Component} */ (componentInstance.constructor).getId();
|
* @param {typeof Component} componentClass
|
||||||
assert(!this.components[id], "Component already present");
|
* @param {boolean} force
|
||||||
this.components[id] = componentInstance;
|
*/
|
||||||
}
|
removeComponent(componentClass, force = false) {
|
||||||
|
if (!force && this.registered) {
|
||||||
/**
|
this.root.entityMgr.removeDynamicComponent(this, componentClass);
|
||||||
* Removes a given component, only possible until the entity is registered on the entity manager,
|
return;
|
||||||
* after that use @see EntityManager.removeDynamicComponent
|
}
|
||||||
* @param {typeof Component} componentClass
|
assert(
|
||||||
* @param {boolean} force
|
force || !this.registered,
|
||||||
*/
|
"Entity already registered, use EntityManager.removeDynamicComponent"
|
||||||
removeComponent(componentClass, force = false) {
|
);
|
||||||
if (!force && this.registered) {
|
const id = componentClass.getId();
|
||||||
this.root.entityMgr.removeDynamicComponent(this, componentClass);
|
assert(this.components[id], "Component does not exist on entity");
|
||||||
return;
|
delete this.components[id];
|
||||||
}
|
}
|
||||||
assert(
|
|
||||||
force || !this.registered,
|
/**
|
||||||
"Entity already registered, use EntityManager.removeDynamicComponent"
|
* Draws the entity, to override use @see Entity.drawImpl
|
||||||
);
|
* @param {DrawParameters} parameters
|
||||||
const id = componentClass.getId();
|
*/
|
||||||
assert(this.components[id], "Component does not exist on entity");
|
drawDebugOverlays(parameters) {
|
||||||
delete this.components[id];
|
const context = parameters.context;
|
||||||
}
|
const staticComp = this.components.StaticMapEntity;
|
||||||
|
|
||||||
/**
|
if (G_IS_DEV && staticComp && globalConfig.debug.showEntityBounds) {
|
||||||
* Draws the entity, to override use @see Entity.drawImpl
|
if (staticComp) {
|
||||||
* @param {DrawParameters} parameters
|
const transformed = staticComp.getTileSpaceBounds();
|
||||||
*/
|
context.strokeStyle = "rgba(255, 0, 0, 0.5)";
|
||||||
drawDebugOverlays(parameters) {
|
context.lineWidth = 2;
|
||||||
const context = parameters.context;
|
// const boundsSize = 20;
|
||||||
const staticComp = this.components.StaticMapEntity;
|
context.beginPath();
|
||||||
|
context.rect(
|
||||||
if (G_IS_DEV && staticComp && globalConfig.debug.showEntityBounds) {
|
transformed.x * globalConfig.tileSize,
|
||||||
if (staticComp) {
|
transformed.y * globalConfig.tileSize,
|
||||||
const transformed = staticComp.getTileSpaceBounds();
|
transformed.w * globalConfig.tileSize,
|
||||||
context.strokeStyle = "rgba(255, 0, 0, 0.5)";
|
transformed.h * globalConfig.tileSize
|
||||||
context.lineWidth = 2;
|
);
|
||||||
// const boundsSize = 20;
|
context.stroke();
|
||||||
context.beginPath();
|
}
|
||||||
context.rect(
|
}
|
||||||
transformed.x * globalConfig.tileSize,
|
|
||||||
transformed.y * globalConfig.tileSize,
|
if (G_IS_DEV && staticComp && globalConfig.debug.showAcceptorEjectors) {
|
||||||
transformed.w * globalConfig.tileSize,
|
const ejectorComp = this.components.ItemEjector;
|
||||||
transformed.h * globalConfig.tileSize
|
|
||||||
);
|
if (ejectorComp) {
|
||||||
context.stroke();
|
const ejectorSprite = Loader.getSprite("sprites/debug/ejector_slot.png");
|
||||||
}
|
for (let i = 0; i < ejectorComp.slots.length; ++i) {
|
||||||
}
|
const slot = ejectorComp.slots[i];
|
||||||
|
const slotTile = staticComp.localTileToWorld(slot.pos);
|
||||||
if (G_IS_DEV && staticComp && globalConfig.debug.showAcceptorEjectors) {
|
const direction = staticComp.localDirectionToWorld(slot.direction);
|
||||||
const ejectorComp = this.components.ItemEjector;
|
const directionVector = enumDirectionToVector[direction];
|
||||||
|
const angle = Math.radians(enumDirectionToAngle[direction]);
|
||||||
if (ejectorComp) {
|
|
||||||
const ejectorSprite = Loader.getSprite("sprites/debug/ejector_slot.png");
|
context.globalAlpha = slot.item ? 1 : 0.2;
|
||||||
for (let i = 0; i < ejectorComp.slots.length; ++i) {
|
drawRotatedSprite({
|
||||||
const slot = ejectorComp.slots[i];
|
parameters,
|
||||||
const slotTile = staticComp.localTileToWorld(slot.pos);
|
sprite: ejectorSprite,
|
||||||
const direction = staticComp.localDirectionToWorld(slot.direction);
|
x: (slotTile.x + 0.5 + directionVector.x * 0.37) * globalConfig.tileSize,
|
||||||
const directionVector = enumDirectionToVector[direction];
|
y: (slotTile.y + 0.5 + directionVector.y * 0.37) * globalConfig.tileSize,
|
||||||
const angle = Math.radians(enumDirectionToAngle[direction]);
|
angle,
|
||||||
|
size: globalConfig.tileSize * 0.25,
|
||||||
context.globalAlpha = slot.item ? 1 : 0.2;
|
});
|
||||||
drawRotatedSprite({
|
}
|
||||||
parameters,
|
}
|
||||||
sprite: ejectorSprite,
|
const acceptorComp = this.components.ItemAcceptor;
|
||||||
x: (slotTile.x + 0.5 + directionVector.x * 0.37) * globalConfig.tileSize,
|
|
||||||
y: (slotTile.y + 0.5 + directionVector.y * 0.37) * globalConfig.tileSize,
|
if (acceptorComp) {
|
||||||
angle,
|
const acceptorSprite = Loader.getSprite("sprites/misc/acceptor_slot.png");
|
||||||
size: globalConfig.tileSize * 0.25,
|
for (let i = 0; i < acceptorComp.slots.length; ++i) {
|
||||||
});
|
const slot = acceptorComp.slots[i];
|
||||||
}
|
const slotTile = staticComp.localTileToWorld(slot.pos);
|
||||||
}
|
for (let k = 0; k < slot.directions.length; ++k) {
|
||||||
const acceptorComp = this.components.ItemAcceptor;
|
const direction = staticComp.localDirectionToWorld(slot.directions[k]);
|
||||||
|
const directionVector = enumDirectionToVector[direction];
|
||||||
if (acceptorComp) {
|
const angle = Math.radians(enumDirectionToAngle[direction] + 180);
|
||||||
const acceptorSprite = Loader.getSprite("sprites/misc/acceptor_slot.png");
|
context.globalAlpha = 0.4;
|
||||||
for (let i = 0; i < acceptorComp.slots.length; ++i) {
|
drawRotatedSprite({
|
||||||
const slot = acceptorComp.slots[i];
|
parameters,
|
||||||
const slotTile = staticComp.localTileToWorld(slot.pos);
|
sprite: acceptorSprite,
|
||||||
for (let k = 0; k < slot.directions.length; ++k) {
|
x: (slotTile.x + 0.5 + directionVector.x * 0.37) * globalConfig.tileSize,
|
||||||
const direction = staticComp.localDirectionToWorld(slot.directions[k]);
|
y: (slotTile.y + 0.5 + directionVector.y * 0.37) * globalConfig.tileSize,
|
||||||
const directionVector = enumDirectionToVector[direction];
|
angle,
|
||||||
const angle = Math.radians(enumDirectionToAngle[direction] + 180);
|
size: globalConfig.tileSize * 0.25,
|
||||||
context.globalAlpha = 0.4;
|
});
|
||||||
drawRotatedSprite({
|
}
|
||||||
parameters,
|
}
|
||||||
sprite: acceptorSprite,
|
}
|
||||||
x: (slotTile.x + 0.5 + directionVector.x * 0.37) * globalConfig.tileSize,
|
|
||||||
y: (slotTile.y + 0.5 + directionVector.y * 0.37) * globalConfig.tileSize,
|
context.globalAlpha = 1;
|
||||||
angle,
|
}
|
||||||
size: globalConfig.tileSize * 0.25,
|
// this.drawImpl(parameters);
|
||||||
});
|
}
|
||||||
}
|
|
||||||
}
|
///// Helper interfaces
|
||||||
}
|
|
||||||
|
///// Interface to override by subclasses
|
||||||
context.globalAlpha = 1;
|
|
||||||
}
|
/**
|
||||||
// this.drawImpl(parameters);
|
* override, should draw the entity
|
||||||
}
|
* @param {DrawParameters} parameters
|
||||||
|
*/
|
||||||
///// Helper interfaces
|
drawImpl(parameters) {
|
||||||
|
abstract;
|
||||||
///// Interface to override by subclasses
|
}
|
||||||
|
}
|
||||||
/**
|
|
||||||
* override, should draw the entity
|
|
||||||
* @param {DrawParameters} parameters
|
|
||||||
*/
|
|
||||||
drawImpl(parameters) {
|
|
||||||
abstract;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,252 +1,258 @@
|
|||||||
import { arrayDeleteValue, newEmptyMap, fastArrayDeleteValue } from "../core/utils";
|
import { arrayDeleteValue, newEmptyMap, fastArrayDeleteValue } from "../core/utils";
|
||||||
import { Component } from "./component";
|
import { Component } from "./component";
|
||||||
import { GameRoot } from "./root";
|
import { GameRoot } from "./root";
|
||||||
import { Entity } from "./entity";
|
import { Entity } from "./entity";
|
||||||
import { BasicSerializableObject, types } from "../savegame/serialization";
|
import { BasicSerializableObject, types } from "../savegame/serialization";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
|
import { globalConfig } from "../core/config";
|
||||||
const logger = createLogger("entity_manager");
|
|
||||||
|
const logger = createLogger("entity_manager");
|
||||||
// Manages all entities
|
|
||||||
|
// Manages all entities
|
||||||
// NOTICE: We use arrayDeleteValue instead of fastArrayDeleteValue since that does not preserve the order
|
|
||||||
// This is slower but we need it for the street path generation
|
// NOTICE: We use arrayDeleteValue instead of fastArrayDeleteValue since that does not preserve the order
|
||||||
|
// This is slower but we need it for the street path generation
|
||||||
export class EntityManager extends BasicSerializableObject {
|
|
||||||
constructor(root) {
|
export class EntityManager extends BasicSerializableObject {
|
||||||
super();
|
constructor(root) {
|
||||||
|
super();
|
||||||
/** @type {GameRoot} */
|
|
||||||
this.root = root;
|
/** @type {GameRoot} */
|
||||||
|
this.root = root;
|
||||||
/** @type {Array<Entity>} */
|
|
||||||
this.entities = [];
|
/** @type {Array<Entity>} */
|
||||||
|
this.entities = [];
|
||||||
// We store a seperate list with entities to destroy, since we don't destroy
|
|
||||||
// them instantly
|
// We store a separate list with entities to destroy, since we don't destroy
|
||||||
/** @type {Array<Entity>} */
|
// them instantly
|
||||||
this.destroyList = [];
|
/** @type {Array<Entity>} */
|
||||||
|
this.destroyList = [];
|
||||||
// Store a map from componentid to entities - This is used by the game system
|
|
||||||
// for faster processing
|
// Store a map from componentid to entities - This is used by the game system
|
||||||
/** @type {Object.<string, Array<Entity>>} */
|
// for faster processing
|
||||||
this.componentToEntity = newEmptyMap();
|
/** @type {Object.<string, Array<Entity>>} */
|
||||||
|
this.componentToEntity = newEmptyMap();
|
||||||
// Store the next uid to use
|
|
||||||
this.nextUid = 10000;
|
// Store the next uid to use
|
||||||
}
|
this.nextUid = 10000;
|
||||||
|
}
|
||||||
static getId() {
|
|
||||||
return "EntityManager";
|
static getId() {
|
||||||
}
|
return "EntityManager";
|
||||||
|
}
|
||||||
static getSchema() {
|
|
||||||
return {
|
static getSchema() {
|
||||||
nextUid: types.uint,
|
return {
|
||||||
};
|
nextUid: types.uint,
|
||||||
}
|
};
|
||||||
|
}
|
||||||
getStatsText() {
|
|
||||||
return this.entities.length + " entities [" + this.destroyList.length + " to kill]";
|
getStatsText() {
|
||||||
}
|
return this.entities.length + " entities [" + this.destroyList.length + " to kill]";
|
||||||
|
}
|
||||||
// Main update
|
|
||||||
update() {
|
// Main update
|
||||||
this.processDestroyList();
|
update() {
|
||||||
}
|
this.processDestroyList();
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Registers a new entity
|
/**
|
||||||
* @param {Entity} entity
|
* Registers a new entity
|
||||||
* @param {number=} uid Optional predefined uid
|
* @param {Entity} entity
|
||||||
*/
|
* @param {number=} uid Optional predefined uid
|
||||||
registerEntity(entity, uid = null) {
|
*/
|
||||||
assert(this.entities.indexOf(entity) < 0, `RegisterEntity() called twice for entity ${entity}`);
|
registerEntity(entity, uid = null) {
|
||||||
assert(!entity.destroyed, `Attempting to register destroyed entity ${entity}`);
|
if (G_IS_DEV && !globalConfig.debug.disableSlowAsserts) {
|
||||||
|
assert(this.entities.indexOf(entity) < 0, `RegisterEntity() called twice for entity ${entity}`);
|
||||||
if (G_IS_DEV && uid !== null) {
|
}
|
||||||
assert(!this.findByUid(uid, false), "Entity uid already taken: " + uid);
|
assert(!entity.destroyed, `Attempting to register destroyed entity ${entity}`);
|
||||||
}
|
|
||||||
|
if (G_IS_DEV && !globalConfig.debug.disableSlowAsserts && uid !== null) {
|
||||||
if (uid !== null) {
|
assert(!this.findByUid(uid, false), "Entity uid already taken: " + uid);
|
||||||
assert(uid >= 0 && uid < Number.MAX_SAFE_INTEGER, "Invalid uid passed: " + uid);
|
assert(uid >= 0 && uid < Number.MAX_SAFE_INTEGER, "Invalid uid passed: " + uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.entities.push(entity);
|
this.entities.push(entity);
|
||||||
|
|
||||||
// Register into the componentToEntity map
|
// Register into the componentToEntity map
|
||||||
for (const componentId in entity.components) {
|
for (const componentId in entity.components) {
|
||||||
if (entity.components[componentId]) {
|
if (entity.components[componentId]) {
|
||||||
if (this.componentToEntity[componentId]) {
|
if (this.componentToEntity[componentId]) {
|
||||||
this.componentToEntity[componentId].push(entity);
|
this.componentToEntity[componentId].push(entity);
|
||||||
} else {
|
} else {
|
||||||
this.componentToEntity[componentId] = [entity];
|
this.componentToEntity[componentId] = [entity];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give each entity a unique id
|
// Give each entity a unique id
|
||||||
entity.uid = uid ? uid : this.generateUid();
|
entity.uid = uid ? uid : this.generateUid();
|
||||||
entity.registered = true;
|
entity.registered = true;
|
||||||
|
|
||||||
this.root.signals.entityAdded.dispatch(entity);
|
this.root.signals.entityAdded.dispatch(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sorts all entitiy lists after a resync
|
* Generates a new uid
|
||||||
*/
|
* @returns {number}
|
||||||
sortEntityLists() {
|
*/
|
||||||
this.entities.sort((a, b) => a.uid - b.uid);
|
generateUid() {
|
||||||
this.destroyList.sort((a, b) => a.uid - b.uid);
|
return this.nextUid++;
|
||||||
|
}
|
||||||
for (const key in this.componentToEntity) {
|
|
||||||
this.componentToEntity[key].sort((a, b) => a.uid - b.uid);
|
/**
|
||||||
}
|
* Call to attach a new component after the creation of the entity
|
||||||
}
|
* @param {Entity} entity
|
||||||
|
* @param {Component} component
|
||||||
/**
|
*/
|
||||||
* Generates a new uid
|
attachDynamicComponent(entity, component) {
|
||||||
* @returns {number}
|
entity.addComponent(component, true);
|
||||||
*/
|
const componentId = /** @type {typeof Component} */ (component.constructor).getId();
|
||||||
generateUid() {
|
if (this.componentToEntity[componentId]) {
|
||||||
return this.nextUid++;
|
this.componentToEntity[componentId].push(entity);
|
||||||
}
|
} else {
|
||||||
|
this.componentToEntity[componentId] = [entity];
|
||||||
/**
|
}
|
||||||
* Call to attach a new component after the creation of the entity
|
this.root.signals.entityGotNewComponent.dispatch(entity);
|
||||||
* @param {Entity} entity
|
}
|
||||||
* @param {Component} component
|
|
||||||
*/
|
/**
|
||||||
attachDynamicComponent(entity, component) {
|
* Call to remove a component after the creation of the entity
|
||||||
entity.addComponent(component, true);
|
* @param {Entity} entity
|
||||||
const componentId = /** @type {typeof Component} */ (component.constructor).getId();
|
* @param {typeof Component} component
|
||||||
if (this.componentToEntity[componentId]) {
|
*/
|
||||||
this.componentToEntity[componentId].push(entity);
|
removeDynamicComponent(entity, component) {
|
||||||
} else {
|
entity.removeComponent(component, true);
|
||||||
this.componentToEntity[componentId] = [entity];
|
const componentId = /** @type {typeof Component} */ (component.constructor).getId();
|
||||||
}
|
|
||||||
this.root.signals.entityGotNewComponent.dispatch(entity);
|
fastArrayDeleteValue(this.componentToEntity[componentId], entity);
|
||||||
}
|
this.root.signals.entityComponentRemoved.dispatch(entity);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Call to remove a component after the creation of the entity
|
/**
|
||||||
* @param {Entity} entity
|
* Finds an entity buy its uid, kinda slow since it loops over all entities
|
||||||
* @param {typeof Component} component
|
* @param {number} uid
|
||||||
*/
|
* @param {boolean=} errorWhenNotFound
|
||||||
removeDynamicComponent(entity, component) {
|
* @returns {Entity}
|
||||||
entity.removeComponent(component, true);
|
*/
|
||||||
const componentId = /** @type {typeof Component} */ (component.constructor).getId();
|
findByUid(uid, errorWhenNotFound = true) {
|
||||||
|
const arr = this.entities;
|
||||||
fastArrayDeleteValue(this.componentToEntity[componentId], entity);
|
for (let i = 0, len = arr.length; i < len; ++i) {
|
||||||
this.root.signals.entityComponentRemoved.dispatch(entity);
|
const entity = arr[i];
|
||||||
}
|
if (entity.uid === uid) {
|
||||||
|
if (entity.queuedForDestroy || entity.destroyed) {
|
||||||
/**
|
if (errorWhenNotFound) {
|
||||||
* Finds an entity buy its uid, kinda slow since it loops over all entities
|
logger.warn("Entity with UID", uid, "not found (destroyed)");
|
||||||
* @param {number} uid
|
}
|
||||||
* @param {boolean=} errorWhenNotFound
|
return null;
|
||||||
* @returns {Entity}
|
}
|
||||||
*/
|
return entity;
|
||||||
findByUid(uid, errorWhenNotFound = true) {
|
}
|
||||||
const arr = this.entities;
|
}
|
||||||
for (let i = 0, len = arr.length; i < len; ++i) {
|
if (errorWhenNotFound) {
|
||||||
const entity = arr[i];
|
logger.warn("Entity with UID", uid, "not found");
|
||||||
if (entity.uid === uid) {
|
}
|
||||||
if (entity.queuedForDestroy || entity.destroyed) {
|
return null;
|
||||||
if (errorWhenNotFound) {
|
}
|
||||||
logger.warn("Entity with UID", uid, "not found (destroyed)");
|
|
||||||
}
|
/**
|
||||||
return null;
|
* Returns a map which gives a mapping from UID to Entity.
|
||||||
}
|
* This map is not updated.
|
||||||
return entity;
|
*
|
||||||
}
|
* @returns {Map<number, Entity>}
|
||||||
}
|
*/
|
||||||
if (errorWhenNotFound) {
|
getFrozenUidSearchMap() {
|
||||||
logger.warn("Entity with UID", uid, "not found");
|
const result = new Map();
|
||||||
}
|
const array = this.entities;
|
||||||
return null;
|
for (let i = 0, len = array.length; i < len; ++i) {
|
||||||
}
|
const entity = array[i];
|
||||||
|
if (!entity.queuedForDestroy && !entity.destroyed) {
|
||||||
/**
|
result.set(entity.uid, entity);
|
||||||
* Returns all entities having the given component
|
}
|
||||||
* @param {typeof Component} componentHandle
|
}
|
||||||
* @returns {Array<Entity>} entities
|
return result;
|
||||||
*/
|
}
|
||||||
getAllWithComponent(componentHandle) {
|
|
||||||
return this.componentToEntity[componentHandle.getId()] || [];
|
/**
|
||||||
}
|
* Returns all entities having the given component
|
||||||
|
* @param {typeof Component} componentHandle
|
||||||
/**
|
* @returns {Array<Entity>} entities
|
||||||
* Return all of a given class. This is SLOW!
|
*/
|
||||||
* @param {object} entityClass
|
getAllWithComponent(componentHandle) {
|
||||||
* @returns {Array<Entity>} entities
|
return this.componentToEntity[componentHandle.getId()] || [];
|
||||||
*/
|
}
|
||||||
getAllOfClass(entityClass) {
|
|
||||||
// FIXME: Slow
|
/**
|
||||||
const result = [];
|
* Return all of a given class. This is SLOW!
|
||||||
for (let i = 0; i < this.entities.length; ++i) {
|
* @param {object} entityClass
|
||||||
const entity = this.entities[i];
|
* @returns {Array<Entity>} entities
|
||||||
if (entity instanceof entityClass) {
|
*/
|
||||||
result.push(entity);
|
getAllOfClass(entityClass) {
|
||||||
}
|
// FIXME: Slow
|
||||||
}
|
const result = [];
|
||||||
return result;
|
for (let i = 0; i < this.entities.length; ++i) {
|
||||||
}
|
const entity = this.entities[i];
|
||||||
|
if (entity instanceof entityClass) {
|
||||||
/**
|
result.push(entity);
|
||||||
* Unregisters all components of an entity from the component to entity mapping
|
}
|
||||||
* @param {Entity} entity
|
}
|
||||||
*/
|
return result;
|
||||||
unregisterEntityComponents(entity) {
|
}
|
||||||
for (const componentId in entity.components) {
|
|
||||||
if (entity.components[componentId]) {
|
/**
|
||||||
arrayDeleteValue(this.componentToEntity[componentId], entity);
|
* Unregisters all components of an entity from the component to entity mapping
|
||||||
}
|
* @param {Entity} entity
|
||||||
}
|
*/
|
||||||
}
|
unregisterEntityComponents(entity) {
|
||||||
|
for (const componentId in entity.components) {
|
||||||
// Processes the entities to destroy and actually destroys them
|
if (entity.components[componentId]) {
|
||||||
/* eslint-disable max-statements */
|
arrayDeleteValue(this.componentToEntity[componentId], entity);
|
||||||
processDestroyList() {
|
}
|
||||||
for (let i = 0; i < this.destroyList.length; ++i) {
|
}
|
||||||
const entity = this.destroyList[i];
|
}
|
||||||
|
|
||||||
// Remove from entities list
|
// Processes the entities to destroy and actually destroys them
|
||||||
arrayDeleteValue(this.entities, entity);
|
/* eslint-disable max-statements */
|
||||||
|
processDestroyList() {
|
||||||
// Remove from componentToEntity list
|
for (let i = 0; i < this.destroyList.length; ++i) {
|
||||||
this.unregisterEntityComponents(entity);
|
const entity = this.destroyList[i];
|
||||||
|
|
||||||
entity.registered = false;
|
// Remove from entities list
|
||||||
entity.internalDestroyCallback();
|
arrayDeleteValue(this.entities, entity);
|
||||||
|
|
||||||
this.root.signals.entityDestroyed.dispatch(entity);
|
// Remove from componentToEntity list
|
||||||
}
|
this.unregisterEntityComponents(entity);
|
||||||
|
|
||||||
this.destroyList = [];
|
entity.registered = false;
|
||||||
}
|
entity.destroyed = true;
|
||||||
|
|
||||||
/**
|
this.root.signals.entityDestroyed.dispatch(entity);
|
||||||
* Queues an entity for destruction
|
}
|
||||||
* @param {Entity} entity
|
|
||||||
*/
|
this.destroyList = [];
|
||||||
destroyEntity(entity) {
|
}
|
||||||
if (entity.destroyed) {
|
|
||||||
logger.error("Tried to destroy already destroyed entity:", entity.uid);
|
/**
|
||||||
return;
|
* Queues an entity for destruction
|
||||||
}
|
* @param {Entity} entity
|
||||||
|
*/
|
||||||
if (entity.queuedForDestroy) {
|
destroyEntity(entity) {
|
||||||
logger.error("Trying to destroy entity which is already queued for destroy!", entity.uid);
|
if (entity.destroyed) {
|
||||||
return;
|
logger.error("Tried to destroy already destroyed entity:", entity.uid);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (this.destroyList.indexOf(entity) < 0) {
|
|
||||||
this.destroyList.push(entity);
|
if (entity.queuedForDestroy) {
|
||||||
entity.queuedForDestroy = true;
|
logger.error("Trying to destroy entity which is already queued for destroy!", entity.uid);
|
||||||
this.root.signals.entityQueuedForDestroy.dispatch(entity);
|
return;
|
||||||
} else {
|
}
|
||||||
assert(false, "Trying to destroy entity twice");
|
|
||||||
}
|
if (this.destroyList.indexOf(entity) < 0) {
|
||||||
}
|
this.destroyList.push(entity);
|
||||||
}
|
entity.queuedForDestroy = true;
|
||||||
|
this.root.signals.entityQueuedForDestroy.dispatch(entity);
|
||||||
|
} else {
|
||||||
|
assert(false, "Trying to destroy entity twice");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
import { Application } from "../application";
|
import { Application } from "../application";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
|
|
||||||
|
import { randomChoice } from "../core/utils";
|
||||||
import { T } from "../translations";
|
import { T } from "../translations";
|
||||||
|
|
||||||
export class GameLoadingOverlay {
|
export class GameLoadingOverlay {
|
||||||
@ -43,6 +45,7 @@ export class GameLoadingOverlay {
|
|||||||
this.element.classList.add("gameLoadingOverlay");
|
this.element.classList.add("gameLoadingOverlay");
|
||||||
this.parent.appendChild(this.element);
|
this.parent.appendChild(this.element);
|
||||||
this.internalAddSpinnerAndText(this.element);
|
this.internalAddSpinnerAndText(this.element);
|
||||||
|
this.internalAddHint(this.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,4 +58,15 @@ export class GameLoadingOverlay {
|
|||||||
inner.innerText = T.global.loading;
|
inner.innerText = T.global.loading;
|
||||||
element.appendChild(inner);
|
element.appendChild(inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a random hint
|
||||||
|
* @param {HTMLElement} element
|
||||||
|
*/
|
||||||
|
internalAddHint(element) {
|
||||||
|
const hint = document.createElement("span");
|
||||||
|
hint.innerHTML = randomChoice(T.tips);
|
||||||
|
hint.classList.add("hint");
|
||||||
|
element.appendChild(hint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,131 +1,137 @@
|
|||||||
/* typehints:start */
|
/* typehints:start */
|
||||||
import { Component } from "./component";
|
import { Component } from "./component";
|
||||||
import { Entity } from "./entity";
|
import { Entity } from "./entity";
|
||||||
/* typehints:end */
|
/* typehints:end */
|
||||||
|
|
||||||
import { GameRoot } from "./root";
|
import { GameRoot } from "./root";
|
||||||
import { GameSystem } from "./game_system";
|
import { GameSystem } from "./game_system";
|
||||||
import { arrayDelete, arrayDeleteValue } from "../core/utils";
|
import { arrayDelete, arrayDeleteValue } from "../core/utils";
|
||||||
|
import { globalConfig } from "../core/config";
|
||||||
export class GameSystemWithFilter extends GameSystem {
|
|
||||||
/**
|
export class GameSystemWithFilter extends GameSystem {
|
||||||
* Constructs a new game system with the given component filter. It will process
|
/**
|
||||||
* all entities which have *all* of the passed components
|
* Constructs a new game system with the given component filter. It will process
|
||||||
* @param {GameRoot} root
|
* all entities which have *all* of the passed components
|
||||||
* @param {Array<typeof Component>} requiredComponents
|
* @param {GameRoot} root
|
||||||
*/
|
* @param {Array<typeof Component>} requiredComponents
|
||||||
constructor(root, requiredComponents) {
|
*/
|
||||||
super(root);
|
constructor(root, requiredComponents) {
|
||||||
this.requiredComponents = requiredComponents;
|
super(root);
|
||||||
this.requiredComponentIds = requiredComponents.map(component => component.getId());
|
this.requiredComponents = requiredComponents;
|
||||||
|
this.requiredComponentIds = requiredComponents.map(component => component.getId());
|
||||||
/**
|
|
||||||
* All entities which match the current components
|
/**
|
||||||
* @type {Array<Entity>}
|
* All entities which match the current components
|
||||||
*/
|
* @type {Array<Entity>}
|
||||||
this.allEntities = [];
|
*/
|
||||||
|
this.allEntities = [];
|
||||||
this.root.signals.entityAdded.add(this.internalPushEntityIfMatching, this);
|
|
||||||
this.root.signals.entityGotNewComponent.add(this.internalReconsiderEntityToAdd, this);
|
this.root.signals.entityAdded.add(this.internalPushEntityIfMatching, this);
|
||||||
this.root.signals.entityComponentRemoved.add(this.internalCheckEntityAfterComponentRemoval, this);
|
this.root.signals.entityGotNewComponent.add(this.internalReconsiderEntityToAdd, this);
|
||||||
this.root.signals.entityQueuedForDestroy.add(this.internalPopEntityIfMatching, this);
|
this.root.signals.entityComponentRemoved.add(this.internalCheckEntityAfterComponentRemoval, this);
|
||||||
|
this.root.signals.entityQueuedForDestroy.add(this.internalPopEntityIfMatching, this);
|
||||||
this.root.signals.postLoadHook.add(this.internalPostLoadHook, this);
|
|
||||||
this.root.signals.bulkOperationFinished.add(this.refreshCaches, this);
|
this.root.signals.postLoadHook.add(this.internalPostLoadHook, this);
|
||||||
}
|
this.root.signals.bulkOperationFinished.add(this.refreshCaches, this);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* @param {Entity} entity
|
/**
|
||||||
*/
|
* @param {Entity} entity
|
||||||
internalPushEntityIfMatching(entity) {
|
*/
|
||||||
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
internalPushEntityIfMatching(entity) {
|
||||||
if (!entity.components[this.requiredComponentIds[i]]) {
|
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
||||||
return;
|
if (!entity.components[this.requiredComponentIds[i]]) {
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
assert(this.allEntities.indexOf(entity) < 0, "entity already in list: " + entity);
|
|
||||||
this.internalRegisterEntity(entity);
|
// This is slow!
|
||||||
}
|
if (G_IS_DEV && !globalConfig.debug.disableSlowAsserts) {
|
||||||
|
assert(this.allEntities.indexOf(entity) < 0, "entity already in list: " + entity);
|
||||||
/**
|
}
|
||||||
*
|
|
||||||
* @param {Entity} entity
|
this.internalRegisterEntity(entity);
|
||||||
*/
|
}
|
||||||
internalCheckEntityAfterComponentRemoval(entity) {
|
|
||||||
if (this.allEntities.indexOf(entity) < 0) {
|
/**
|
||||||
// Entity wasn't interesting anyways
|
*
|
||||||
return;
|
* @param {Entity} entity
|
||||||
}
|
*/
|
||||||
|
internalCheckEntityAfterComponentRemoval(entity) {
|
||||||
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
if (this.allEntities.indexOf(entity) < 0) {
|
||||||
if (!entity.components[this.requiredComponentIds[i]]) {
|
// Entity wasn't interesting anyways
|
||||||
// Entity is not interesting anymore
|
return;
|
||||||
arrayDeleteValue(this.allEntities, entity);
|
}
|
||||||
}
|
|
||||||
}
|
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
||||||
}
|
if (!entity.components[this.requiredComponentIds[i]]) {
|
||||||
|
// Entity is not interesting anymore
|
||||||
/**
|
arrayDeleteValue(this.allEntities, entity);
|
||||||
*
|
}
|
||||||
* @param {Entity} entity
|
}
|
||||||
*/
|
}
|
||||||
internalReconsiderEntityToAdd(entity) {
|
|
||||||
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
/**
|
||||||
if (!entity.components[this.requiredComponentIds[i]]) {
|
*
|
||||||
return;
|
* @param {Entity} entity
|
||||||
}
|
*/
|
||||||
}
|
internalReconsiderEntityToAdd(entity) {
|
||||||
if (this.allEntities.indexOf(entity) >= 0) {
|
for (let i = 0; i < this.requiredComponentIds.length; ++i) {
|
||||||
return;
|
if (!entity.components[this.requiredComponentIds[i]]) {
|
||||||
}
|
return;
|
||||||
this.internalRegisterEntity(entity);
|
}
|
||||||
}
|
}
|
||||||
|
if (this.allEntities.indexOf(entity) >= 0) {
|
||||||
refreshCaches() {
|
return;
|
||||||
this.allEntities.sort((a, b) => a.uid - b.uid);
|
}
|
||||||
|
this.internalRegisterEntity(entity);
|
||||||
// Remove all entities which are queued for destroy
|
}
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
|
||||||
const entity = this.allEntities[i];
|
refreshCaches() {
|
||||||
if (entity.queuedForDestroy || entity.destroyed) {
|
// Remove all entities which are queued for destroy
|
||||||
this.allEntities.splice(i, 1);
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
}
|
const entity = this.allEntities[i];
|
||||||
}
|
if (entity.queuedForDestroy || entity.destroyed) {
|
||||||
}
|
this.allEntities.splice(i, 1);
|
||||||
|
i -= 1;
|
||||||
/**
|
}
|
||||||
* Recomputes all target entities after the game has loaded
|
}
|
||||||
*/
|
|
||||||
internalPostLoadHook() {
|
this.allEntities.sort((a, b) => a.uid - b.uid);
|
||||||
this.refreshCaches();
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Recomputes all target entities after the game has loaded
|
||||||
*
|
*/
|
||||||
* @param {Entity} entity
|
internalPostLoadHook() {
|
||||||
*/
|
this.refreshCaches();
|
||||||
internalRegisterEntity(entity) {
|
}
|
||||||
this.allEntities.push(entity);
|
|
||||||
|
/**
|
||||||
if (this.root.gameInitialized && !this.root.bulkOperationRunning) {
|
*
|
||||||
// Sort entities by uid so behaviour is predictable
|
* @param {Entity} entity
|
||||||
this.allEntities.sort((a, b) => a.uid - b.uid);
|
*/
|
||||||
}
|
internalRegisterEntity(entity) {
|
||||||
}
|
this.allEntities.push(entity);
|
||||||
|
|
||||||
/**
|
if (this.root.gameInitialized && !this.root.bulkOperationRunning) {
|
||||||
*
|
// Sort entities by uid so behaviour is predictable
|
||||||
* @param {Entity} entity
|
this.allEntities.sort((a, b) => a.uid - b.uid);
|
||||||
*/
|
}
|
||||||
internalPopEntityIfMatching(entity) {
|
}
|
||||||
if (this.root.bulkOperationRunning) {
|
|
||||||
// We do this in refreshCaches afterwards
|
/**
|
||||||
return;
|
*
|
||||||
}
|
* @param {Entity} entity
|
||||||
const index = this.allEntities.indexOf(entity);
|
*/
|
||||||
if (index >= 0) {
|
internalPopEntityIfMatching(entity) {
|
||||||
arrayDelete(this.allEntities, index);
|
if (this.root.bulkOperationRunning) {
|
||||||
}
|
// We do this in refreshCaches afterwards
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
const index = this.allEntities.indexOf(entity);
|
||||||
|
if (index >= 0) {
|
||||||
|
arrayDelete(this.allEntities, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
22
src/js/game/hints.js
Normal file
22
src/js/game/hints.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import { randomChoice } from "../core/utils";
|
||||||
|
import { T } from "../translations";
|
||||||
|
|
||||||
|
const hintsShown = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds a new hint to show about the game which the user hasn't seen within this session
|
||||||
|
*/
|
||||||
|
export function getRandomHint() {
|
||||||
|
let maxTries = 100 * T.tips.length;
|
||||||
|
|
||||||
|
while (maxTries-- > 0) {
|
||||||
|
const hint = randomChoice(T.tips);
|
||||||
|
if (!hintsShown.includes(hint)) {
|
||||||
|
hintsShown.push(hint);
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// All tips shown so far
|
||||||
|
return randomChoice(T.tips);
|
||||||
|
}
|
||||||
@ -330,7 +330,7 @@ export class HUDBuildingPlacerLogic extends BaseHUDPart {
|
|||||||
if (tileBelow && this.root.app.settings.getAllSettings().pickMinerOnPatch) {
|
if (tileBelow && this.root.app.settings.getAllSettings().pickMinerOnPatch) {
|
||||||
this.currentMetaBuilding.set(gMetaBuildingRegistry.findByClass(MetaMinerBuilding));
|
this.currentMetaBuilding.set(gMetaBuildingRegistry.findByClass(MetaMinerBuilding));
|
||||||
|
|
||||||
// Select chained miner if available, since thats always desired once unlocked
|
// Select chained miner if available, since that's always desired once unlocked
|
||||||
if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_miner_chainable)) {
|
if (this.root.hubGoals.isRewardUnlocked(enumHubGoalRewards.reward_miner_chainable)) {
|
||||||
this.currentVariant.set(ChainableMinerVariant);
|
this.currentVariant.set(ChainableMinerVariant);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,13 @@
|
|||||||
import { BaseHUDPart } from "../base_hud_part";
|
/* dev:start */
|
||||||
import { makeDiv, removeAllChildren } from "../../../core/utils";
|
import { makeDiv, removeAllChildren } from "../../../core/utils";
|
||||||
import { globalConfig } from "../../../core/config";
|
import { Vector } from "../../../core/vector";
|
||||||
|
import { Entity } from "../../entity";
|
||||||
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
|
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows to inspect entities by pressing F8 while hovering them
|
||||||
|
*/
|
||||||
export class HUDEntityDebugger extends BaseHUDPart {
|
export class HUDEntityDebugger extends BaseHUDPart {
|
||||||
createElements(parent) {
|
createElements(parent) {
|
||||||
this.element = makeDiv(
|
this.element = makeDiv(
|
||||||
@ -9,65 +15,143 @@ export class HUDEntityDebugger extends BaseHUDPart {
|
|||||||
"ingame_HUD_EntityDebugger",
|
"ingame_HUD_EntityDebugger",
|
||||||
[],
|
[],
|
||||||
`
|
`
|
||||||
Tile below cursor: <span class="mousePos"></span><br>
|
<label>Entity Debugger</label>
|
||||||
Chunk below cursor: <span class="chunkPos"></span><br>
|
<span class="hint">Use F8 to toggle this overlay</span>
|
||||||
<div class="entityInfo"></div>
|
|
||||||
|
<div class="propertyTable">
|
||||||
|
<div class="entityComponents"></div>
|
||||||
|
</div>
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
|
this.componentsElem = this.element.querySelector(".entityComponents");
|
||||||
/** @type {HTMLElement} */
|
|
||||||
this.mousePosElem = this.element.querySelector(".mousePos");
|
|
||||||
/** @type {HTMLElement} */
|
|
||||||
this.chunkPosElem = this.element.querySelector(".chunkPos");
|
|
||||||
this.entityInfoElem = this.element.querySelector(".entityInfo");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.root.camera.downPreHandler.add(this.onMouseDown, this);
|
this.root.gameState.inputReciever.keydown.add(key => {
|
||||||
|
if (key.keyCode === 119) {
|
||||||
|
// F8
|
||||||
|
this.pickEntity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The currently selected entity
|
||||||
|
* @type {Entity}
|
||||||
|
*/
|
||||||
|
this.selectedEntity = null;
|
||||||
|
|
||||||
|
this.lastUpdate = 0;
|
||||||
|
|
||||||
|
this.domAttach = new DynamicDomAttach(this.root, this.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
pickEntity() {
|
||||||
const mousePos = this.root.app.mousePosition;
|
const mousePos = this.root.app.mousePosition;
|
||||||
if (!mousePos) {
|
if (!mousePos) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const worldPos = this.root.camera.screenToWorld(mousePos);
|
const worldPos = this.root.camera.screenToWorld(mousePos);
|
||||||
const worldTile = worldPos.toTileSpace();
|
const worldTile = worldPos.toTileSpace();
|
||||||
|
|
||||||
const chunk = worldTile.divideScalar(globalConfig.mapChunkSize).floor();
|
|
||||||
this.mousePosElem.innerText = worldTile.x + " / " + worldTile.y;
|
|
||||||
this.chunkPosElem.innerText = chunk.x + " / " + chunk.y;
|
|
||||||
|
|
||||||
const entity = this.root.map.getTileContent(worldTile, this.root.currentLayer);
|
const entity = this.root.map.getTileContent(worldTile, this.root.currentLayer);
|
||||||
|
|
||||||
|
this.selectedEntity = entity;
|
||||||
if (entity) {
|
if (entity) {
|
||||||
removeAllChildren(this.entityInfoElem);
|
this.rerenderFull(entity);
|
||||||
let html = "Entity";
|
|
||||||
|
|
||||||
const flag = (name, val) =>
|
|
||||||
`<span class='flag' data-value='${val ? "1" : "0"}'><u>${name}</u> ${val}</span>`;
|
|
||||||
|
|
||||||
html += "<div class='entityFlags'>";
|
|
||||||
html += flag("registered", entity.registered);
|
|
||||||
html += flag("uid", entity.uid);
|
|
||||||
html += flag("destroyed", entity.destroyed);
|
|
||||||
html += "</div>";
|
|
||||||
|
|
||||||
html += "<div class='components'>";
|
|
||||||
|
|
||||||
for (const componentId in entity.components) {
|
|
||||||
const data = entity.components[componentId];
|
|
||||||
html += "<div class='component'>";
|
|
||||||
html += "<strong class='name'>" + componentId + "</strong>";
|
|
||||||
html += "<textarea class='data'>" + JSON.stringify(data.serialize(), null, 2) + "</textarea>";
|
|
||||||
|
|
||||||
html += "</div>";
|
|
||||||
}
|
|
||||||
|
|
||||||
html += "</div>";
|
|
||||||
|
|
||||||
this.entityInfoElem.innerHTML = html;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onMouseDown() {}
|
/**
|
||||||
|
*
|
||||||
|
* @param {string} name
|
||||||
|
* @param {any} val
|
||||||
|
* @param {number} indent
|
||||||
|
* @param {Array} recursion
|
||||||
|
*/
|
||||||
|
propertyToHTML(name, val, indent = 0, recursion = []) {
|
||||||
|
if (val !== null && typeof val === "object") {
|
||||||
|
// Array is displayed like object, with indexes
|
||||||
|
recursion.push(val);
|
||||||
|
|
||||||
|
// Get type class name (like Array, Object, Vector...)
|
||||||
|
let typeName = `(${val.constructor ? val.constructor.name : "unknown"})`;
|
||||||
|
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
typeName = `(Array[${val.length}])`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val instanceof Vector) {
|
||||||
|
typeName = `(Vector[${val.x}, ${val.y}])`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const colorStyle = `color: hsl(${30 * indent}, 100%, 80%)`;
|
||||||
|
|
||||||
|
let html = `<details class="object" style="${colorStyle}">
|
||||||
|
<summary>${name} ${typeName}</summary>
|
||||||
|
<div>`;
|
||||||
|
|
||||||
|
for (const property in val) {
|
||||||
|
const isRoot = val[property] == this.root;
|
||||||
|
const isRecursive = recursion.includes(val[property]);
|
||||||
|
|
||||||
|
let hiddenValue = isRoot ? "<root>" : null;
|
||||||
|
if (isRecursive) {
|
||||||
|
// Avoid recursion by not "expanding" object more than once
|
||||||
|
hiddenValue = "<recursion>";
|
||||||
|
}
|
||||||
|
|
||||||
|
html += this.propertyToHTML(
|
||||||
|
property,
|
||||||
|
hiddenValue ? hiddenValue : val[property],
|
||||||
|
indent + 1,
|
||||||
|
[...recursion] // still expand same value in other "branches"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</div></details>";
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
const displayValue = (val + "")
|
||||||
|
.replaceAll("&", "&")
|
||||||
|
.replaceAll("<", "<")
|
||||||
|
.replaceAll(">", ">");
|
||||||
|
return `<label>${name}</label> <span>${displayValue}</span>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerenders the whole container
|
||||||
|
* @param {Entity} entity
|
||||||
|
*/
|
||||||
|
rerenderFull(entity) {
|
||||||
|
removeAllChildren(this.componentsElem);
|
||||||
|
let html = "";
|
||||||
|
|
||||||
|
const property = (strings, val) => `<label>${strings[0]}</label> <span>${val}</span>`;
|
||||||
|
|
||||||
|
html += property`registered ${!!entity.registered}`;
|
||||||
|
html += property`uid ${entity.uid}`;
|
||||||
|
html += property`destroyed ${!!entity.destroyed}`;
|
||||||
|
|
||||||
|
for (const componentId in entity.components) {
|
||||||
|
const data = entity.components[componentId];
|
||||||
|
html += "<details class='object'>";
|
||||||
|
html += "<summary>" + componentId + "</summary><div>";
|
||||||
|
|
||||||
|
for (const property in data) {
|
||||||
|
// Put entity into recursion list, so it won't get "expanded"
|
||||||
|
html += this.propertyToHTML(property, data[property], 0, [entity]);
|
||||||
|
}
|
||||||
|
|
||||||
|
html += "</div></details>";
|
||||||
|
}
|
||||||
|
|
||||||
|
this.componentsElem.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
update() {
|
||||||
|
this.domAttach.update(!!this.selectedEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* dev:end */
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import { enumNotificationType } from "./notifications";
|
|||||||
import { T } from "../../../translations";
|
import { T } from "../../../translations";
|
||||||
import { KEYMAPPINGS } from "../../key_action_mapper";
|
import { KEYMAPPINGS } from "../../key_action_mapper";
|
||||||
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
||||||
|
import { TrackedState } from "../../../core/tracked_state";
|
||||||
|
|
||||||
export class HUDGameMenu extends BaseHUDPart {
|
export class HUDGameMenu extends BaseHUDPart {
|
||||||
createElements(parent) {
|
createElements(parent) {
|
||||||
@ -97,12 +98,17 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
this.root.signals.gameSaved.add(this.onGameSaved, this);
|
this.root.signals.gameSaved.add(this.onGameSaved, this);
|
||||||
|
|
||||||
|
this.trackedIsSaving = new TrackedState(this.onIsSavingChanged, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
let playSound = false;
|
let playSound = false;
|
||||||
let notifications = new Set();
|
let notifications = new Set();
|
||||||
|
|
||||||
|
// Check whether we are saving
|
||||||
|
this.trackedIsSaving.set(!!this.root.gameState.currentSavePromise);
|
||||||
|
|
||||||
// Update visibility of buttons
|
// Update visibility of buttons
|
||||||
for (let i = 0; i < this.visibilityToUpdate.length; ++i) {
|
for (let i = 0; i < this.visibilityToUpdate.length; ++i) {
|
||||||
const { condition, domAttach } = this.visibilityToUpdate[i];
|
const { condition, domAttach } = this.visibilityToUpdate[i];
|
||||||
@ -154,6 +160,10 @@ export class HUDGameMenu extends BaseHUDPart {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onIsSavingChanged(isSaving) {
|
||||||
|
this.saveButton.classList.toggle("saving", isSaving);
|
||||||
|
}
|
||||||
|
|
||||||
onGameSaved() {
|
onGameSaved() {
|
||||||
this.saveButton.classList.toggle("animEven");
|
this.saveButton.classList.toggle("animEven");
|
||||||
this.saveButton.classList.toggle("animOdd");
|
this.saveButton.classList.toggle("animOdd");
|
||||||
|
|||||||
@ -48,6 +48,9 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
*/
|
*/
|
||||||
onEntityDestroyed(entity) {
|
onEntityDestroyed(entity) {
|
||||||
|
if (this.root.bulkOperationRunning) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.selectedUids.delete(entity.uid);
|
this.selectedUids.delete(entity.uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,14 +93,30 @@ export class HUDMassSelector extends BaseHUDPart {
|
|||||||
|
|
||||||
doDelete() {
|
doDelete() {
|
||||||
const entityUids = Array.from(this.selectedUids);
|
const entityUids = Array.from(this.selectedUids);
|
||||||
for (let i = 0; i < entityUids.length; ++i) {
|
|
||||||
const uid = entityUids[i];
|
// Build mapping from uid to entity
|
||||||
const entity = this.root.entityMgr.findByUid(uid);
|
/**
|
||||||
if (!this.root.logic.tryDeleteBuilding(entity)) {
|
* @type {Map<number, Entity>}
|
||||||
logger.error("Error in mass delete, could not remove building");
|
*/
|
||||||
this.selectedUids.delete(uid);
|
const mapUidToEntity = this.root.entityMgr.getFrozenUidSearchMap();
|
||||||
|
|
||||||
|
this.root.logic.performBulkOperation(() => {
|
||||||
|
for (let i = 0; i < entityUids.length; ++i) {
|
||||||
|
const uid = entityUids[i];
|
||||||
|
const entity = mapUidToEntity.get(uid);
|
||||||
|
if (!entity) {
|
||||||
|
logger.error("Entity not found by uid:", uid);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.root.logic.tryDeleteBuilding(entity)) {
|
||||||
|
logger.error("Error in mass delete, could not remove building");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
// Clear uids later
|
||||||
|
this.selectedUids = new Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
startCopy() {
|
startCopy() {
|
||||||
|
|||||||
@ -1,56 +1,55 @@
|
|||||||
import { BaseHUDPart } from "../base_hud_part";
|
import { makeDiv } from "../../../core/utils";
|
||||||
import { makeDiv } from "../../../core/utils";
|
import { T } from "../../../translations";
|
||||||
import { T } from "../../../translations";
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
import { IS_DEMO } from "../../../core/config";
|
|
||||||
|
/** @enum {string} */
|
||||||
/** @enum {string} */
|
export const enumNotificationType = {
|
||||||
export const enumNotificationType = {
|
saved: "saved",
|
||||||
saved: "saved",
|
upgrade: "upgrade",
|
||||||
upgrade: "upgrade",
|
success: "success",
|
||||||
success: "success",
|
};
|
||||||
};
|
|
||||||
|
const notificationDuration = 3;
|
||||||
const notificationDuration = 3;
|
|
||||||
|
export class HUDNotifications extends BaseHUDPart {
|
||||||
export class HUDNotifications extends BaseHUDPart {
|
createElements(parent) {
|
||||||
createElements(parent) {
|
this.element = makeDiv(parent, "ingame_HUD_Notifications", [], ``);
|
||||||
this.element = makeDiv(parent, "ingame_HUD_Notifications", [], ``);
|
}
|
||||||
}
|
|
||||||
|
initialize() {
|
||||||
initialize() {
|
this.root.hud.signals.notification.add(this.onNotification, this);
|
||||||
this.root.hud.signals.notification.add(this.onNotification, this);
|
|
||||||
|
/** @type {Array<{ element: HTMLElement, expireAt: number}>} */
|
||||||
/** @type {Array<{ element: HTMLElement, expireAt: number}>} */
|
this.notificationElements = [];
|
||||||
this.notificationElements = [];
|
|
||||||
|
// Automatic notifications
|
||||||
// Automatic notifications
|
this.root.signals.gameSaved.add(() =>
|
||||||
this.root.signals.gameSaved.add(() =>
|
this.onNotification(T.ingame.notifications.gameSaved, enumNotificationType.saved)
|
||||||
this.onNotification(T.ingame.notifications.gameSaved, enumNotificationType.saved)
|
);
|
||||||
);
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* @param {string} message
|
||||||
* @param {string} message
|
* @param {enumNotificationType} type
|
||||||
* @param {enumNotificationType} type
|
*/
|
||||||
*/
|
onNotification(message, type) {
|
||||||
onNotification(message, type) {
|
const element = makeDiv(this.element, null, ["notification", "type-" + type], message);
|
||||||
const element = makeDiv(this.element, null, ["notification", "type-" + type], message);
|
element.setAttribute("data-icon", "icons/notification_" + type + ".png");
|
||||||
element.setAttribute("data-icon", "icons/notification_" + type + ".png");
|
|
||||||
|
this.notificationElements.push({
|
||||||
this.notificationElements.push({
|
element,
|
||||||
element,
|
expireAt: this.root.time.realtimeNow() + notificationDuration,
|
||||||
expireAt: this.root.time.realtimeNow() + notificationDuration,
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
update() {
|
||||||
update() {
|
const now = this.root.time.realtimeNow();
|
||||||
const now = this.root.time.realtimeNow();
|
for (let i = 0; i < this.notificationElements.length; ++i) {
|
||||||
for (let i = 0; i < this.notificationElements.length; ++i) {
|
const handle = this.notificationElements[i];
|
||||||
const handle = this.notificationElements[i];
|
if (handle.expireAt <= now) {
|
||||||
if (handle.expireAt <= now) {
|
handle.element.remove();
|
||||||
handle.element.remove();
|
this.notificationElements.splice(i, 1);
|
||||||
this.notificationElements.splice(i, 1);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -204,22 +204,20 @@ export function getStringForKeyCode(code) {
|
|||||||
case 115:
|
case 115:
|
||||||
return "F4";
|
return "F4";
|
||||||
case 116:
|
case 116:
|
||||||
return "F4";
|
|
||||||
case 117:
|
|
||||||
return "F5";
|
return "F5";
|
||||||
case 118:
|
case 117:
|
||||||
return "F6";
|
return "F6";
|
||||||
case 119:
|
case 118:
|
||||||
return "F7";
|
return "F7";
|
||||||
case 120:
|
case 119:
|
||||||
return "F8";
|
return "F8";
|
||||||
case 121:
|
case 120:
|
||||||
return "F9";
|
return "F9";
|
||||||
case 122:
|
case 121:
|
||||||
return "F10";
|
return "F10";
|
||||||
case 123:
|
case 122:
|
||||||
return "F11";
|
return "F11";
|
||||||
case 124:
|
case 123:
|
||||||
return "F12";
|
return "F12";
|
||||||
|
|
||||||
case 144:
|
case 144:
|
||||||
|
|||||||
@ -1,236 +1,236 @@
|
|||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { Vector } from "../core/vector";
|
import { Vector } from "../core/vector";
|
||||||
import { BasicSerializableObject, types } from "../savegame/serialization";
|
import { BasicSerializableObject, types } from "../savegame/serialization";
|
||||||
import { BaseItem } from "./base_item";
|
import { BaseItem } from "./base_item";
|
||||||
import { Entity } from "./entity";
|
import { Entity } from "./entity";
|
||||||
import { MapChunkView } from "./map_chunk_view";
|
import { MapChunkView } from "./map_chunk_view";
|
||||||
import { GameRoot } from "./root";
|
import { GameRoot } from "./root";
|
||||||
|
|
||||||
export class BaseMap extends BasicSerializableObject {
|
export class BaseMap extends BasicSerializableObject {
|
||||||
static getId() {
|
static getId() {
|
||||||
return "Map";
|
return "Map";
|
||||||
}
|
}
|
||||||
|
|
||||||
static getSchema() {
|
static getSchema() {
|
||||||
return {
|
return {
|
||||||
seed: types.uint,
|
seed: types.uint,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {GameRoot} root
|
* @param {GameRoot} root
|
||||||
*/
|
*/
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super();
|
super();
|
||||||
this.root = root;
|
this.root = root;
|
||||||
|
|
||||||
this.seed = 0;
|
this.seed = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mapping of 'X|Y' to chunk
|
* Mapping of 'X|Y' to chunk
|
||||||
* @type {Map<string, MapChunkView>} */
|
* @type {Map<string, MapChunkView>} */
|
||||||
this.chunksById = new Map();
|
this.chunksById = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the given chunk by index
|
* Returns the given chunk by index
|
||||||
* @param {number} chunkX
|
* @param {number} chunkX
|
||||||
* @param {number} chunkY
|
* @param {number} chunkY
|
||||||
*/
|
*/
|
||||||
getChunk(chunkX, chunkY, createIfNotExistent = false) {
|
getChunk(chunkX, chunkY, createIfNotExistent = false) {
|
||||||
const chunkIdentifier = chunkX + "|" + chunkY;
|
const chunkIdentifier = chunkX + "|" + chunkY;
|
||||||
let storedChunk;
|
let storedChunk;
|
||||||
|
|
||||||
if ((storedChunk = this.chunksById.get(chunkIdentifier))) {
|
if ((storedChunk = this.chunksById.get(chunkIdentifier))) {
|
||||||
return storedChunk;
|
return storedChunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (createIfNotExistent) {
|
if (createIfNotExistent) {
|
||||||
const instance = new MapChunkView(this.root, chunkX, chunkY);
|
const instance = new MapChunkView(this.root, chunkX, chunkY);
|
||||||
this.chunksById.set(chunkIdentifier, instance);
|
this.chunksById.set(chunkIdentifier, instance);
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets or creates a new chunk if not existent for the given tile
|
* Gets or creates a new chunk if not existent for the given tile
|
||||||
* @param {number} tileX
|
* @param {number} tileX
|
||||||
* @param {number} tileY
|
* @param {number} tileY
|
||||||
* @returns {MapChunkView}
|
* @returns {MapChunkView}
|
||||||
*/
|
*/
|
||||||
getOrCreateChunkAtTile(tileX, tileY) {
|
getOrCreateChunkAtTile(tileX, tileY) {
|
||||||
const chunkX = Math.floor(tileX / globalConfig.mapChunkSize);
|
const chunkX = Math.floor(tileX / globalConfig.mapChunkSize);
|
||||||
const chunkY = Math.floor(tileY / globalConfig.mapChunkSize);
|
const chunkY = Math.floor(tileY / globalConfig.mapChunkSize);
|
||||||
return this.getChunk(chunkX, chunkY, true);
|
return this.getChunk(chunkX, chunkY, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a chunk if not existent for the given tile
|
* Gets a chunk if not existent for the given tile
|
||||||
* @param {number} tileX
|
* @param {number} tileX
|
||||||
* @param {number} tileY
|
* @param {number} tileY
|
||||||
* @returns {MapChunkView?}
|
* @returns {MapChunkView?}
|
||||||
*/
|
*/
|
||||||
getChunkAtTileOrNull(tileX, tileY) {
|
getChunkAtTileOrNull(tileX, tileY) {
|
||||||
const chunkX = Math.floor(tileX / globalConfig.mapChunkSize);
|
const chunkX = Math.floor(tileX / globalConfig.mapChunkSize);
|
||||||
const chunkY = Math.floor(tileY / globalConfig.mapChunkSize);
|
const chunkY = Math.floor(tileY / globalConfig.mapChunkSize);
|
||||||
return this.getChunk(chunkX, chunkY, false);
|
return this.getChunk(chunkX, chunkY, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a given tile is within the map bounds
|
* Checks if a given tile is within the map bounds
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isValidTile(tile) {
|
isValidTile(tile) {
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
assert(tile instanceof Vector, "tile is not a vector");
|
assert(tile instanceof Vector, "tile is not a vector");
|
||||||
}
|
}
|
||||||
return Number.isInteger(tile.x) && Number.isInteger(tile.y);
|
return Number.isInteger(tile.x) && Number.isInteger(tile.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tile content of a given tile
|
* Returns the tile content of a given tile
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
* @param {Layer} layer
|
* @param {Layer} layer
|
||||||
* @returns {Entity} Entity or null
|
* @returns {Entity} Entity or null
|
||||||
*/
|
*/
|
||||||
getTileContent(tile, layer) {
|
getTileContent(tile, layer) {
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
this.internalCheckTile(tile);
|
this.internalCheckTile(tile);
|
||||||
}
|
}
|
||||||
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
||||||
return chunk && chunk.getLayerContentFromWorldCoords(tile.x, tile.y, layer);
|
return chunk && chunk.getLayerContentFromWorldCoords(tile.x, tile.y, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the lower layers content of the given tile
|
* Returns the lower layers content of the given tile
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
* @returns {BaseItem=}
|
* @returns {BaseItem=}
|
||||||
*/
|
*/
|
||||||
getLowerLayerContentXY(x, y) {
|
getLowerLayerContentXY(x, y) {
|
||||||
return this.getOrCreateChunkAtTile(x, y).getLowerLayerFromWorldCoords(x, y);
|
return this.getOrCreateChunkAtTile(x, y).getLowerLayerFromWorldCoords(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tile content of a given tile
|
* Returns the tile content of a given tile
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
* @param {Layer} layer
|
* @param {Layer} layer
|
||||||
* @returns {Entity} Entity or null
|
* @returns {Entity} Entity or null
|
||||||
*/
|
*/
|
||||||
getLayerContentXY(x, y, layer) {
|
getLayerContentXY(x, y, layer) {
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
const chunk = this.getChunkAtTileOrNull(x, y);
|
||||||
return chunk && chunk.getLayerContentFromWorldCoords(x, y, layer);
|
return chunk && chunk.getLayerContentFromWorldCoords(x, y, layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the tile contents of a given tile
|
* Returns the tile contents of a given tile
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
* @returns {Array<Entity>} Entity or null
|
* @returns {Array<Entity>} Entity or null
|
||||||
*/
|
*/
|
||||||
getLayersContentsMultipleXY(x, y) {
|
getLayersContentsMultipleXY(x, y) {
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
const chunk = this.getChunkAtTileOrNull(x, y);
|
||||||
if (!chunk) {
|
if (!chunk) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return chunk.getLayersContentsMultipleFromWorldCoords(x, y);
|
return chunk.getLayersContentsMultipleFromWorldCoords(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the tile is used
|
* Checks if the tile is used
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
* @param {Layer} layer
|
* @param {Layer} layer
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isTileUsed(tile, layer) {
|
isTileUsed(tile, layer) {
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
this.internalCheckTile(tile);
|
this.internalCheckTile(tile);
|
||||||
}
|
}
|
||||||
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
const chunk = this.getChunkAtTileOrNull(tile.x, tile.y);
|
||||||
return chunk && chunk.getLayerContentFromWorldCoords(tile.x, tile.y, layer) != null;
|
return chunk && chunk.getLayerContentFromWorldCoords(tile.x, tile.y, layer) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the tile is used
|
* Checks if the tile is used
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
* @param {Layer} layer
|
* @param {Layer} layer
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isTileUsedXY(x, y, layer) {
|
isTileUsedXY(x, y, layer) {
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
const chunk = this.getChunkAtTileOrNull(x, y);
|
||||||
return chunk && chunk.getLayerContentFromWorldCoords(x, y, layer) != null;
|
return chunk && chunk.getLayerContentFromWorldCoords(x, y, layer) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tiles content
|
* Sets the tiles content
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
*/
|
*/
|
||||||
setTileContent(tile, entity) {
|
setTileContent(tile, entity) {
|
||||||
if (G_IS_DEV) {
|
if (G_IS_DEV) {
|
||||||
this.internalCheckTile(tile);
|
this.internalCheckTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getOrCreateChunkAtTile(tile.x, tile.y).setLayerContentFromWorldCords(
|
this.getOrCreateChunkAtTile(tile.x, tile.y).setLayerContentFromWorldCords(
|
||||||
tile.x,
|
tile.x,
|
||||||
tile.y,
|
tile.y,
|
||||||
entity,
|
entity,
|
||||||
entity.layer
|
entity.layer
|
||||||
);
|
);
|
||||||
|
|
||||||
const staticComponent = entity.components.StaticMapEntity;
|
const staticComponent = entity.components.StaticMapEntity;
|
||||||
assert(staticComponent, "Can only place static map entities in tiles");
|
assert(staticComponent, "Can only place static map entities in tiles");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Places an entity with the StaticMapEntity component
|
* Places an entity with the StaticMapEntity component
|
||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
*/
|
*/
|
||||||
placeStaticEntity(entity) {
|
placeStaticEntity(entity) {
|
||||||
assert(entity.components.StaticMapEntity, "Entity is not static");
|
assert(entity.components.StaticMapEntity, "Entity is not static");
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
const rect = staticComp.getTileSpaceBounds();
|
const rect = staticComp.getTileSpaceBounds();
|
||||||
for (let dx = 0; dx < rect.w; ++dx) {
|
for (let dx = 0; dx < rect.w; ++dx) {
|
||||||
for (let dy = 0; dy < rect.h; ++dy) {
|
for (let dy = 0; dy < rect.h; ++dy) {
|
||||||
const x = rect.x + dx;
|
const x = rect.x + dx;
|
||||||
const y = rect.y + dy;
|
const y = rect.y + dy;
|
||||||
this.getOrCreateChunkAtTile(x, y).setLayerContentFromWorldCords(x, y, entity, entity.layer);
|
this.getOrCreateChunkAtTile(x, y).setLayerContentFromWorldCords(x, y, entity, entity.layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an entity with the StaticMapEntity component
|
* Removes an entity with the StaticMapEntity component
|
||||||
* @param {Entity} entity
|
* @param {Entity} entity
|
||||||
*/
|
*/
|
||||||
removeStaticEntity(entity) {
|
removeStaticEntity(entity) {
|
||||||
assert(entity.components.StaticMapEntity, "Entity is not static");
|
assert(entity.components.StaticMapEntity, "Entity is not static");
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
const rect = staticComp.getTileSpaceBounds();
|
const rect = staticComp.getTileSpaceBounds();
|
||||||
for (let dx = 0; dx < rect.w; ++dx) {
|
for (let dx = 0; dx < rect.w; ++dx) {
|
||||||
for (let dy = 0; dy < rect.h; ++dy) {
|
for (let dy = 0; dy < rect.h; ++dy) {
|
||||||
const x = rect.x + dx;
|
const x = rect.x + dx;
|
||||||
const y = rect.y + dy;
|
const y = rect.y + dy;
|
||||||
this.getOrCreateChunkAtTile(x, y).setLayerContentFromWorldCords(x, y, null, entity.layer);
|
this.getOrCreateChunkAtTile(x, y).setLayerContentFromWorldCords(x, y, null, entity.layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal
|
// Internal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks a given tile for validty
|
* Checks a given tile for validty
|
||||||
* @param {Vector} tile
|
* @param {Vector} tile
|
||||||
*/
|
*/
|
||||||
internalCheckTile(tile) {
|
internalCheckTile(tile) {
|
||||||
assert(tile instanceof Vector, "tile is not a vector: " + tile);
|
assert(tile instanceof Vector, "tile is not a vector: " + tile);
|
||||||
assert(tile.x % 1 === 0, "Tile X is not a valid integer: " + tile.x);
|
assert(tile.x % 1 === 0, "Tile X is not a valid integer: " + tile.x);
|
||||||
assert(tile.y % 1 === 0, "Tile Y is not a valid integer: " + tile.y);
|
assert(tile.y % 1 === 0, "Tile Y is not a valid integer: " + tile.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -88,16 +88,17 @@ export class MapChunkView extends MapChunk {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const dims = globalConfig.mapChunkWorldSize;
|
const dims = globalConfig.mapChunkWorldSize;
|
||||||
|
const extrude = 0.05;
|
||||||
|
|
||||||
// Draw chunk "pixel" art
|
// Draw chunk "pixel" art
|
||||||
parameters.context.imageSmoothingEnabled = false;
|
parameters.context.imageSmoothingEnabled = false;
|
||||||
drawSpriteClipped({
|
drawSpriteClipped({
|
||||||
parameters,
|
parameters,
|
||||||
sprite,
|
sprite,
|
||||||
x: this.x * dims,
|
x: this.x * dims - extrude,
|
||||||
y: this.y * dims,
|
y: this.y * dims - extrude,
|
||||||
w: dims,
|
w: dims + 2 * extrude,
|
||||||
h: dims,
|
h: dims + 2 * extrude,
|
||||||
originalW: overlaySize,
|
originalW: overlaySize,
|
||||||
originalH: overlaySize,
|
originalH: overlaySize,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -66,32 +66,34 @@ export class MapView extends BaseMap {
|
|||||||
* @param {DrawParameters} drawParameters
|
* @param {DrawParameters} drawParameters
|
||||||
*/
|
*/
|
||||||
drawStaticEntityDebugOverlays(drawParameters) {
|
drawStaticEntityDebugOverlays(drawParameters) {
|
||||||
const cullRange = drawParameters.visibleRect.toTileCullRectangle();
|
if (G_IS_DEV && (globalConfig.debug.showAcceptorEjectors || globalConfig.debug.showEntityBounds)) {
|
||||||
const top = cullRange.top();
|
const cullRange = drawParameters.visibleRect.toTileCullRectangle();
|
||||||
const right = cullRange.right();
|
const top = cullRange.top();
|
||||||
const bottom = cullRange.bottom();
|
const right = cullRange.right();
|
||||||
const left = cullRange.left();
|
const bottom = cullRange.bottom();
|
||||||
|
const left = cullRange.left();
|
||||||
|
|
||||||
const border = 1;
|
const border = 1;
|
||||||
|
|
||||||
const minY = top - border;
|
const minY = top - border;
|
||||||
const maxY = bottom + border;
|
const maxY = bottom + border;
|
||||||
const minX = left - border;
|
const minX = left - border;
|
||||||
const maxX = right + border - 1;
|
const maxX = right + border - 1;
|
||||||
|
|
||||||
// Render y from top down for proper blending
|
// Render y from top down for proper blending
|
||||||
for (let y = minY; y <= maxY; ++y) {
|
for (let y = minY; y <= maxY; ++y) {
|
||||||
for (let x = minX; x <= maxX; ++x) {
|
for (let x = minX; x <= maxX; ++x) {
|
||||||
// const content = this.tiles[x][y];
|
// const content = this.tiles[x][y];
|
||||||
const chunk = this.getChunkAtTileOrNull(x, y);
|
const chunk = this.getChunkAtTileOrNull(x, y);
|
||||||
if (!chunk) {
|
if (!chunk) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const content = chunk.getTileContentFromWorldCoords(x, y);
|
const content = chunk.getTileContentFromWorldCoords(x, y);
|
||||||
if (content) {
|
if (content) {
|
||||||
let isBorder = x <= left - 1 || x >= right + 1 || y <= top - 1 || y >= bottom + 1;
|
let isBorder = x <= left - 1 || x >= right + 1 || y <= top - 1 || y >= bottom + 1;
|
||||||
if (!isBorder) {
|
if (!isBorder) {
|
||||||
content.drawDebugOverlays(drawParameters);
|
content.drawDebugOverlays(drawParameters);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -236,4 +236,7 @@ export function initBuildingCodesAfterResourcesLoaded() {
|
|||||||
);
|
);
|
||||||
variant.silhouetteColor = variant.metaInstance.getSilhouetteColor();
|
variant.silhouetteColor = variant.metaInstance.getSilhouetteColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update caches
|
||||||
|
buildBuildingCodeCache();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -9,14 +9,35 @@ import { MapChunkView } from "../map_chunk_view";
|
|||||||
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
export class ItemAcceptorSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [ItemAcceptorComponent]);
|
super(root, [ItemAcceptorComponent]);
|
||||||
|
|
||||||
|
// Well ... it's better to be verbose I guess?
|
||||||
|
this.accumulatedTicksWhileInMapOverview = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
|
if (this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
|
// Disabled in potato mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This system doesn't render anything while in map overview,
|
||||||
|
// so simply accumulate ticks
|
||||||
|
if (this.root.camera.getIsMapOverlayActive()) {
|
||||||
|
++this.accumulatedTicksWhileInMapOverview;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute how much ticks we missed
|
||||||
|
const numTicks = 1 + this.accumulatedTicksWhileInMapOverview;
|
||||||
const progress =
|
const progress =
|
||||||
this.root.dynamicTickrate.deltaSeconds *
|
this.root.dynamicTickrate.deltaSeconds *
|
||||||
2 *
|
2 *
|
||||||
this.root.hubGoals.getBeltBaseSpeed() *
|
this.root.hubGoals.getBeltBaseSpeed() *
|
||||||
globalConfig.itemSpacingOnBelts; // * 2 because its only a half tile
|
globalConfig.itemSpacingOnBelts * // * 2 because its only a half tile
|
||||||
|
numTicks;
|
||||||
|
|
||||||
|
// Reset accumulated ticks
|
||||||
|
this.accumulatedTicksWhileInMapOverview = 0;
|
||||||
|
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
const entity = this.allEntities[i];
|
const entity = this.allEntities[i];
|
||||||
@ -40,6 +61,11 @@ export class ItemAcceptorSystem extends GameSystemWithFilter {
|
|||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
|
if (this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
|
// Disabled in potato mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const contents = chunk.containedEntitiesByLayer.regular;
|
const contents = chunk.containedEntitiesByLayer.regular;
|
||||||
for (let i = 0; i < contents.length; ++i) {
|
for (let i = 0; i < contents.length; ++i) {
|
||||||
const entity = contents[i];
|
const entity = contents[i];
|
||||||
|
|||||||
@ -2,8 +2,11 @@ import { globalConfig } from "../../core/config";
|
|||||||
import { DrawParameters } from "../../core/draw_parameters";
|
import { DrawParameters } from "../../core/draw_parameters";
|
||||||
import { createLogger } from "../../core/logging";
|
import { createLogger } from "../../core/logging";
|
||||||
import { Rectangle } from "../../core/rectangle";
|
import { Rectangle } from "../../core/rectangle";
|
||||||
|
import { StaleAreaDetector } from "../../core/stale_area_detector";
|
||||||
import { enumDirection, enumDirectionToVector } from "../../core/vector";
|
import { enumDirection, enumDirectionToVector } from "../../core/vector";
|
||||||
import { BaseItem } from "../base_item";
|
import { BaseItem } from "../base_item";
|
||||||
|
import { BeltComponent } from "../components/belt";
|
||||||
|
import { ItemAcceptorComponent } from "../components/item_acceptor";
|
||||||
import { ItemEjectorComponent } from "../components/item_ejector";
|
import { ItemEjectorComponent } from "../components/item_ejector";
|
||||||
import { Entity } from "../entity";
|
import { Entity } from "../entity";
|
||||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||||
@ -15,102 +18,52 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [ItemEjectorComponent]);
|
super(root, [ItemEjectorComponent]);
|
||||||
|
|
||||||
this.root.signals.entityAdded.add(this.checkForCacheInvalidation, this);
|
this.staleAreaDetector = new StaleAreaDetector({
|
||||||
this.root.signals.entityDestroyed.add(this.checkForCacheInvalidation, this);
|
root: this.root,
|
||||||
this.root.signals.postLoadHook.add(this.recomputeCache, this);
|
name: "item-ejector",
|
||||||
|
recomputeMethod: this.recomputeArea.bind(this),
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
this.staleAreaDetector.recomputeOnComponentsChanged(
|
||||||
* @type {Rectangle}
|
[ItemEjectorComponent, ItemAcceptorComponent, BeltComponent],
|
||||||
*/
|
1
|
||||||
this.areaToRecompute = null;
|
);
|
||||||
|
|
||||||
|
this.root.signals.postLoadHook.add(this.recomputeCacheFull, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Recomputes an area after it changed
|
||||||
* @param {Entity} entity
|
* @param {Rectangle} area
|
||||||
*/
|
*/
|
||||||
checkForCacheInvalidation(entity) {
|
recomputeArea(area) {
|
||||||
if (!this.root.gameInitialized) {
|
/** @type {Set<number>} */
|
||||||
return;
|
const seenUids = new Set();
|
||||||
}
|
for (let x = 0; x < area.w; ++x) {
|
||||||
if (!entity.components.StaticMapEntity) {
|
for (let y = 0; y < area.h; ++y) {
|
||||||
return;
|
const tileX = area.x + x;
|
||||||
}
|
const tileY = area.y + y;
|
||||||
|
// @NOTICE: Item ejector currently only supports regular layer
|
||||||
// Optimize for the common case: adding or removing one building at a time. Clicking
|
const contents = this.root.map.getLayerContentXY(tileX, tileY, "regular");
|
||||||
// and dragging can cause up to 4 add/remove signals.
|
if (contents && contents.components.ItemEjector) {
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
if (!seenUids.has(contents.uid)) {
|
||||||
const bounds = staticComp.getTileSpaceBounds();
|
seenUids.add(contents.uid);
|
||||||
const expandedBounds = bounds.expandedInAllDirections(2);
|
this.recomputeSingleEntityCache(contents);
|
||||||
|
|
||||||
if (this.areaToRecompute) {
|
|
||||||
this.areaToRecompute = this.areaToRecompute.getUnion(expandedBounds);
|
|
||||||
} else {
|
|
||||||
this.areaToRecompute = expandedBounds;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Precomputes the cache, which makes up for a huge performance improvement
|
|
||||||
*/
|
|
||||||
recomputeCache() {
|
|
||||||
if (this.areaToRecompute) {
|
|
||||||
logger.log("Recomputing cache using rectangle");
|
|
||||||
if (G_IS_DEV && globalConfig.debug.renderChanges) {
|
|
||||||
this.root.hud.parts.changesDebugger.renderChange(
|
|
||||||
"ejector-area",
|
|
||||||
this.areaToRecompute,
|
|
||||||
"#fe50a6"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.recomputeAreaCache();
|
|
||||||
this.areaToRecompute = null;
|
|
||||||
} else {
|
|
||||||
logger.log("Full cache recompute");
|
|
||||||
if (G_IS_DEV && globalConfig.debug.renderChanges) {
|
|
||||||
this.root.hud.parts.changesDebugger.renderChange(
|
|
||||||
"ejector-full",
|
|
||||||
new Rectangle(-1000, -1000, 2000, 2000),
|
|
||||||
"#fe50a6"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find acceptors for every ejector
|
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
|
||||||
const entity = this.allEntities[i];
|
|
||||||
this.recomputeSingleEntityCache(entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recomputes the cache in the given area
|
|
||||||
*/
|
|
||||||
recomputeAreaCache() {
|
|
||||||
const area = this.areaToRecompute;
|
|
||||||
let entryCount = 0;
|
|
||||||
|
|
||||||
logger.log("Recomputing area:", area.x, area.y, "/", area.w, area.h);
|
|
||||||
|
|
||||||
// Store the entities we already recomputed, so we don't do work twice
|
|
||||||
const recomputedEntities = new Set();
|
|
||||||
|
|
||||||
for (let x = area.x; x < area.right(); ++x) {
|
|
||||||
for (let y = area.y; y < area.bottom(); ++y) {
|
|
||||||
const entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
|
||||||
for (let i = 0; i < entities.length; ++i) {
|
|
||||||
const entity = entities[i];
|
|
||||||
|
|
||||||
// Recompute the entity in case its relevant for this system and it
|
|
||||||
// hasn't already been computed
|
|
||||||
if (!recomputedEntities.has(entity.uid) && entity.components.ItemEjector) {
|
|
||||||
recomputedEntities.add(entity.uid);
|
|
||||||
this.recomputeSingleEntityCache(entity);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return entryCount;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recomputes the whole cache after the game has loaded
|
||||||
|
*/
|
||||||
|
recomputeCacheFull() {
|
||||||
|
logger.log("Full cache recompute in post load hook");
|
||||||
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
|
const entity = this.allEntities[i];
|
||||||
|
this.recomputeSingleEntityCache(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,9 +136,7 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
if (this.areaToRecompute) {
|
this.staleAreaDetector.update();
|
||||||
this.recomputeCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Precompute effective belt speed
|
// Precompute effective belt speed
|
||||||
let progressGrowth = 2 * this.root.dynamicTickrate.deltaSeconds;
|
let progressGrowth = 2 * this.root.dynamicTickrate.deltaSeconds;
|
||||||
@ -251,7 +202,13 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
// Try to hand over the item
|
// Try to hand over the item
|
||||||
if (this.tryPassOverItem(item, destEntity, destSlot.index)) {
|
if (this.tryPassOverItem(item, destEntity, destSlot.index)) {
|
||||||
// Handover successful, clear slot
|
// Handover successful, clear slot
|
||||||
targetAcceptorComp.onItemAccepted(destSlot.index, destSlot.acceptedDirection, item);
|
if (!this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
|
targetAcceptorComp.onItemAccepted(
|
||||||
|
destSlot.index,
|
||||||
|
destSlot.acceptedDirection,
|
||||||
|
item
|
||||||
|
);
|
||||||
|
}
|
||||||
sourceSlot.item = null;
|
sourceSlot.item = null;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -333,6 +290,11 @@ export class ItemEjectorSystem extends GameSystemWithFilter {
|
|||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
|
if (this.root.app.settings.getAllSettings().simplifiedBelts) {
|
||||||
|
// Disabled in potato mode
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const contents = chunk.containedEntitiesByLayer.regular;
|
const contents = chunk.containedEntitiesByLayer.regular;
|
||||||
|
|
||||||
for (let i = 0; i < contents.length; ++i) {
|
for (let i = 0; i < contents.length; ++i) {
|
||||||
|
|||||||
@ -553,25 +553,7 @@ export class ItemProcessorSystem extends GameSystemWithFilter {
|
|||||||
const bonusTimeToApply = Math.min(originalTime, processorComp.bonusTime);
|
const bonusTimeToApply = Math.min(originalTime, processorComp.bonusTime);
|
||||||
const timeToProcess = originalTime - bonusTimeToApply;
|
const timeToProcess = originalTime - bonusTimeToApply;
|
||||||
|
|
||||||
// Substract one tick because we already process it this frame
|
|
||||||
// if (processorComp.bonusTime > originalTime) {
|
|
||||||
// if (processorComp.type === enumItemProcessorTypes.reader) {
|
|
||||||
// console.log(
|
|
||||||
// "Bonus time",
|
|
||||||
// round4Digits(processorComp.bonusTime),
|
|
||||||
// "Original time",
|
|
||||||
// round4Digits(originalTime),
|
|
||||||
// "Overcomit by",
|
|
||||||
// round4Digits(processorComp.bonusTime - originalTime),
|
|
||||||
// "->",
|
|
||||||
// round4Digits(timeToProcess),
|
|
||||||
// "reduced by",
|
|
||||||
// round4Digits(bonusTimeToApply)
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
processorComp.bonusTime -= bonusTimeToApply;
|
processorComp.bonusTime -= bonusTimeToApply;
|
||||||
|
|
||||||
processorComp.ongoingCharges.push({
|
processorComp.ongoingCharges.push({
|
||||||
items: outItems,
|
items: outItems,
|
||||||
remainingTime: timeToProcess,
|
remainingTime: timeToProcess,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import { globalConfig } from "../../core/config";
|
import { globalConfig } from "../../core/config";
|
||||||
import { Loader } from "../../core/loader";
|
import { Loader } from "../../core/loader";
|
||||||
import { smoothPulse, round4Digits } from "../../core/utils";
|
import { smoothPulse } from "../../core/utils";
|
||||||
import { enumItemProcessorRequirements, enumItemProcessorTypes } from "../components/item_processor";
|
import { enumItemProcessorRequirements, enumItemProcessorTypes } from "../components/item_processor";
|
||||||
import { Entity } from "../entity";
|
import { Entity } from "../entity";
|
||||||
import { GameSystem } from "../game_system";
|
import { GameSystem } from "../game_system";
|
||||||
@ -17,7 +17,6 @@ export class ItemProcessorOverlaysSystem extends GameSystem {
|
|||||||
this.readerOverlaySprite = Loader.getSprite("sprites/misc/reader_overlay.png");
|
this.readerOverlaySprite = Loader.getSprite("sprites/misc/reader_overlay.png");
|
||||||
|
|
||||||
this.drawnUids = new Set();
|
this.drawnUids = new Set();
|
||||||
|
|
||||||
this.root.signals.gameFrameStarted.add(this.clearDrawnUids, this);
|
this.root.signals.gameFrameStarted.add(this.clearDrawnUids, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +39,6 @@ export class ItemProcessorOverlaysSystem extends GameSystem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const requirement = processorComp.processingRequirement;
|
const requirement = processorComp.processingRequirement;
|
||||||
|
|
||||||
if (!requirement && processorComp.type !== enumItemProcessorTypes.reader) {
|
if (!requirement && processorComp.type !== enumItemProcessorTypes.reader) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,7 +46,6 @@ export class MinerSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if miner is above an actual tile
|
// Check if miner is above an actual tile
|
||||||
|
|
||||||
if (!minerComp.cachedMinedItem) {
|
if (!minerComp.cachedMinedItem) {
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
const tileBelow = this.root.map.getLowerLayerContentXY(
|
const tileBelow = this.root.map.getLowerLayerContentXY(
|
||||||
@ -171,7 +170,7 @@ export class MinerSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw the item background - this is to hide the ejected item animation from
|
// Draw the item background - this is to hide the ejected item animation from
|
||||||
// the item ejecto
|
// the item ejector
|
||||||
|
|
||||||
const padding = 3;
|
const padding = 3;
|
||||||
const destX = staticComp.origin.x * globalConfig.tileSize + padding;
|
const destX = staticComp.origin.x * globalConfig.tileSize + padding;
|
||||||
|
|||||||
@ -1,101 +1,101 @@
|
|||||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||||
import { StorageComponent } from "../components/storage";
|
import { StorageComponent } from "../components/storage";
|
||||||
import { DrawParameters } from "../../core/draw_parameters";
|
import { DrawParameters } from "../../core/draw_parameters";
|
||||||
import { formatBigNumber, lerp } from "../../core/utils";
|
import { formatBigNumber, lerp } from "../../core/utils";
|
||||||
import { Loader } from "../../core/loader";
|
import { Loader } from "../../core/loader";
|
||||||
import { BOOL_TRUE_SINGLETON, BOOL_FALSE_SINGLETON } from "../items/boolean_item";
|
import { BOOL_TRUE_SINGLETON, BOOL_FALSE_SINGLETON } from "../items/boolean_item";
|
||||||
import { MapChunkView } from "../map_chunk_view";
|
import { MapChunkView } from "../map_chunk_view";
|
||||||
|
|
||||||
export class StorageSystem extends GameSystemWithFilter {
|
export class StorageSystem extends GameSystemWithFilter {
|
||||||
constructor(root) {
|
constructor(root) {
|
||||||
super(root, [StorageComponent]);
|
super(root, [StorageComponent]);
|
||||||
|
|
||||||
this.storageOverlaySprite = Loader.getSprite("sprites/misc/storage_overlay.png");
|
this.storageOverlaySprite = Loader.getSprite("sprites/misc/storage_overlay.png");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores which uids were already drawn to avoid drawing entities twice
|
* Stores which uids were already drawn to avoid drawing entities twice
|
||||||
* @type {Set<number>}
|
* @type {Set<number>}
|
||||||
*/
|
*/
|
||||||
this.drawnUids = new Set();
|
this.drawnUids = new Set();
|
||||||
|
|
||||||
this.root.signals.gameFrameStarted.add(this.clearDrawnUids, this);
|
this.root.signals.gameFrameStarted.add(this.clearDrawnUids, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearDrawnUids() {
|
clearDrawnUids() {
|
||||||
this.drawnUids.clear();
|
this.drawnUids.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
const entity = this.allEntities[i];
|
const entity = this.allEntities[i];
|
||||||
const storageComp = entity.components.Storage;
|
const storageComp = entity.components.Storage;
|
||||||
const pinsComp = entity.components.WiredPins;
|
const pinsComp = entity.components.WiredPins;
|
||||||
|
|
||||||
// Eject from storage
|
// Eject from storage
|
||||||
if (storageComp.storedItem && storageComp.storedCount > 0) {
|
if (storageComp.storedItem && storageComp.storedCount > 0) {
|
||||||
const ejectorComp = entity.components.ItemEjector;
|
const ejectorComp = entity.components.ItemEjector;
|
||||||
|
|
||||||
const nextSlot = ejectorComp.getFirstFreeSlot();
|
const nextSlot = ejectorComp.getFirstFreeSlot();
|
||||||
if (nextSlot !== null) {
|
if (nextSlot !== null) {
|
||||||
if (ejectorComp.tryEject(nextSlot, storageComp.storedItem)) {
|
if (ejectorComp.tryEject(nextSlot, storageComp.storedItem)) {
|
||||||
storageComp.storedCount--;
|
storageComp.storedCount--;
|
||||||
|
|
||||||
if (storageComp.storedCount === 0) {
|
if (storageComp.storedCount === 0) {
|
||||||
storageComp.storedItem = null;
|
storageComp.storedItem = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let targetAlpha = storageComp.storedCount > 0 ? 1 : 0;
|
let targetAlpha = storageComp.storedCount > 0 ? 1 : 0;
|
||||||
storageComp.overlayOpacity = lerp(storageComp.overlayOpacity, targetAlpha, 0.05);
|
storageComp.overlayOpacity = lerp(storageComp.overlayOpacity, targetAlpha, 0.05);
|
||||||
|
|
||||||
pinsComp.slots[0].value = storageComp.storedItem;
|
pinsComp.slots[0].value = storageComp.storedItem;
|
||||||
pinsComp.slots[1].value = storageComp.getIsFull() ? BOOL_TRUE_SINGLETON : BOOL_FALSE_SINGLETON;
|
pinsComp.slots[1].value = storageComp.getIsFull() ? BOOL_TRUE_SINGLETON : BOOL_FALSE_SINGLETON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {DrawParameters} parameters
|
* @param {DrawParameters} parameters
|
||||||
* @param {MapChunkView} chunk
|
* @param {MapChunkView} chunk
|
||||||
*/
|
*/
|
||||||
drawChunk(parameters, chunk) {
|
drawChunk(parameters, chunk) {
|
||||||
const contents = chunk.containedEntitiesByLayer.regular;
|
const contents = chunk.containedEntitiesByLayer.regular;
|
||||||
for (let i = 0; i < contents.length; ++i) {
|
for (let i = 0; i < contents.length; ++i) {
|
||||||
const entity = contents[i];
|
const entity = contents[i];
|
||||||
const storageComp = entity.components.Storage;
|
const storageComp = entity.components.Storage;
|
||||||
if (!storageComp) {
|
if (!storageComp) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const storedItem = storageComp.storedItem;
|
const storedItem = storageComp.storedItem;
|
||||||
if (!storedItem) {
|
if (!storedItem) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.drawnUids.has(entity.uid)) {
|
if (this.drawnUids.has(entity.uid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawnUids.add(entity.uid);
|
this.drawnUids.add(entity.uid);
|
||||||
|
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
|
|
||||||
const context = parameters.context;
|
const context = parameters.context;
|
||||||
context.globalAlpha = storageComp.overlayOpacity;
|
context.globalAlpha = storageComp.overlayOpacity;
|
||||||
const center = staticComp.getTileSpaceBounds().getCenter().toWorldSpace();
|
const center = staticComp.getTileSpaceBounds().getCenter().toWorldSpace();
|
||||||
storedItem.drawItemCenteredClipped(center.x, center.y, parameters, 30);
|
storedItem.drawItemCenteredClipped(center.x, center.y, parameters, 30);
|
||||||
|
|
||||||
this.storageOverlaySprite.drawCached(parameters, center.x - 15, center.y + 15, 30, 15);
|
this.storageOverlaySprite.drawCached(parameters, center.x - 15, center.y + 15, 30, 15);
|
||||||
|
|
||||||
if (parameters.visibleRect.containsCircle(center.x, center.y + 25, 20)) {
|
if (parameters.visibleRect.containsCircle(center.x, center.y + 25, 20)) {
|
||||||
context.font = "bold 10px GameFont";
|
context.font = "bold 10px GameFont";
|
||||||
context.textAlign = "center";
|
context.textAlign = "center";
|
||||||
context.fillStyle = "#64666e";
|
context.fillStyle = "#64666e";
|
||||||
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
context.fillText(formatBigNumber(storageComp.storedCount), center.x, center.y + 25.5);
|
||||||
context.textAlign = "left";
|
context.textAlign = "left";
|
||||||
}
|
}
|
||||||
context.globalAlpha = 1;
|
context.globalAlpha = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,406 +1,369 @@
|
|||||||
import { globalConfig } from "../../core/config";
|
import { globalConfig } from "../../core/config";
|
||||||
import { Loader } from "../../core/loader";
|
import { Loader } from "../../core/loader";
|
||||||
import { createLogger } from "../../core/logging";
|
import { createLogger } from "../../core/logging";
|
||||||
import { Rectangle } from "../../core/rectangle";
|
import { Rectangle } from "../../core/rectangle";
|
||||||
import {
|
import { StaleAreaDetector } from "../../core/stale_area_detector";
|
||||||
enumAngleToDirection,
|
import { fastArrayDelete } from "../../core/utils";
|
||||||
enumDirection,
|
import {
|
||||||
enumDirectionToAngle,
|
enumAngleToDirection,
|
||||||
enumDirectionToVector,
|
enumDirection,
|
||||||
enumInvertedDirections,
|
enumDirectionToAngle,
|
||||||
} from "../../core/vector";
|
enumDirectionToVector,
|
||||||
import { enumUndergroundBeltMode, UndergroundBeltComponent } from "../components/underground_belt";
|
enumInvertedDirections,
|
||||||
import { Entity } from "../entity";
|
} from "../../core/vector";
|
||||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
import { enumUndergroundBeltMode, UndergroundBeltComponent } from "../components/underground_belt";
|
||||||
import { fastArrayDelete } from "../../core/utils";
|
import { Entity } from "../entity";
|
||||||
|
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||||
const logger = createLogger("tunnels");
|
|
||||||
|
const logger = createLogger("tunnels");
|
||||||
export class UndergroundBeltSystem extends GameSystemWithFilter {
|
|
||||||
constructor(root) {
|
export class UndergroundBeltSystem extends GameSystemWithFilter {
|
||||||
super(root, [UndergroundBeltComponent]);
|
constructor(root) {
|
||||||
|
super(root, [UndergroundBeltComponent]);
|
||||||
this.beltSprites = {
|
|
||||||
[enumUndergroundBeltMode.sender]: Loader.getSprite(
|
this.beltSprites = {
|
||||||
"sprites/buildings/underground_belt_entry.png"
|
[enumUndergroundBeltMode.sender]: Loader.getSprite(
|
||||||
),
|
"sprites/buildings/underground_belt_entry.png"
|
||||||
[enumUndergroundBeltMode.receiver]: Loader.getSprite(
|
),
|
||||||
"sprites/buildings/underground_belt_exit.png"
|
[enumUndergroundBeltMode.receiver]: Loader.getSprite(
|
||||||
),
|
"sprites/buildings/underground_belt_exit.png"
|
||||||
};
|
),
|
||||||
|
};
|
||||||
this.root.signals.entityManuallyPlaced.add(this.onEntityManuallyPlaced, this);
|
|
||||||
|
this.staleAreaWatcher = new StaleAreaDetector({
|
||||||
/**
|
root: this.root,
|
||||||
* @type {Rectangle}
|
name: "underground-belt",
|
||||||
*/
|
recomputeMethod: this.recomputeArea.bind(this),
|
||||||
this.areaToRecompute = null;
|
});
|
||||||
|
|
||||||
this.root.signals.entityAdded.add(this.onEntityChanged, this);
|
this.root.signals.entityManuallyPlaced.add(this.onEntityManuallyPlaced, this);
|
||||||
this.root.signals.entityDestroyed.add(this.onEntityChanged, this);
|
|
||||||
}
|
// NOTICE: Once we remove a tunnel, we need to update the whole area to
|
||||||
|
// clear outdated handles
|
||||||
/**
|
this.staleAreaWatcher.recomputeOnComponentsChanged(
|
||||||
* Called when an entity got added or removed
|
[UndergroundBeltComponent],
|
||||||
* @param {Entity} entity
|
globalConfig.undergroundBeltMaxTilesByTier[globalConfig.undergroundBeltMaxTilesByTier.length - 1]
|
||||||
*/
|
);
|
||||||
onEntityChanged(entity) {
|
}
|
||||||
if (!this.root.gameInitialized) {
|
|
||||||
return;
|
/**
|
||||||
}
|
* Callback when an entity got placed, used to remove belts between underground belts
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
* @param {Entity} entity
|
||||||
if (!undergroundComp) {
|
*/
|
||||||
return;
|
onEntityManuallyPlaced(entity) {
|
||||||
}
|
if (!this.root.app.settings.getAllSettings().enableTunnelSmartplace) {
|
||||||
|
// Smart-place disabled
|
||||||
const affectedArea = entity.components.StaticMapEntity.getTileSpaceBounds().expandedInAllDirections(
|
return;
|
||||||
globalConfig.undergroundBeltMaxTilesByTier[
|
}
|
||||||
globalConfig.undergroundBeltMaxTilesByTier.length - 1
|
|
||||||
] + 1
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
);
|
if (undergroundComp && undergroundComp.mode === enumUndergroundBeltMode.receiver) {
|
||||||
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
if (this.areaToRecompute) {
|
const tile = staticComp.origin;
|
||||||
this.areaToRecompute = this.areaToRecompute.getUnion(affectedArea);
|
|
||||||
} else {
|
const direction = enumAngleToDirection[staticComp.rotation];
|
||||||
this.areaToRecompute = affectedArea;
|
const inverseDirection = enumInvertedDirections[direction];
|
||||||
}
|
const offset = enumDirectionToVector[inverseDirection];
|
||||||
}
|
|
||||||
|
let currentPos = tile.copy();
|
||||||
/**
|
|
||||||
* Callback when an entity got placed, used to remove belts between underground belts
|
const tier = undergroundComp.tier;
|
||||||
* @param {Entity} entity
|
const range = globalConfig.undergroundBeltMaxTilesByTier[tier];
|
||||||
*/
|
|
||||||
onEntityManuallyPlaced(entity) {
|
// FIND ENTRANCE
|
||||||
if (!this.root.app.settings.getAllSettings().enableTunnelSmartplace) {
|
// Search for the entrance which is farthest apart (this is why we can't reuse logic here)
|
||||||
// Smart-place disabled
|
let matchingEntrance = null;
|
||||||
return;
|
for (let i = 0; i < range; ++i) {
|
||||||
}
|
currentPos.addInplace(offset);
|
||||||
|
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
if (!contents) {
|
||||||
if (undergroundComp && undergroundComp.mode === enumUndergroundBeltMode.receiver) {
|
continue;
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
}
|
||||||
const tile = staticComp.origin;
|
|
||||||
|
const contentsUndergroundComp = contents.components.UndergroundBelt;
|
||||||
const direction = enumAngleToDirection[staticComp.rotation];
|
const contentsStaticComp = contents.components.StaticMapEntity;
|
||||||
const inverseDirection = enumInvertedDirections[direction];
|
if (
|
||||||
const offset = enumDirectionToVector[inverseDirection];
|
contentsUndergroundComp &&
|
||||||
|
contentsUndergroundComp.tier === undergroundComp.tier &&
|
||||||
let currentPos = tile.copy();
|
contentsUndergroundComp.mode === enumUndergroundBeltMode.sender &&
|
||||||
|
enumAngleToDirection[contentsStaticComp.rotation] === direction
|
||||||
const tier = undergroundComp.tier;
|
) {
|
||||||
const range = globalConfig.undergroundBeltMaxTilesByTier[tier];
|
matchingEntrance = {
|
||||||
|
entity: contents,
|
||||||
// FIND ENTRANCE
|
range: i,
|
||||||
// Search for the entrance which is furthes apart (this is why we can't reuse logic here)
|
};
|
||||||
let matchingEntrance = null;
|
}
|
||||||
for (let i = 0; i < range; ++i) {
|
}
|
||||||
currentPos.addInplace(offset);
|
|
||||||
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
if (!matchingEntrance) {
|
||||||
if (!contents) {
|
// Nothing found
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentsUndergroundComp = contents.components.UndergroundBelt;
|
// DETECT OBSOLETE BELTS BETWEEN
|
||||||
const contentsStaticComp = contents.components.StaticMapEntity;
|
// Remove any belts between entrance and exit which have the same direction,
|
||||||
if (
|
// but only if they *all* have the right direction
|
||||||
contentsUndergroundComp &&
|
currentPos = tile.copy();
|
||||||
contentsUndergroundComp.tier === undergroundComp.tier &&
|
let allBeltsMatch = true;
|
||||||
contentsUndergroundComp.mode === enumUndergroundBeltMode.sender &&
|
for (let i = 0; i < matchingEntrance.range; ++i) {
|
||||||
enumAngleToDirection[contentsStaticComp.rotation] === direction
|
currentPos.addInplace(offset);
|
||||||
) {
|
|
||||||
matchingEntrance = {
|
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
||||||
entity: contents,
|
if (!contents) {
|
||||||
range: i,
|
allBeltsMatch = false;
|
||||||
};
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
const contentsStaticComp = contents.components.StaticMapEntity;
|
||||||
if (!matchingEntrance) {
|
const contentsBeltComp = contents.components.Belt;
|
||||||
// Nothing found
|
if (!contentsBeltComp) {
|
||||||
return;
|
allBeltsMatch = false;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
// DETECT OBSOLETE BELTS BETWEEN
|
|
||||||
// Remove any belts between entrance and exit which have the same direction,
|
// It's a belt
|
||||||
// but only if they *all* have the right direction
|
if (
|
||||||
currentPos = tile.copy();
|
contentsBeltComp.direction !== enumDirection.top ||
|
||||||
let allBeltsMatch = true;
|
enumAngleToDirection[contentsStaticComp.rotation] !== direction
|
||||||
for (let i = 0; i < matchingEntrance.range; ++i) {
|
) {
|
||||||
currentPos.addInplace(offset);
|
allBeltsMatch = false;
|
||||||
|
break;
|
||||||
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
}
|
||||||
if (!contents) {
|
}
|
||||||
allBeltsMatch = false;
|
|
||||||
break;
|
currentPos = tile.copy();
|
||||||
}
|
if (allBeltsMatch) {
|
||||||
|
// All belts between this are obsolete, so drop them
|
||||||
const contentsStaticComp = contents.components.StaticMapEntity;
|
for (let i = 0; i < matchingEntrance.range; ++i) {
|
||||||
const contentsBeltComp = contents.components.Belt;
|
currentPos.addInplace(offset);
|
||||||
if (!contentsBeltComp) {
|
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
||||||
allBeltsMatch = false;
|
assert(contents, "Invalid smart underground belt logic");
|
||||||
break;
|
this.root.logic.tryDeleteBuilding(contents);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// It's a belt
|
|
||||||
if (
|
// REMOVE OBSOLETE TUNNELS
|
||||||
contentsBeltComp.direction !== enumDirection.top ||
|
// Remove any double tunnels, by checking the tile plus the tile above
|
||||||
enumAngleToDirection[contentsStaticComp.rotation] !== direction
|
currentPos = tile.copy().add(offset);
|
||||||
) {
|
for (let i = 0; i < matchingEntrance.range - 1; ++i) {
|
||||||
allBeltsMatch = false;
|
const posBefore = currentPos.copy();
|
||||||
break;
|
currentPos.addInplace(offset);
|
||||||
}
|
|
||||||
}
|
const entityBefore = this.root.map.getTileContent(posBefore, entity.layer);
|
||||||
|
const entityAfter = this.root.map.getTileContent(currentPos, entity.layer);
|
||||||
currentPos = tile.copy();
|
|
||||||
if (allBeltsMatch) {
|
if (!entityBefore || !entityAfter) {
|
||||||
// All belts between this are obsolete, so drop them
|
continue;
|
||||||
for (let i = 0; i < matchingEntrance.range; ++i) {
|
}
|
||||||
currentPos.addInplace(offset);
|
|
||||||
const contents = this.root.map.getTileContent(currentPos, entity.layer);
|
const undergroundBefore = entityBefore.components.UndergroundBelt;
|
||||||
assert(contents, "Invalid smart underground belt logic");
|
const undergroundAfter = entityAfter.components.UndergroundBelt;
|
||||||
this.root.logic.tryDeleteBuilding(contents);
|
|
||||||
}
|
if (!undergroundBefore || !undergroundAfter) {
|
||||||
}
|
// Not an underground belt
|
||||||
|
continue;
|
||||||
// REMOVE OBSOLETE TUNNELS
|
}
|
||||||
// Remove any double tunnels, by checking the tile plus the tile above
|
|
||||||
currentPos = tile.copy().add(offset);
|
if (
|
||||||
for (let i = 0; i < matchingEntrance.range - 1; ++i) {
|
// Both same tier
|
||||||
const posBefore = currentPos.copy();
|
undergroundBefore.tier !== undergroundAfter.tier ||
|
||||||
currentPos.addInplace(offset);
|
// And same tier as our original entity
|
||||||
|
undergroundBefore.tier !== undergroundComp.tier
|
||||||
const entityBefore = this.root.map.getTileContent(posBefore, entity.layer);
|
) {
|
||||||
const entityAfter = this.root.map.getTileContent(currentPos, entity.layer);
|
// Mismatching tier
|
||||||
|
continue;
|
||||||
if (!entityBefore || !entityAfter) {
|
}
|
||||||
continue;
|
|
||||||
}
|
if (
|
||||||
|
undergroundBefore.mode !== enumUndergroundBeltMode.sender ||
|
||||||
const undergroundBefore = entityBefore.components.UndergroundBelt;
|
undergroundAfter.mode !== enumUndergroundBeltMode.receiver
|
||||||
const undergroundAfter = entityAfter.components.UndergroundBelt;
|
) {
|
||||||
|
// Not the right mode
|
||||||
if (!undergroundBefore || !undergroundAfter) {
|
continue;
|
||||||
// Not an underground belt
|
}
|
||||||
continue;
|
|
||||||
}
|
// Check rotations
|
||||||
|
const staticBefore = entityBefore.components.StaticMapEntity;
|
||||||
if (
|
const staticAfter = entityAfter.components.StaticMapEntity;
|
||||||
// Both same tier
|
|
||||||
undergroundBefore.tier !== undergroundAfter.tier ||
|
if (
|
||||||
// And same tier as our original entity
|
enumAngleToDirection[staticBefore.rotation] !== direction ||
|
||||||
undergroundBefore.tier !== undergroundComp.tier
|
enumAngleToDirection[staticAfter.rotation] !== direction
|
||||||
) {
|
) {
|
||||||
// Mismatching tier
|
// Wrong rotation
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// All good, can remove
|
||||||
undergroundBefore.mode !== enumUndergroundBeltMode.sender ||
|
this.root.logic.tryDeleteBuilding(entityBefore);
|
||||||
undergroundAfter.mode !== enumUndergroundBeltMode.receiver
|
this.root.logic.tryDeleteBuilding(entityAfter);
|
||||||
) {
|
}
|
||||||
// Not the right mode
|
}
|
||||||
continue;
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
// Check rotations
|
* Recomputes the cache in the given area, invalidating all entries there
|
||||||
const staticBefore = entityBefore.components.StaticMapEntity;
|
* @param {Rectangle} area
|
||||||
const staticAfter = entityAfter.components.StaticMapEntity;
|
*/
|
||||||
|
recomputeArea(area) {
|
||||||
if (
|
for (let x = area.x; x < area.right(); ++x) {
|
||||||
enumAngleToDirection[staticBefore.rotation] !== direction ||
|
for (let y = area.y; y < area.bottom(); ++y) {
|
||||||
enumAngleToDirection[staticAfter.rotation] !== direction
|
const entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
||||||
) {
|
for (let i = 0; i < entities.length; ++i) {
|
||||||
// Wrong rotation
|
const entity = entities[i];
|
||||||
continue;
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
}
|
if (!undergroundComp) {
|
||||||
|
continue;
|
||||||
// All good, can remove
|
}
|
||||||
this.root.logic.tryDeleteBuilding(entityBefore);
|
undergroundComp.cachedLinkedEntity = null;
|
||||||
this.root.logic.tryDeleteBuilding(entityAfter);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
update() {
|
||||||
* Recomputes the cache in the given area, invalidating all entries there
|
this.staleAreaWatcher.update();
|
||||||
*/
|
|
||||||
recomputeArea() {
|
const delta = this.root.dynamicTickrate.deltaSeconds;
|
||||||
const area = this.areaToRecompute;
|
|
||||||
logger.log("Recomputing area:", area.x, area.y, "/", area.w, area.h);
|
for (let i = 0; i < this.allEntities.length; ++i) {
|
||||||
if (G_IS_DEV && globalConfig.debug.renderChanges) {
|
const entity = this.allEntities[i];
|
||||||
this.root.hud.parts.changesDebugger.renderChange("tunnels", this.areaToRecompute, "#fc03be");
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
}
|
const pendingItems = undergroundComp.pendingItems;
|
||||||
|
|
||||||
for (let x = area.x; x < area.right(); ++x) {
|
// Decrease remaining time of all items in belt
|
||||||
for (let y = area.y; y < area.bottom(); ++y) {
|
for (let k = 0; k < pendingItems.length; ++k) {
|
||||||
const entities = this.root.map.getLayersContentsMultipleXY(x, y);
|
const item = pendingItems[k];
|
||||||
for (let i = 0; i < entities.length; ++i) {
|
item[1] = Math.max(0, item[1] - delta);
|
||||||
const entity = entities[i];
|
if (G_IS_DEV && globalConfig.debug.instantBelts) {
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
item[1] = 0;
|
||||||
if (!undergroundComp) {
|
}
|
||||||
continue;
|
}
|
||||||
}
|
if (undergroundComp.mode === enumUndergroundBeltMode.sender) {
|
||||||
|
this.handleSender(entity);
|
||||||
undergroundComp.cachedLinkedEntity = null;
|
} else {
|
||||||
}
|
this.handleReceiver(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {
|
/**
|
||||||
if (this.areaToRecompute) {
|
* Finds the receiver for a given sender
|
||||||
this.recomputeArea();
|
* @param {Entity} entity
|
||||||
this.areaToRecompute = null;
|
* @returns {import("../components/underground_belt").LinkedUndergroundBelt}
|
||||||
}
|
*/
|
||||||
|
findRecieverForSender(entity) {
|
||||||
const delta = this.root.dynamicTickrate.deltaSeconds;
|
const staticComp = entity.components.StaticMapEntity;
|
||||||
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
for (let i = 0; i < this.allEntities.length; ++i) {
|
const searchDirection = staticComp.localDirectionToWorld(enumDirection.top);
|
||||||
const entity = this.allEntities[i];
|
const searchVector = enumDirectionToVector[searchDirection];
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
const targetRotation = enumDirectionToAngle[searchDirection];
|
||||||
const pendingItems = undergroundComp.pendingItems;
|
let currentTile = staticComp.origin;
|
||||||
|
|
||||||
// Decrease remaining time of all items in belt
|
// Search in the direction of the tunnel
|
||||||
for (let k = 0; k < pendingItems.length; ++k) {
|
for (
|
||||||
const item = pendingItems[k];
|
let searchOffset = 0;
|
||||||
item[1] = Math.max(0, item[1] - delta);
|
searchOffset < globalConfig.undergroundBeltMaxTilesByTier[undergroundComp.tier];
|
||||||
if (G_IS_DEV && globalConfig.debug.instantBelts) {
|
++searchOffset
|
||||||
item[1] = 0;
|
) {
|
||||||
}
|
currentTile = currentTile.add(searchVector);
|
||||||
}
|
|
||||||
if (undergroundComp.mode === enumUndergroundBeltMode.sender) {
|
const potentialReceiver = this.root.map.getTileContent(currentTile, "regular");
|
||||||
this.handleSender(entity);
|
if (!potentialReceiver) {
|
||||||
} else {
|
// Empty tile
|
||||||
this.handleReceiver(entity);
|
continue;
|
||||||
}
|
}
|
||||||
}
|
const receiverUndergroundComp = potentialReceiver.components.UndergroundBelt;
|
||||||
}
|
if (!receiverUndergroundComp || receiverUndergroundComp.tier !== undergroundComp.tier) {
|
||||||
|
// Not a tunnel, or not on the same tier
|
||||||
/**
|
continue;
|
||||||
* Finds the receiver for a given sender
|
}
|
||||||
* @param {Entity} entity
|
|
||||||
* @returns {import("../components/underground_belt").LinkedUndergroundBelt}
|
const receiverStaticComp = potentialReceiver.components.StaticMapEntity;
|
||||||
*/
|
if (receiverStaticComp.rotation !== targetRotation) {
|
||||||
findRecieverForSender(entity) {
|
// Wrong rotation
|
||||||
const staticComp = entity.components.StaticMapEntity;
|
continue;
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
}
|
||||||
const searchDirection = staticComp.localDirectionToWorld(enumDirection.top);
|
|
||||||
const searchVector = enumDirectionToVector[searchDirection];
|
if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) {
|
||||||
const targetRotation = enumDirectionToAngle[searchDirection];
|
// Not a receiver, but a sender -> Abort to make sure we don't deliver double
|
||||||
let currentTile = staticComp.origin;
|
break;
|
||||||
|
}
|
||||||
// Search in the direction of the tunnel
|
|
||||||
for (
|
return { entity: potentialReceiver, distance: searchOffset };
|
||||||
let searchOffset = 0;
|
}
|
||||||
searchOffset < globalConfig.undergroundBeltMaxTilesByTier[undergroundComp.tier];
|
|
||||||
++searchOffset
|
// None found
|
||||||
) {
|
return { entity: null, distance: 0 };
|
||||||
currentTile = currentTile.add(searchVector);
|
}
|
||||||
|
|
||||||
const potentialReceiver = this.root.map.getTileContent(currentTile, "regular");
|
/**
|
||||||
if (!potentialReceiver) {
|
*
|
||||||
// Empty tile
|
* @param {Entity} entity
|
||||||
continue;
|
*/
|
||||||
}
|
handleSender(entity) {
|
||||||
const receiverUndergroundComp = potentialReceiver.components.UndergroundBelt;
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
if (!receiverUndergroundComp || receiverUndergroundComp.tier !== undergroundComp.tier) {
|
|
||||||
// Not a tunnel, or not on the same tier
|
// Find the current receiver
|
||||||
continue;
|
let cacheEntry = undergroundComp.cachedLinkedEntity;
|
||||||
}
|
if (!cacheEntry) {
|
||||||
|
// Need to recompute cache
|
||||||
const receiverStaticComp = potentialReceiver.components.StaticMapEntity;
|
cacheEntry = undergroundComp.cachedLinkedEntity = this.findRecieverForSender(entity);
|
||||||
if (receiverStaticComp.rotation !== targetRotation) {
|
}
|
||||||
// Wrong rotation
|
|
||||||
continue;
|
if (!cacheEntry.entity) {
|
||||||
}
|
// If there is no connection to a receiver, ignore this one
|
||||||
|
return;
|
||||||
if (receiverUndergroundComp.mode !== enumUndergroundBeltMode.receiver) {
|
}
|
||||||
// Not a receiver, but a sender -> Abort to make sure we don't deliver double
|
|
||||||
break;
|
// Check if we have any item
|
||||||
}
|
if (undergroundComp.pendingItems.length > 0) {
|
||||||
|
assert(undergroundComp.pendingItems.length === 1, "more than 1 pending");
|
||||||
return { entity: potentialReceiver, distance: searchOffset };
|
const nextItemAndDuration = undergroundComp.pendingItems[0];
|
||||||
}
|
const remainingTime = nextItemAndDuration[1];
|
||||||
|
const nextItem = nextItemAndDuration[0];
|
||||||
// None found
|
|
||||||
return { entity: null, distance: 0 };
|
// Check if the item is ready to be emitted
|
||||||
}
|
if (remainingTime === 0) {
|
||||||
|
// Check if the receiver can accept it
|
||||||
/**
|
if (
|
||||||
*
|
cacheEntry.entity.components.UndergroundBelt.tryAcceptTunneledItem(
|
||||||
* @param {Entity} entity
|
nextItem,
|
||||||
*/
|
cacheEntry.distance,
|
||||||
handleSender(entity) {
|
this.root.hubGoals.getUndergroundBeltBaseSpeed()
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
)
|
||||||
|
) {
|
||||||
// Find the current receiver
|
// Drop this item
|
||||||
let receiver = undergroundComp.cachedLinkedEntity;
|
fastArrayDelete(undergroundComp.pendingItems, 0);
|
||||||
if (!receiver) {
|
}
|
||||||
// We don't have a receiver, compute it
|
}
|
||||||
receiver = undergroundComp.cachedLinkedEntity = this.findRecieverForSender(entity);
|
}
|
||||||
|
}
|
||||||
if (G_IS_DEV && globalConfig.debug.renderChanges) {
|
|
||||||
this.root.hud.parts.changesDebugger.renderChange(
|
/**
|
||||||
"sender",
|
*
|
||||||
entity.components.StaticMapEntity.getTileSpaceBounds(),
|
* @param {Entity} entity
|
||||||
"#fc03be"
|
*/
|
||||||
);
|
handleReceiver(entity) {
|
||||||
}
|
const undergroundComp = entity.components.UndergroundBelt;
|
||||||
}
|
|
||||||
|
// Try to eject items, we only check the first one because it is sorted by remaining time
|
||||||
if (!receiver.entity) {
|
const items = undergroundComp.pendingItems;
|
||||||
// If there is no connection to a receiver, ignore this one
|
if (items.length > 0) {
|
||||||
return;
|
const nextItemAndDuration = undergroundComp.pendingItems[0];
|
||||||
}
|
const remainingTime = nextItemAndDuration[1];
|
||||||
|
const nextItem = nextItemAndDuration[0];
|
||||||
// Check if we have any item
|
|
||||||
if (undergroundComp.pendingItems.length > 0) {
|
if (remainingTime <= 0) {
|
||||||
assert(undergroundComp.pendingItems.length === 1, "more than 1 pending");
|
const ejectorComp = entity.components.ItemEjector;
|
||||||
const nextItemAndDuration = undergroundComp.pendingItems[0];
|
|
||||||
const remainingTime = nextItemAndDuration[1];
|
const nextSlotIndex = ejectorComp.getFirstFreeSlot();
|
||||||
const nextItem = nextItemAndDuration[0];
|
if (nextSlotIndex !== null) {
|
||||||
|
if (ejectorComp.tryEject(nextSlotIndex, nextItem)) {
|
||||||
// Check if the item is ready to be emitted
|
items.shift();
|
||||||
if (remainingTime === 0) {
|
}
|
||||||
// Check if the receiver can accept it
|
}
|
||||||
if (
|
}
|
||||||
receiver.entity.components.UndergroundBelt.tryAcceptTunneledItem(
|
}
|
||||||
nextItem,
|
}
|
||||||
receiver.distance,
|
}
|
||||||
this.root.hubGoals.getUndergroundBeltBaseSpeed()
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
// Drop this item
|
|
||||||
fastArrayDelete(undergroundComp.pendingItems, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {Entity} entity
|
|
||||||
*/
|
|
||||||
handleReceiver(entity) {
|
|
||||||
const undergroundComp = entity.components.UndergroundBelt;
|
|
||||||
|
|
||||||
// Try to eject items, we only check the first one because it is sorted by remaining time
|
|
||||||
const items = undergroundComp.pendingItems;
|
|
||||||
if (items.length > 0) {
|
|
||||||
const nextItemAndDuration = undergroundComp.pendingItems[0];
|
|
||||||
const remainingTime = nextItemAndDuration[1];
|
|
||||||
const nextItem = nextItemAndDuration[0];
|
|
||||||
|
|
||||||
if (remainingTime <= 0) {
|
|
||||||
const ejectorComp = entity.components.ItemEjector;
|
|
||||||
|
|
||||||
const nextSlotIndex = ejectorComp.getFirstFreeSlot();
|
|
||||||
if (nextSlotIndex !== null) {
|
|
||||||
if (ejectorComp.tryEject(nextSlotIndex, nextItem)) {
|
|
||||||
items.shift();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -162,7 +162,7 @@ export class WireSystem extends GameSystemWithFilter {
|
|||||||
const tunnelEntities = this.root.entityMgr.getAllWithComponent(WireTunnelComponent);
|
const tunnelEntities = this.root.entityMgr.getAllWithComponent(WireTunnelComponent);
|
||||||
const pinEntities = this.root.entityMgr.getAllWithComponent(WiredPinsComponent);
|
const pinEntities = this.root.entityMgr.getAllWithComponent(WiredPinsComponent);
|
||||||
|
|
||||||
// Clear all network references, but not on the first update since thats the deserializing one
|
// Clear all network references, but not on the first update since that's the deserializing one
|
||||||
if (!this.isFirstRecompute) {
|
if (!this.isFirstRecompute) {
|
||||||
for (let i = 0; i < wireEntities.length; ++i) {
|
for (let i = 0; i < wireEntities.length; ++i) {
|
||||||
wireEntities[i].components.Wire.linkedNetwork = null;
|
wireEntities[i].components.Wire.linkedNetwork = null;
|
||||||
@ -432,7 +432,7 @@ export class WireSystem extends GameSystemWithFilter {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if its a tunnel, if so, go to the forwarded item
|
// Check if it's a tunnel, if so, go to the forwarded item
|
||||||
const tunnelComp = entity.components.WireTunnel;
|
const tunnelComp = entity.components.WireTunnel;
|
||||||
if (tunnelComp) {
|
if (tunnelComp) {
|
||||||
if (visitedTunnels.has(entity.uid)) {
|
if (visitedTunnels.has(entity.uid)) {
|
||||||
|
|||||||
@ -149,8 +149,6 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update() {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws a given entity
|
* Draws a given entity
|
||||||
* @param {DrawParameters} parameters
|
* @param {DrawParameters} parameters
|
||||||
|
|||||||
@ -276,6 +276,7 @@ export const allApplicationSettings = [
|
|||||||
new BoolSetting("lowQualityMapResources", enumCategories.performance, (app, value) => {}),
|
new BoolSetting("lowQualityMapResources", enumCategories.performance, (app, value) => {}),
|
||||||
new BoolSetting("disableTileGrid", enumCategories.performance, (app, value) => {}),
|
new BoolSetting("disableTileGrid", enumCategories.performance, (app, value) => {}),
|
||||||
new BoolSetting("lowQualityTextures", enumCategories.performance, (app, value) => {}),
|
new BoolSetting("lowQualityTextures", enumCategories.performance, (app, value) => {}),
|
||||||
|
new BoolSetting("simplifiedBelts", enumCategories.performance, (app, value) => {}),
|
||||||
];
|
];
|
||||||
|
|
||||||
export function getApplicationSettingById(id) {
|
export function getApplicationSettingById(id) {
|
||||||
@ -313,6 +314,7 @@ class SettingsStorage {
|
|||||||
this.lowQualityMapResources = false;
|
this.lowQualityMapResources = false;
|
||||||
this.disableTileGrid = false;
|
this.disableTileGrid = false;
|
||||||
this.lowQualityTextures = false;
|
this.lowQualityTextures = false;
|
||||||
|
this.simplifiedBelts = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object.<string, number>}
|
* @type {Object.<string, number>}
|
||||||
@ -523,7 +525,7 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCurrentVersion() {
|
getCurrentVersion() {
|
||||||
return 26;
|
return 27;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param {{settings: SettingsStorage, version: number}} data */
|
/** @param {{settings: SettingsStorage, version: number}} data */
|
||||||
@ -646,6 +648,11 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|||||||
data.version = 26;
|
data.version = 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.version < 27) {
|
||||||
|
data.settings.simplifiedBelts = false;
|
||||||
|
data.version = 27;
|
||||||
|
}
|
||||||
|
|
||||||
return ExplainedResult.good();
|
return ExplainedResult.good();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,146 +1,146 @@
|
|||||||
import { ExplainedResult } from "../core/explained_result";
|
import { ExplainedResult } from "../core/explained_result";
|
||||||
import { createLogger } from "../core/logging";
|
import { createLogger } from "../core/logging";
|
||||||
import { gComponentRegistry } from "../core/global_registries";
|
import { gComponentRegistry } from "../core/global_registries";
|
||||||
import { SerializerInternal } from "./serializer_internal";
|
import { SerializerInternal } from "./serializer_internal";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import("../game/component").Component} Component
|
* @typedef {import("../game/component").Component} Component
|
||||||
* @typedef {import("../game/component").StaticComponent} StaticComponent
|
* @typedef {import("../game/component").StaticComponent} StaticComponent
|
||||||
* @typedef {import("../game/entity").Entity} Entity
|
* @typedef {import("../game/entity").Entity} Entity
|
||||||
* @typedef {import("../game/root").GameRoot} GameRoot
|
* @typedef {import("../game/root").GameRoot} GameRoot
|
||||||
* @typedef {import("../savegame/savegame_typedefs").SerializedGame} SerializedGame
|
* @typedef {import("../savegame/savegame_typedefs").SerializedGame} SerializedGame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const logger = createLogger("savegame_serializer");
|
const logger = createLogger("savegame_serializer");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes a savegame
|
* Serializes a savegame
|
||||||
*/
|
*/
|
||||||
export class SavegameSerializer {
|
export class SavegameSerializer {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.internal = new SerializerInternal();
|
this.internal = new SerializerInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serializes the game root into a dump
|
* Serializes the game root into a dump
|
||||||
* @param {GameRoot} root
|
* @param {GameRoot} root
|
||||||
* @param {boolean=} sanityChecks Whether to check for validity
|
* @param {boolean=} sanityChecks Whether to check for validity
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
generateDumpFromGameRoot(root, sanityChecks = true) {
|
generateDumpFromGameRoot(root, sanityChecks = true) {
|
||||||
/** @type {SerializedGame} */
|
/** @type {SerializedGame} */
|
||||||
const data = {
|
const data = {
|
||||||
camera: root.camera.serialize(),
|
camera: root.camera.serialize(),
|
||||||
time: root.time.serialize(),
|
time: root.time.serialize(),
|
||||||
map: root.map.serialize(),
|
map: root.map.serialize(),
|
||||||
entityMgr: root.entityMgr.serialize(),
|
entityMgr: root.entityMgr.serialize(),
|
||||||
hubGoals: root.hubGoals.serialize(),
|
hubGoals: root.hubGoals.serialize(),
|
||||||
pinnedShapes: root.hud.parts.pinnedShapes.serialize(),
|
pinnedShapes: root.hud.parts.pinnedShapes.serialize(),
|
||||||
waypoints: root.hud.parts.waypoints.serialize(),
|
waypoints: root.hud.parts.waypoints.serialize(),
|
||||||
entities: this.internal.serializeEntityArray(root.entityMgr.entities),
|
entities: this.internal.serializeEntityArray(root.entityMgr.entities),
|
||||||
beltPaths: root.systemMgr.systems.belt.serializePaths(),
|
beltPaths: root.systemMgr.systems.belt.serializePaths(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!G_IS_RELEASE) {
|
if (G_IS_DEV) {
|
||||||
if (sanityChecks) {
|
if (sanityChecks) {
|
||||||
// Sanity check
|
// Sanity check
|
||||||
const sanity = this.verifyLogicalErrors(data);
|
const sanity = this.verifyLogicalErrors(data);
|
||||||
if (!sanity.result) {
|
if (!sanity.result) {
|
||||||
logger.error("Created invalid savegame:", sanity.reason, "savegame:", data);
|
logger.error("Created invalid savegame:", sanity.reason, "savegame:", data);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Verifies if there are logical errors in the savegame
|
* Verifies if there are logical errors in the savegame
|
||||||
* @param {SerializedGame} savegame
|
* @param {SerializedGame} savegame
|
||||||
* @returns {ExplainedResult}
|
* @returns {ExplainedResult}
|
||||||
*/
|
*/
|
||||||
verifyLogicalErrors(savegame) {
|
verifyLogicalErrors(savegame) {
|
||||||
if (!savegame.entities) {
|
if (!savegame.entities) {
|
||||||
return ExplainedResult.bad("Savegame has no entities");
|
return ExplainedResult.bad("Savegame has no entities");
|
||||||
}
|
}
|
||||||
|
|
||||||
const seenUids = [];
|
const seenUids = new Set();
|
||||||
|
|
||||||
// Check for duplicate UIDS
|
// Check for duplicate UIDS
|
||||||
for (let i = 0; i < savegame.entities.length; ++i) {
|
for (let i = 0; i < savegame.entities.length; ++i) {
|
||||||
/** @type {Entity} */
|
/** @type {Entity} */
|
||||||
const entity = savegame.entities[i];
|
const entity = savegame.entities[i];
|
||||||
|
|
||||||
const uid = entity.uid;
|
const uid = entity.uid;
|
||||||
if (!Number.isInteger(uid)) {
|
if (!Number.isInteger(uid)) {
|
||||||
return ExplainedResult.bad("Entity has invalid uid: " + uid);
|
return ExplainedResult.bad("Entity has invalid uid: " + uid);
|
||||||
}
|
}
|
||||||
if (seenUids.indexOf(uid) >= 0) {
|
if (seenUids.has(uid)) {
|
||||||
return ExplainedResult.bad("Duplicate uid " + uid);
|
return ExplainedResult.bad("Duplicate uid " + uid);
|
||||||
}
|
}
|
||||||
seenUids.push(uid);
|
seenUids.add(uid);
|
||||||
|
|
||||||
// Verify components
|
// Verify components
|
||||||
if (!entity.components) {
|
if (!entity.components) {
|
||||||
return ExplainedResult.bad("Entity is missing key 'components': " + JSON.stringify(entity));
|
return ExplainedResult.bad("Entity is missing key 'components': " + JSON.stringify(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
const components = entity.components;
|
const components = entity.components;
|
||||||
for (const componentId in components) {
|
for (const componentId in components) {
|
||||||
const componentClass = gComponentRegistry.findById(componentId);
|
const componentClass = gComponentRegistry.findById(componentId);
|
||||||
|
|
||||||
// Check component id is known
|
// Check component id is known
|
||||||
if (!componentClass) {
|
if (!componentClass) {
|
||||||
return ExplainedResult.bad("Unknown component id: " + componentId);
|
return ExplainedResult.bad("Unknown component id: " + componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify component data
|
// Verify component data
|
||||||
const componentData = components[componentId];
|
const componentData = components[componentId];
|
||||||
const componentVerifyError = /** @type {StaticComponent} */ (componentClass).verify(
|
const componentVerifyError = /** @type {StaticComponent} */ (componentClass).verify(
|
||||||
componentData
|
componentData
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check component data is ok
|
// Check component data is ok
|
||||||
if (componentVerifyError) {
|
if (componentVerifyError) {
|
||||||
return ExplainedResult.bad(
|
return ExplainedResult.bad(
|
||||||
"Component " + componentId + " has invalid data: " + componentVerifyError
|
"Component " + componentId + " has invalid data: " + componentVerifyError
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExplainedResult.good();
|
return ExplainedResult.good();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to load the savegame from a given dump
|
* Tries to load the savegame from a given dump
|
||||||
* @param {SerializedGame} savegame
|
* @param {SerializedGame} savegame
|
||||||
* @param {GameRoot} root
|
* @param {GameRoot} root
|
||||||
* @returns {ExplainedResult}
|
* @returns {ExplainedResult}
|
||||||
*/
|
*/
|
||||||
deserialize(savegame, root) {
|
deserialize(savegame, root) {
|
||||||
// Sanity
|
// Sanity
|
||||||
const verifyResult = this.verifyLogicalErrors(savegame);
|
const verifyResult = this.verifyLogicalErrors(savegame);
|
||||||
if (!verifyResult.result) {
|
if (!verifyResult.result) {
|
||||||
return ExplainedResult.bad(verifyResult.reason);
|
return ExplainedResult.bad(verifyResult.reason);
|
||||||
}
|
}
|
||||||
let errorReason = null;
|
let errorReason = null;
|
||||||
|
|
||||||
errorReason = errorReason || root.entityMgr.deserialize(savegame.entityMgr);
|
errorReason = errorReason || root.entityMgr.deserialize(savegame.entityMgr);
|
||||||
errorReason = errorReason || root.time.deserialize(savegame.time);
|
errorReason = errorReason || root.time.deserialize(savegame.time);
|
||||||
errorReason = errorReason || root.camera.deserialize(savegame.camera);
|
errorReason = errorReason || root.camera.deserialize(savegame.camera);
|
||||||
errorReason = errorReason || root.map.deserialize(savegame.map);
|
errorReason = errorReason || root.map.deserialize(savegame.map);
|
||||||
errorReason = errorReason || root.hubGoals.deserialize(savegame.hubGoals);
|
errorReason = errorReason || root.hubGoals.deserialize(savegame.hubGoals);
|
||||||
errorReason = errorReason || root.hud.parts.pinnedShapes.deserialize(savegame.pinnedShapes);
|
errorReason = errorReason || root.hud.parts.pinnedShapes.deserialize(savegame.pinnedShapes);
|
||||||
errorReason = errorReason || root.hud.parts.waypoints.deserialize(savegame.waypoints);
|
errorReason = errorReason || root.hud.parts.waypoints.deserialize(savegame.waypoints);
|
||||||
errorReason = errorReason || this.internal.deserializeEntityArray(root, savegame.entities);
|
errorReason = errorReason || this.internal.deserializeEntityArray(root, savegame.entities);
|
||||||
errorReason = errorReason || root.systemMgr.systems.belt.deserializePaths(savegame.beltPaths);
|
errorReason = errorReason || root.systemMgr.systems.belt.deserializePaths(savegame.beltPaths);
|
||||||
|
|
||||||
// Check for errors
|
// Check for errors
|
||||||
if (errorReason) {
|
if (errorReason) {
|
||||||
return ExplainedResult.bad(errorReason);
|
return ExplainedResult.bad(errorReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExplainedResult.good();
|
return ExplainedResult.good();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,438 +1,458 @@
|
|||||||
import { APPLICATION_ERROR_OCCURED } from "../core/error_handler";
|
import { APPLICATION_ERROR_OCCURED } from "../core/error_handler";
|
||||||
import { GameState } from "../core/game_state";
|
import { GameState } from "../core/game_state";
|
||||||
import { logSection, createLogger } from "../core/logging";
|
import { logSection, createLogger } from "../core/logging";
|
||||||
import { waitNextFrame } from "../core/utils";
|
import { waitNextFrame } from "../core/utils";
|
||||||
import { globalConfig } from "../core/config";
|
import { globalConfig } from "../core/config";
|
||||||
import { GameLoadingOverlay } from "../game/game_loading_overlay";
|
import { GameLoadingOverlay } from "../game/game_loading_overlay";
|
||||||
import { KeyActionMapper } from "../game/key_action_mapper";
|
import { KeyActionMapper } from "../game/key_action_mapper";
|
||||||
import { Savegame } from "../savegame/savegame";
|
import { Savegame } from "../savegame/savegame";
|
||||||
import { GameCore } from "../game/core";
|
import { GameCore } from "../game/core";
|
||||||
import { MUSIC } from "../platform/sound";
|
import { MUSIC } from "../platform/sound";
|
||||||
|
|
||||||
const logger = createLogger("state/ingame");
|
const logger = createLogger("state/ingame");
|
||||||
|
|
||||||
// Different sub-states
|
// Different sub-states
|
||||||
const stages = {
|
const stages = {
|
||||||
s3_createCore: "🌈 3: Create core",
|
s3_createCore: "🌈 3: Create core",
|
||||||
s4_A_initEmptyGame: "🌈 4/A: Init empty game",
|
s4_A_initEmptyGame: "🌈 4/A: Init empty game",
|
||||||
s4_B_resumeGame: "🌈 4/B: Resume game",
|
s4_B_resumeGame: "🌈 4/B: Resume game",
|
||||||
|
|
||||||
s5_firstUpdate: "🌈 5: First game update",
|
s5_firstUpdate: "🌈 5: First game update",
|
||||||
s6_postLoadHook: "🌈 6: Post load hook",
|
s6_postLoadHook: "🌈 6: Post load hook",
|
||||||
s7_warmup: "🌈 7: Warmup",
|
s7_warmup: "🌈 7: Warmup",
|
||||||
|
|
||||||
s10_gameRunning: "🌈 10: Game finally running",
|
s10_gameRunning: "🌈 10: Game finally running",
|
||||||
|
|
||||||
leaving: "🌈 Saving, then leaving the game",
|
leaving: "🌈 Saving, then leaving the game",
|
||||||
destroyed: "🌈 DESTROYED: Core is empty and waits for state leave",
|
destroyed: "🌈 DESTROYED: Core is empty and waits for state leave",
|
||||||
initFailed: "🌈 ERROR: Initialization failed!",
|
initFailed: "🌈 ERROR: Initialization failed!",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const gameCreationAction = {
|
export const gameCreationAction = {
|
||||||
new: "new-game",
|
new: "new-game",
|
||||||
resume: "resume-game",
|
resume: "resume-game",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Typehints
|
// Typehints
|
||||||
export class GameCreationPayload {
|
export class GameCreationPayload {
|
||||||
constructor() {
|
constructor() {
|
||||||
/** @type {boolean|undefined} */
|
/** @type {boolean|undefined} */
|
||||||
this.fastEnter;
|
this.fastEnter;
|
||||||
|
|
||||||
/** @type {Savegame} */
|
/** @type {Savegame} */
|
||||||
this.savegame;
|
this.savegame;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InGameState extends GameState {
|
export class InGameState extends GameState {
|
||||||
constructor() {
|
constructor() {
|
||||||
super("InGameState");
|
super("InGameState");
|
||||||
|
|
||||||
/** @type {GameCreationPayload} */
|
/** @type {GameCreationPayload} */
|
||||||
this.creationPayload = null;
|
this.creationPayload = null;
|
||||||
|
|
||||||
// Stores current stage
|
// Stores current stage
|
||||||
this.stage = "";
|
this.stage = "";
|
||||||
|
|
||||||
/** @type {GameCore} */
|
/** @type {GameCore} */
|
||||||
this.core = null;
|
this.core = null;
|
||||||
|
|
||||||
/** @type {KeyActionMapper} */
|
/** @type {KeyActionMapper} */
|
||||||
this.keyActionMapper = null;
|
this.keyActionMapper = null;
|
||||||
|
|
||||||
/** @type {GameLoadingOverlay} */
|
/** @type {GameLoadingOverlay} */
|
||||||
this.loadingOverlay = null;
|
this.loadingOverlay = null;
|
||||||
|
|
||||||
/** @type {Savegame} */
|
/** @type {Savegame} */
|
||||||
this.savegame;
|
this.savegame = null;
|
||||||
|
|
||||||
this.boundInputFilter = this.filterInput.bind(this);
|
this.boundInputFilter = this.filterInput.bind(this);
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Whether we are currently saving the game
|
||||||
* Switches the game into another sub-state
|
* @TODO: This doesn't realy fit here
|
||||||
* @param {string} stage
|
*/
|
||||||
*/
|
this.currentSavePromise = null;
|
||||||
switchStage(stage) {
|
}
|
||||||
assert(stage, "Got empty stage");
|
|
||||||
if (stage !== this.stage) {
|
/**
|
||||||
this.stage = stage;
|
* Switches the game into another sub-state
|
||||||
logger.log(this.stage);
|
* @param {string} stage
|
||||||
return true;
|
*/
|
||||||
} else {
|
switchStage(stage) {
|
||||||
// log(this, "Re entering", stage);
|
assert(stage, "Got empty stage");
|
||||||
return false;
|
if (stage !== this.stage) {
|
||||||
}
|
this.stage = stage;
|
||||||
}
|
logger.log(this.stage);
|
||||||
|
return true;
|
||||||
// GameState implementation
|
} else {
|
||||||
getInnerHTML() {
|
// log(this, "Re entering", stage);
|
||||||
return "";
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
getThemeMusic() {
|
|
||||||
return MUSIC.theme;
|
// GameState implementation
|
||||||
}
|
getInnerHTML() {
|
||||||
|
return "";
|
||||||
onBeforeExit() {
|
}
|
||||||
// logger.log("Saving before quitting");
|
|
||||||
// return this.doSave().then(() => {
|
getThemeMusic() {
|
||||||
// logger.log(this, "Successfully saved");
|
return MUSIC.theme;
|
||||||
// // this.stageDestroyed();
|
}
|
||||||
// });
|
|
||||||
}
|
onBeforeExit() {
|
||||||
|
// logger.log("Saving before quitting");
|
||||||
onAppPause() {
|
// return this.doSave().then(() => {
|
||||||
// if (this.stage === stages.s10_gameRunning) {
|
// logger.log(this, "Successfully saved");
|
||||||
// logger.log("Saving because app got paused");
|
// // this.stageDestroyed();
|
||||||
// this.doSave();
|
// });
|
||||||
// }
|
}
|
||||||
}
|
|
||||||
|
onAppPause() {
|
||||||
getHasFadeIn() {
|
// if (this.stage === stages.s10_gameRunning) {
|
||||||
return false;
|
// logger.log("Saving because app got paused");
|
||||||
}
|
// this.doSave();
|
||||||
|
// }
|
||||||
getPauseOnFocusLost() {
|
}
|
||||||
return false;
|
|
||||||
}
|
getHasFadeIn() {
|
||||||
|
return false;
|
||||||
getHasUnloadConfirmation() {
|
}
|
||||||
return true;
|
|
||||||
}
|
getPauseOnFocusLost() {
|
||||||
|
return false;
|
||||||
onLeave() {
|
}
|
||||||
if (this.core) {
|
|
||||||
this.stageDestroyed();
|
getHasUnloadConfirmation() {
|
||||||
}
|
return true;
|
||||||
this.app.inputMgr.dismountFilter(this.boundInputFilter);
|
}
|
||||||
}
|
|
||||||
|
onLeave() {
|
||||||
onResized(w, h) {
|
if (this.core) {
|
||||||
super.onResized(w, h);
|
this.stageDestroyed();
|
||||||
if (this.stage === stages.s10_gameRunning) {
|
}
|
||||||
this.core.resize(w, h);
|
this.app.inputMgr.dismountFilter(this.boundInputFilter);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
onResized(w, h) {
|
||||||
// ---- End of GameState implementation
|
super.onResized(w, h);
|
||||||
|
if (this.stage === stages.s10_gameRunning) {
|
||||||
/**
|
this.core.resize(w, h);
|
||||||
* Goes back to the menu state
|
}
|
||||||
*/
|
}
|
||||||
goBackToMenu() {
|
|
||||||
this.saveThenGoToState("MainMenuState");
|
// ---- End of GameState implementation
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Goes back to the menu state
|
||||||
* Goes back to the settings state
|
*/
|
||||||
*/
|
goBackToMenu() {
|
||||||
goToSettings() {
|
this.saveThenGoToState("MainMenuState");
|
||||||
this.saveThenGoToState("SettingsState", {
|
}
|
||||||
backToStateId: this.key,
|
|
||||||
backToStatePayload: this.creationPayload,
|
/**
|
||||||
});
|
* Goes back to the settings state
|
||||||
}
|
*/
|
||||||
|
goToSettings() {
|
||||||
/**
|
this.saveThenGoToState("SettingsState", {
|
||||||
* Goes back to the settings state
|
backToStateId: this.key,
|
||||||
*/
|
backToStatePayload: this.creationPayload,
|
||||||
goToKeybindings() {
|
});
|
||||||
this.saveThenGoToState("KeybindingsState", {
|
}
|
||||||
backToStateId: this.key,
|
|
||||||
backToStatePayload: this.creationPayload,
|
/**
|
||||||
});
|
* Goes back to the settings state
|
||||||
}
|
*/
|
||||||
|
goToKeybindings() {
|
||||||
/**
|
this.saveThenGoToState("KeybindingsState", {
|
||||||
* Moves to a state outside of the game
|
backToStateId: this.key,
|
||||||
* @param {string} stateId
|
backToStatePayload: this.creationPayload,
|
||||||
* @param {any=} payload
|
});
|
||||||
*/
|
}
|
||||||
saveThenGoToState(stateId, payload) {
|
|
||||||
if (this.stage === stages.leaving || this.stage === stages.destroyed) {
|
/**
|
||||||
logger.warn(
|
* Moves to a state outside of the game
|
||||||
"Tried to leave game twice or during destroy:",
|
* @param {string} stateId
|
||||||
this.stage,
|
* @param {any=} payload
|
||||||
"(attempted to move to",
|
*/
|
||||||
stateId,
|
saveThenGoToState(stateId, payload) {
|
||||||
")"
|
if (this.stage === stages.leaving || this.stage === stages.destroyed) {
|
||||||
);
|
logger.warn(
|
||||||
return;
|
"Tried to leave game twice or during destroy:",
|
||||||
}
|
this.stage,
|
||||||
this.stageLeavingGame();
|
"(attempted to move to",
|
||||||
this.doSave().then(() => {
|
stateId,
|
||||||
this.stageDestroyed();
|
")"
|
||||||
this.moveToState(stateId, payload);
|
);
|
||||||
});
|
return;
|
||||||
}
|
}
|
||||||
|
this.stageLeavingGame();
|
||||||
onBackButton() {
|
this.doSave().then(() => {
|
||||||
// do nothing
|
this.stageDestroyed();
|
||||||
}
|
this.moveToState(stateId, payload);
|
||||||
|
});
|
||||||
/**
|
}
|
||||||
* Called when the game somehow failed to initialize. Resets everything to basic state and
|
|
||||||
* then goes to the main menu, showing the error
|
onBackButton() {
|
||||||
* @param {string} err
|
// do nothing
|
||||||
*/
|
}
|
||||||
onInitializationFailure(err) {
|
|
||||||
if (this.switchStage(stages.initFailed)) {
|
/**
|
||||||
logger.error("Init failure:", err);
|
* Called when the game somehow failed to initialize. Resets everything to basic state and
|
||||||
this.stageDestroyed();
|
* then goes to the main menu, showing the error
|
||||||
this.moveToState("MainMenuState", { loadError: err });
|
* @param {string} err
|
||||||
}
|
*/
|
||||||
}
|
onInitializationFailure(err) {
|
||||||
|
if (this.switchStage(stages.initFailed)) {
|
||||||
// STAGES
|
logger.error("Init failure:", err);
|
||||||
|
this.stageDestroyed();
|
||||||
/**
|
this.moveToState("MainMenuState", { loadError: err });
|
||||||
* Creates the game core instance, and thus the root
|
}
|
||||||
*/
|
}
|
||||||
stage3CreateCore() {
|
|
||||||
if (this.switchStage(stages.s3_createCore)) {
|
// STAGES
|
||||||
logger.log("Creating new game core");
|
|
||||||
this.core = new GameCore(this.app);
|
/**
|
||||||
|
* Creates the game core instance, and thus the root
|
||||||
this.core.initializeRoot(this, this.savegame);
|
*/
|
||||||
|
stage3CreateCore() {
|
||||||
if (this.savegame.hasGameDump()) {
|
if (this.switchStage(stages.s3_createCore)) {
|
||||||
this.stage4bResumeGame();
|
logger.log("Creating new game core");
|
||||||
} else {
|
this.core = new GameCore(this.app);
|
||||||
this.app.gameAnalytics.handleGameStarted();
|
|
||||||
this.stage4aInitEmptyGame();
|
this.core.initializeRoot(this, this.savegame);
|
||||||
}
|
|
||||||
}
|
if (this.savegame.hasGameDump()) {
|
||||||
}
|
this.stage4bResumeGame();
|
||||||
|
} else {
|
||||||
/**
|
this.app.gameAnalytics.handleGameStarted();
|
||||||
* Initializes a new empty game
|
this.stage4aInitEmptyGame();
|
||||||
*/
|
}
|
||||||
stage4aInitEmptyGame() {
|
}
|
||||||
if (this.switchStage(stages.s4_A_initEmptyGame)) {
|
}
|
||||||
this.core.initNewGame();
|
|
||||||
this.stage5FirstUpdate();
|
/**
|
||||||
}
|
* Initializes a new empty game
|
||||||
}
|
*/
|
||||||
|
stage4aInitEmptyGame() {
|
||||||
/**
|
if (this.switchStage(stages.s4_A_initEmptyGame)) {
|
||||||
* Resumes an existing game
|
this.core.initNewGame();
|
||||||
*/
|
this.stage5FirstUpdate();
|
||||||
stage4bResumeGame() {
|
}
|
||||||
if (this.switchStage(stages.s4_B_resumeGame)) {
|
}
|
||||||
if (!this.core.initExistingGame()) {
|
|
||||||
this.onInitializationFailure("Savegame is corrupt and can not be restored.");
|
/**
|
||||||
return;
|
* Resumes an existing game
|
||||||
}
|
*/
|
||||||
this.app.gameAnalytics.handleGameResumed();
|
stage4bResumeGame() {
|
||||||
this.stage5FirstUpdate();
|
if (this.switchStage(stages.s4_B_resumeGame)) {
|
||||||
}
|
if (!this.core.initExistingGame()) {
|
||||||
}
|
this.onInitializationFailure("Savegame is corrupt and can not be restored.");
|
||||||
|
return;
|
||||||
/**
|
}
|
||||||
* Performs the first game update on the game which initializes most caches
|
this.app.gameAnalytics.handleGameResumed();
|
||||||
*/
|
this.stage5FirstUpdate();
|
||||||
stage5FirstUpdate() {
|
}
|
||||||
if (this.switchStage(stages.s5_firstUpdate)) {
|
}
|
||||||
this.core.root.logicInitialized = true;
|
|
||||||
this.core.updateLogic();
|
/**
|
||||||
this.stage6PostLoadHook();
|
* Performs the first game update on the game which initializes most caches
|
||||||
}
|
*/
|
||||||
}
|
stage5FirstUpdate() {
|
||||||
|
if (this.switchStage(stages.s5_firstUpdate)) {
|
||||||
/**
|
this.core.root.logicInitialized = true;
|
||||||
* Call the post load hook, this means that we have loaded the game, and all systems
|
this.core.updateLogic();
|
||||||
* can operate and start to work now.
|
this.stage6PostLoadHook();
|
||||||
*/
|
}
|
||||||
stage6PostLoadHook() {
|
}
|
||||||
if (this.switchStage(stages.s6_postLoadHook)) {
|
|
||||||
logger.log("Post load hook");
|
/**
|
||||||
this.core.postLoadHook();
|
* Call the post load hook, this means that we have loaded the game, and all systems
|
||||||
this.stage7Warmup();
|
* can operate and start to work now.
|
||||||
}
|
*/
|
||||||
}
|
stage6PostLoadHook() {
|
||||||
|
if (this.switchStage(stages.s6_postLoadHook)) {
|
||||||
/**
|
logger.log("Post load hook");
|
||||||
* This makes the game idle and draw for a while, because we run most code this way
|
this.core.postLoadHook();
|
||||||
* the V8 engine can already start to optimize it. Also this makes sure the resources
|
this.stage7Warmup();
|
||||||
* are in the VRAM and we have a smooth experience once we start.
|
}
|
||||||
*/
|
}
|
||||||
stage7Warmup() {
|
|
||||||
if (this.switchStage(stages.s7_warmup)) {
|
/**
|
||||||
if (G_IS_DEV && globalConfig.debug.noArtificialDelays) {
|
* This makes the game idle and draw for a while, because we run most code this way
|
||||||
this.warmupTimeSeconds = 0.05;
|
* the V8 engine can already start to optimize it. Also this makes sure the resources
|
||||||
} else {
|
* are in the VRAM and we have a smooth experience once we start.
|
||||||
if (this.creationPayload.fastEnter) {
|
*/
|
||||||
this.warmupTimeSeconds = globalConfig.warmupTimeSecondsFast;
|
stage7Warmup() {
|
||||||
} else {
|
if (this.switchStage(stages.s7_warmup)) {
|
||||||
this.warmupTimeSeconds = globalConfig.warmupTimeSecondsRegular;
|
if (G_IS_DEV && globalConfig.debug.noArtificialDelays) {
|
||||||
}
|
this.warmupTimeSeconds = 0.05;
|
||||||
}
|
} else {
|
||||||
}
|
if (this.creationPayload.fastEnter) {
|
||||||
}
|
this.warmupTimeSeconds = globalConfig.warmupTimeSecondsFast;
|
||||||
|
} else {
|
||||||
/**
|
this.warmupTimeSeconds = globalConfig.warmupTimeSecondsRegular;
|
||||||
* The final stage where this game is running and updating regulary.
|
}
|
||||||
*/
|
}
|
||||||
stage10GameRunning() {
|
}
|
||||||
if (this.switchStage(stages.s10_gameRunning)) {
|
}
|
||||||
this.core.root.signals.readyToRender.dispatch();
|
|
||||||
|
/**
|
||||||
logSection("GAME STARTED", "#26a69a");
|
* The final stage where this game is running and updating regulary.
|
||||||
|
*/
|
||||||
// Initial resize, might have changed during loading (this is possible)
|
stage10GameRunning() {
|
||||||
this.core.resize(this.app.screenWidth, this.app.screenHeight);
|
if (this.switchStage(stages.s10_gameRunning)) {
|
||||||
}
|
this.core.root.signals.readyToRender.dispatch();
|
||||||
}
|
|
||||||
|
logSection("GAME STARTED", "#26a69a");
|
||||||
/**
|
|
||||||
* This stage destroys the whole game, used to cleanup
|
// Initial resize, might have changed during loading (this is possible)
|
||||||
*/
|
this.core.resize(this.app.screenWidth, this.app.screenHeight);
|
||||||
stageDestroyed() {
|
}
|
||||||
if (this.switchStage(stages.destroyed)) {
|
}
|
||||||
// Cleanup all api calls
|
|
||||||
this.cancelAllAsyncOperations();
|
/**
|
||||||
|
* This stage destroys the whole game, used to cleanup
|
||||||
if (this.syncer) {
|
*/
|
||||||
this.syncer.cancelSync();
|
stageDestroyed() {
|
||||||
this.syncer = null;
|
if (this.switchStage(stages.destroyed)) {
|
||||||
}
|
// Cleanup all api calls
|
||||||
|
this.cancelAllAsyncOperations();
|
||||||
// Cleanup core
|
|
||||||
if (this.core) {
|
if (this.syncer) {
|
||||||
this.core.destruct();
|
this.syncer.cancelSync();
|
||||||
this.core = null;
|
this.syncer = null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
// Cleanup core
|
||||||
|
if (this.core) {
|
||||||
/**
|
this.core.destruct();
|
||||||
* When leaving the game
|
this.core = null;
|
||||||
*/
|
}
|
||||||
stageLeavingGame() {
|
}
|
||||||
if (this.switchStage(stages.leaving)) {
|
}
|
||||||
// ...
|
|
||||||
}
|
/**
|
||||||
}
|
* When leaving the game
|
||||||
|
*/
|
||||||
// END STAGES
|
stageLeavingGame() {
|
||||||
|
if (this.switchStage(stages.leaving)) {
|
||||||
/**
|
// ...
|
||||||
* Filters the input (keybindings)
|
}
|
||||||
*/
|
}
|
||||||
filterInput() {
|
|
||||||
return this.stage === stages.s10_gameRunning;
|
// END STAGES
|
||||||
}
|
|
||||||
|
/**
|
||||||
/**
|
* Filters the input (keybindings)
|
||||||
* @param {GameCreationPayload} payload
|
*/
|
||||||
*/
|
filterInput() {
|
||||||
onEnter(payload) {
|
return this.stage === stages.s10_gameRunning;
|
||||||
this.app.inputMgr.installFilter(this.boundInputFilter);
|
}
|
||||||
|
|
||||||
this.creationPayload = payload;
|
/**
|
||||||
this.savegame = payload.savegame;
|
* @param {GameCreationPayload} payload
|
||||||
|
*/
|
||||||
this.loadingOverlay = new GameLoadingOverlay(this.app, this.getDivElement());
|
onEnter(payload) {
|
||||||
this.loadingOverlay.showBasic();
|
this.app.inputMgr.installFilter(this.boundInputFilter);
|
||||||
|
|
||||||
// Remove unneded default element
|
this.creationPayload = payload;
|
||||||
document.body.querySelector(".modalDialogParent").remove();
|
this.savegame = payload.savegame;
|
||||||
|
|
||||||
this.asyncChannel.watch(waitNextFrame()).then(() => this.stage3CreateCore());
|
this.loadingOverlay = new GameLoadingOverlay(this.app, this.getDivElement());
|
||||||
}
|
this.loadingOverlay.showBasic();
|
||||||
|
|
||||||
/**
|
// Remove unneded default element
|
||||||
* Render callback
|
document.body.querySelector(".modalDialogParent").remove();
|
||||||
* @param {number} dt
|
|
||||||
*/
|
this.asyncChannel.watch(waitNextFrame()).then(() => this.stage3CreateCore());
|
||||||
onRender(dt) {
|
}
|
||||||
if (APPLICATION_ERROR_OCCURED) {
|
|
||||||
// Application somehow crashed, do not do anything
|
/**
|
||||||
return;
|
* Render callback
|
||||||
}
|
* @param {number} dt
|
||||||
|
*/
|
||||||
if (this.stage === stages.s7_warmup) {
|
onRender(dt) {
|
||||||
this.core.draw();
|
if (APPLICATION_ERROR_OCCURED) {
|
||||||
this.warmupTimeSeconds -= dt / 1000.0;
|
// Application somehow crashed, do not do anything
|
||||||
if (this.warmupTimeSeconds < 0) {
|
return;
|
||||||
logger.log("Warmup completed");
|
}
|
||||||
this.stage10GameRunning();
|
|
||||||
}
|
if (this.stage === stages.s7_warmup) {
|
||||||
}
|
this.core.draw();
|
||||||
|
this.warmupTimeSeconds -= dt / 1000.0;
|
||||||
if (this.stage === stages.s10_gameRunning) {
|
if (this.warmupTimeSeconds < 0) {
|
||||||
this.core.tick(dt);
|
logger.log("Warmup completed");
|
||||||
}
|
this.stage10GameRunning();
|
||||||
|
}
|
||||||
// If the stage is still active (This might not be the case if tick() moved us to game over)
|
}
|
||||||
if (this.stage === stages.s10_gameRunning) {
|
|
||||||
// Only draw if page visible
|
if (this.stage === stages.s10_gameRunning) {
|
||||||
if (this.app.pageVisible) {
|
this.core.tick(dt);
|
||||||
this.core.draw();
|
}
|
||||||
}
|
|
||||||
|
// If the stage is still active (This might not be the case if tick() moved us to game over)
|
||||||
this.loadingOverlay.removeIfAttached();
|
if (this.stage === stages.s10_gameRunning) {
|
||||||
} else {
|
// Only draw if page visible
|
||||||
if (!this.loadingOverlay.isAttached()) {
|
if (this.app.pageVisible) {
|
||||||
this.loadingOverlay.showBasic();
|
this.core.draw();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
this.loadingOverlay.removeIfAttached();
|
||||||
|
} else {
|
||||||
onBackgroundTick(dt) {
|
if (!this.loadingOverlay.isAttached()) {
|
||||||
this.onRender(dt);
|
this.loadingOverlay.showBasic();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/**
|
}
|
||||||
* Saves the game
|
|
||||||
*/
|
onBackgroundTick(dt) {
|
||||||
|
this.onRender(dt);
|
||||||
doSave() {
|
}
|
||||||
if (!this.savegame || !this.savegame.isSaveable()) {
|
|
||||||
return Promise.resolve();
|
/**
|
||||||
}
|
* Saves the game
|
||||||
|
*/
|
||||||
if (APPLICATION_ERROR_OCCURED) {
|
|
||||||
logger.warn("skipping save because application crashed");
|
doSave() {
|
||||||
return Promise.resolve();
|
if (!this.savegame || !this.savegame.isSaveable()) {
|
||||||
}
|
return Promise.resolve();
|
||||||
|
}
|
||||||
if (
|
|
||||||
this.stage !== stages.s10_gameRunning &&
|
if (APPLICATION_ERROR_OCCURED) {
|
||||||
this.stage !== stages.s7_warmup &&
|
logger.warn("skipping save because application crashed");
|
||||||
this.stage !== stages.leaving
|
return Promise.resolve();
|
||||||
) {
|
}
|
||||||
logger.warn("Skipping save because game is not ready");
|
|
||||||
return Promise.resolve();
|
if (
|
||||||
}
|
this.stage !== stages.s10_gameRunning &&
|
||||||
|
this.stage !== stages.s7_warmup &&
|
||||||
// First update the game data
|
this.stage !== stages.leaving
|
||||||
logger.log("Starting to save game ...");
|
) {
|
||||||
this.core.root.signals.gameSaved.dispatch();
|
logger.warn("Skipping save because game is not ready");
|
||||||
this.savegame.updateData(this.core.root);
|
return Promise.resolve();
|
||||||
return this.savegame.writeSavegameAndMetadata().catch(err => {
|
}
|
||||||
logger.warn("Failed to save:", err);
|
|
||||||
});
|
if (this.currentSavePromise) {
|
||||||
}
|
logger.warn("Skipping double save and returning same promise");
|
||||||
}
|
return this.currentSavePromise;
|
||||||
|
}
|
||||||
|
logger.log("Starting to save game ...");
|
||||||
|
this.savegame.updateData(this.core.root);
|
||||||
|
|
||||||
|
this.currentSavePromise = this.savegame
|
||||||
|
.writeSavegameAndMetadata()
|
||||||
|
.catch(err => {
|
||||||
|
// Catch errors
|
||||||
|
logger.warn("Failed to save:", err);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// Clear promise
|
||||||
|
logger.log("Saved!");
|
||||||
|
this.core.root.signals.gameSaved.dispatch();
|
||||||
|
this.currentSavePromise = null;
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.currentSavePromise;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,293 +1,331 @@
|
|||||||
import { GameState } from "../core/game_state";
|
import { CHANGELOG } from "../changelog";
|
||||||
import { createLogger } from "../core/logging";
|
import { cachebust } from "../core/cachebust";
|
||||||
import { findNiceValue } from "../core/utils";
|
import { globalConfig } from "../core/config";
|
||||||
import { cachebust } from "../core/cachebust";
|
import { GameState } from "../core/game_state";
|
||||||
import { PlatformWrapperImplBrowser } from "../platform/browser/wrapper";
|
import { createLogger } from "../core/logging";
|
||||||
import { T, autoDetectLanguageId, updateApplicationLanguage } from "../translations";
|
import { findNiceValue } from "../core/utils";
|
||||||
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
import { getRandomHint } from "../game/hints";
|
||||||
import { CHANGELOG } from "../changelog";
|
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
||||||
import { globalConfig } from "../core/config";
|
import { PlatformWrapperImplBrowser } from "../platform/browser/wrapper";
|
||||||
|
import { autoDetectLanguageId, T, updateApplicationLanguage } from "../translations";
|
||||||
const logger = createLogger("state/preload");
|
|
||||||
|
const logger = createLogger("state/preload");
|
||||||
export class PreloadState extends GameState {
|
|
||||||
constructor() {
|
export class PreloadState extends GameState {
|
||||||
super("PreloadState");
|
constructor() {
|
||||||
}
|
super("PreloadState");
|
||||||
|
}
|
||||||
getInnerHTML() {
|
|
||||||
return `
|
getInnerHTML() {
|
||||||
<div class="loadingImage"></div>
|
return `
|
||||||
<div class="loadingStatus">
|
<div class="loadingImage"></div>
|
||||||
<span class="desc">Booting</span>
|
<div class="loadingStatus">
|
||||||
<span class="bar">
|
<span class="desc">Booting</span>
|
||||||
<span class="inner" style="width: 0%"></span>
|
<span class="bar">
|
||||||
<span class="status">0%</span>
|
<span class="inner" style="width: 0%"></span>
|
||||||
</span>
|
<span class="status">0%</span>
|
||||||
</div>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
`;
|
</div>
|
||||||
}
|
<span class="hint"></span>
|
||||||
|
`;
|
||||||
getThemeMusic() {
|
}
|
||||||
return null;
|
|
||||||
}
|
getThemeMusic() {
|
||||||
|
return null;
|
||||||
getHasFadeIn() {
|
}
|
||||||
return false;
|
|
||||||
}
|
getHasFadeIn() {
|
||||||
|
return false;
|
||||||
onEnter() {
|
}
|
||||||
this.htmlElement.classList.add("prefab_LoadingState");
|
|
||||||
|
onEnter() {
|
||||||
const elementsToRemove = ["#loadingPreload", "#fontPreload"];
|
this.htmlElement.classList.add("prefab_LoadingState");
|
||||||
for (let i = 0; i < elementsToRemove.length; ++i) {
|
|
||||||
const elem = document.querySelector(elementsToRemove[i]);
|
const elementsToRemove = ["#loadingPreload", "#fontPreload"];
|
||||||
if (elem) {
|
for (let i = 0; i < elementsToRemove.length; ++i) {
|
||||||
elem.remove();
|
const elem = document.querySelector(elementsToRemove[i]);
|
||||||
}
|
if (elem) {
|
||||||
}
|
elem.remove();
|
||||||
|
}
|
||||||
this.dialogs = new HUDModalDialogs(null, this.app);
|
}
|
||||||
const dialogsElement = document.body.querySelector(".modalDialogParent");
|
|
||||||
this.dialogs.initializeToElement(dialogsElement);
|
this.dialogs = new HUDModalDialogs(null, this.app);
|
||||||
|
const dialogsElement = document.body.querySelector(".modalDialogParent");
|
||||||
/** @type {HTMLElement} */
|
this.dialogs.initializeToElement(dialogsElement);
|
||||||
this.statusText = this.htmlElement.querySelector(".loadingStatus > .desc");
|
|
||||||
/** @type {HTMLElement} */
|
/** @type {HTMLElement} */
|
||||||
this.statusBar = this.htmlElement.querySelector(".loadingStatus > .bar > .inner");
|
this.statusText = this.htmlElement.querySelector(".loadingStatus > .desc");
|
||||||
/** @type {HTMLElement} */
|
/** @type {HTMLElement} */
|
||||||
this.statusBarText = this.htmlElement.querySelector(".loadingStatus > .bar > .status");
|
this.statusBar = this.htmlElement.querySelector(".loadingStatus > .bar > .inner");
|
||||||
|
/** @type {HTMLElement} */
|
||||||
this.currentStatus = "booting";
|
this.statusBarText = this.htmlElement.querySelector(".loadingStatus > .bar > .status");
|
||||||
this.currentIndex = 0;
|
|
||||||
|
/** @type {HTMLElement} */
|
||||||
this.startLoading();
|
this.hintsText = this.htmlElement.querySelector(".hint");
|
||||||
}
|
this.lastHintShown = -1000;
|
||||||
|
this.nextHintDuration = 0;
|
||||||
onLeave() {
|
|
||||||
// this.dialogs.cleanup();
|
this.currentStatus = "booting";
|
||||||
}
|
this.currentIndex = 0;
|
||||||
|
|
||||||
startLoading() {
|
this.startLoading();
|
||||||
this.setStatus("Booting")
|
}
|
||||||
|
|
||||||
.then(() => this.setStatus("Creating platform wrapper"))
|
onLeave() {
|
||||||
.then(() => this.app.platformWrapper.initialize())
|
// this.dialogs.cleanup();
|
||||||
|
}
|
||||||
.then(() => this.setStatus("Initializing local storage"))
|
|
||||||
.then(() => {
|
startLoading() {
|
||||||
const wrapper = this.app.platformWrapper;
|
this.setStatus("Booting")
|
||||||
if (wrapper instanceof PlatformWrapperImplBrowser) {
|
|
||||||
try {
|
.then(() => this.setStatus("Creating platform wrapper"))
|
||||||
window.localStorage.setItem("local_storage_test", "1");
|
.then(() => this.app.platformWrapper.initialize())
|
||||||
window.localStorage.removeItem("local_storage_test");
|
|
||||||
} catch (ex) {
|
.then(() => this.setStatus("Initializing local storage"))
|
||||||
logger.error("Failed to read/write local storage:", ex);
|
.then(() => {
|
||||||
return new Promise(() => {
|
const wrapper = this.app.platformWrapper;
|
||||||
alert(`Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n
|
if (wrapper instanceof PlatformWrapperImplBrowser) {
|
||||||
In Chrome this setting is called "Block third-party cookies and site data".\n\n
|
try {
|
||||||
Please allow third party cookies and then reload the page.`);
|
window.localStorage.setItem("local_storage_test", "1");
|
||||||
// Never return
|
window.localStorage.removeItem("local_storage_test");
|
||||||
});
|
} catch (ex) {
|
||||||
}
|
logger.error("Failed to read/write local storage:", ex);
|
||||||
}
|
return new Promise(() => {
|
||||||
})
|
alert(`Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n
|
||||||
|
In Chrome this setting is called "Block third-party cookies and site data".\n\n
|
||||||
.then(() => this.setStatus("Creating storage"))
|
Please allow third party cookies and then reload the page.`);
|
||||||
.then(() => {
|
// Never return
|
||||||
return this.app.storage.initialize();
|
});
|
||||||
})
|
}
|
||||||
|
}
|
||||||
.then(() => this.setStatus("Initializing libraries"))
|
})
|
||||||
.then(() => this.app.analytics.initialize())
|
|
||||||
.then(() => this.app.gameAnalytics.initialize())
|
.then(() => this.setStatus("Creating storage"))
|
||||||
|
.then(() => {
|
||||||
.then(() => this.setStatus("Initializing settings"))
|
return this.app.storage.initialize();
|
||||||
.then(() => {
|
})
|
||||||
return this.app.settings.initialize();
|
|
||||||
})
|
.then(() => this.setStatus("Initializing libraries"))
|
||||||
|
.then(() => this.app.analytics.initialize())
|
||||||
.then(() => {
|
.then(() => this.app.gameAnalytics.initialize())
|
||||||
// Initialize fullscreen
|
|
||||||
if (this.app.platformWrapper.getSupportsFullscreen()) {
|
.then(() => this.setStatus("Initializing settings"))
|
||||||
this.app.platformWrapper.setFullscreen(this.app.settings.getIsFullScreen());
|
.then(() => {
|
||||||
}
|
return this.app.settings.initialize();
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(() => this.setStatus("Initializing language"))
|
.then(() => {
|
||||||
.then(() => {
|
// Initialize fullscreen
|
||||||
if (this.app.settings.getLanguage() === "auto-detect") {
|
if (this.app.platformWrapper.getSupportsFullscreen()) {
|
||||||
const language = autoDetectLanguageId();
|
this.app.platformWrapper.setFullscreen(this.app.settings.getIsFullScreen());
|
||||||
logger.log("Setting language to", language);
|
}
|
||||||
return this.app.settings.updateLanguage(language);
|
})
|
||||||
}
|
|
||||||
})
|
.then(() => this.setStatus("Initializing language"))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const language = this.app.settings.getLanguage();
|
if (this.app.settings.getLanguage() === "auto-detect") {
|
||||||
updateApplicationLanguage(language);
|
const language = autoDetectLanguageId();
|
||||||
})
|
logger.log("Setting language to", language);
|
||||||
|
return this.app.settings.updateLanguage(language);
|
||||||
.then(() => this.setStatus("Initializing sounds"))
|
}
|
||||||
.then(() => {
|
})
|
||||||
// Notice: We don't await the sounds loading itself
|
.then(() => {
|
||||||
return this.app.sound.initialize();
|
const language = this.app.settings.getLanguage();
|
||||||
})
|
updateApplicationLanguage(language);
|
||||||
|
})
|
||||||
.then(() => {
|
|
||||||
this.app.backgroundResourceLoader.startLoading();
|
.then(() => this.setStatus("Initializing sounds"))
|
||||||
})
|
.then(() => {
|
||||||
|
// Notice: We don't await the sounds loading itself
|
||||||
.then(() => this.setStatus("Initializing savegame"))
|
return this.app.sound.initialize();
|
||||||
.then(() => {
|
})
|
||||||
return this.app.savegameMgr.initialize().catch(err => {
|
|
||||||
logger.error("Failed to initialize savegames:", err);
|
.then(() => {
|
||||||
alert(
|
this.app.backgroundResourceLoader.startLoading();
|
||||||
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
|
})
|
||||||
);
|
|
||||||
return this.app.savegameMgr.writeAsync();
|
.then(() => this.setStatus("Initializing savegame"))
|
||||||
});
|
.then(() => {
|
||||||
})
|
return this.app.savegameMgr.initialize().catch(err => {
|
||||||
|
logger.error("Failed to initialize savegames:", err);
|
||||||
.then(() => this.setStatus("Downloading resources"))
|
alert(
|
||||||
.then(() => {
|
"Your savegames failed to load, it seems your data files got corrupted. I'm so sorry!\n\n(This can happen if your pc crashed while a game was saved).\n\nYou can try re-importing your savegames."
|
||||||
return this.app.backgroundResourceLoader.getPromiseForBareGame();
|
);
|
||||||
})
|
return this.app.savegameMgr.writeAsync();
|
||||||
|
});
|
||||||
.then(() => this.setStatus("Checking changelog"))
|
})
|
||||||
.then(() => {
|
|
||||||
if (G_IS_DEV && globalConfig.debug.disableUpgradeNotification) {
|
.then(() => this.setStatus("Downloading resources"))
|
||||||
return;
|
.then(() => {
|
||||||
}
|
return this.app.backgroundResourceLoader.getPromiseForBareGame();
|
||||||
|
})
|
||||||
return this.app.storage
|
|
||||||
.readFileAsync("lastversion.bin")
|
.then(() => this.setStatus("Checking changelog"))
|
||||||
.catch(err => {
|
.then(() => {
|
||||||
logger.warn("Failed to read lastversion:", err);
|
if (G_IS_DEV && globalConfig.debug.disableUpgradeNotification) {
|
||||||
return G_BUILD_VERSION;
|
return;
|
||||||
})
|
}
|
||||||
.then(version => {
|
|
||||||
logger.log("Last version:", version, "App version:", G_BUILD_VERSION);
|
return this.app.storage
|
||||||
this.app.storage.writeFileAsync("lastversion.bin", G_BUILD_VERSION);
|
.readFileAsync("lastversion.bin")
|
||||||
return version;
|
.catch(err => {
|
||||||
})
|
logger.warn("Failed to read lastversion:", err);
|
||||||
.then(version => {
|
return G_BUILD_VERSION;
|
||||||
let changelogEntries = [];
|
})
|
||||||
logger.log("Last seen version:", version);
|
.then(version => {
|
||||||
|
logger.log("Last version:", version, "App version:", G_BUILD_VERSION);
|
||||||
for (let i = 0; i < CHANGELOG.length; ++i) {
|
this.app.storage.writeFileAsync("lastversion.bin", G_BUILD_VERSION);
|
||||||
if (CHANGELOG[i].version === version) {
|
return version;
|
||||||
break;
|
})
|
||||||
}
|
.then(version => {
|
||||||
changelogEntries.push(CHANGELOG[i]);
|
let changelogEntries = [];
|
||||||
}
|
logger.log("Last seen version:", version);
|
||||||
if (changelogEntries.length === 0) {
|
|
||||||
return;
|
for (let i = 0; i < CHANGELOG.length; ++i) {
|
||||||
}
|
if (CHANGELOG[i].version === version) {
|
||||||
|
break;
|
||||||
let dialogHtml = T.dialogs.updateSummary.desc;
|
}
|
||||||
for (let i = 0; i < changelogEntries.length; ++i) {
|
changelogEntries.push(CHANGELOG[i]);
|
||||||
const entry = changelogEntries[i];
|
}
|
||||||
dialogHtml += `
|
if (changelogEntries.length === 0) {
|
||||||
<div class="changelogDialogEntry">
|
return;
|
||||||
<span class="version">${entry.version}</span>
|
}
|
||||||
<span class="date">${entry.date}</span>
|
|
||||||
<ul class="changes">
|
let dialogHtml = T.dialogs.updateSummary.desc;
|
||||||
${entry.entries.map(text => `<li>${text}</li>`).join("")}
|
for (let i = 0; i < changelogEntries.length; ++i) {
|
||||||
</ul>
|
const entry = changelogEntries[i];
|
||||||
</div>
|
dialogHtml += `
|
||||||
`;
|
<div class="changelogDialogEntry">
|
||||||
}
|
<span class="version">${entry.version}</span>
|
||||||
|
<span class="date">${entry.date}</span>
|
||||||
return new Promise(resolve => {
|
<ul class="changes">
|
||||||
this.dialogs.showInfo(T.dialogs.updateSummary.title, dialogHtml).ok.add(resolve);
|
${entry.entries.map(text => `<li>${text}</li>`).join("")}
|
||||||
});
|
</ul>
|
||||||
});
|
</div>
|
||||||
})
|
`;
|
||||||
|
}
|
||||||
.then(() => this.setStatus("Launching"))
|
|
||||||
.then(
|
return new Promise(resolve => {
|
||||||
() => {
|
this.dialogs.showInfo(T.dialogs.updateSummary.title, dialogHtml).ok.add(resolve);
|
||||||
this.moveToState("MainMenuState");
|
});
|
||||||
},
|
});
|
||||||
err => {
|
})
|
||||||
this.showFailMessage(err);
|
|
||||||
}
|
.then(() => this.setStatus("Launching"))
|
||||||
);
|
.then(
|
||||||
}
|
() => {
|
||||||
|
this.moveToState("MainMenuState");
|
||||||
setStatus(text) {
|
},
|
||||||
logger.log("✅ " + text);
|
err => {
|
||||||
this.currentIndex += 1;
|
this.showFailMessage(err);
|
||||||
this.currentStatus = text;
|
}
|
||||||
this.statusText.innerText = text;
|
);
|
||||||
|
}
|
||||||
const numSteps = 10; // FIXME
|
|
||||||
|
update() {
|
||||||
const percentage = (this.currentIndex / numSteps) * 100.0;
|
const now = performance.now();
|
||||||
this.statusBar.style.width = percentage + "%";
|
if (now - this.lastHintShown > this.nextHintDuration) {
|
||||||
this.statusBarText.innerText = findNiceValue(percentage) + "%";
|
this.lastHintShown = now;
|
||||||
|
const hintText = getRandomHint();
|
||||||
return Promise.resolve();
|
|
||||||
}
|
this.hintsText.innerHTML = hintText;
|
||||||
|
|
||||||
showFailMessage(text) {
|
/**
|
||||||
logger.error("App init failed:", text);
|
* Compute how long the user will need to read the hint.
|
||||||
|
* We calculate with 130 words per minute, with an average of 5 chars
|
||||||
const email = "bugs@shapez.io";
|
* that is 650 characters / minute
|
||||||
|
*/
|
||||||
const subElement = document.createElement("div");
|
this.nextHintDuration = Math.max(2500, (hintText.length / 650) * 60 * 1000);
|
||||||
subElement.classList.add("failureBox");
|
}
|
||||||
|
}
|
||||||
subElement.innerHTML = `
|
|
||||||
<div class="logo">
|
onRender() {
|
||||||
<img src="${cachebust("res/logo.png")}" alt="Shapez.io Logo">
|
this.update();
|
||||||
</div>
|
}
|
||||||
<div class="failureInner">
|
|
||||||
<div class="errorHeader">
|
onBackgroundTick() {
|
||||||
Failed to initialize application!
|
this.update();
|
||||||
</div>
|
}
|
||||||
<div class="errorMessage">
|
|
||||||
${this.currentStatus} failed:<br/>
|
/**
|
||||||
${text}
|
*
|
||||||
</div>
|
* @param {string} text
|
||||||
|
*/
|
||||||
<div class="supportHelp">
|
setStatus(text) {
|
||||||
Please send me an email with steps to reproduce and what you did before this happened:
|
logger.log("✅ " + text);
|
||||||
<br /><a class="email" href="mailto:${email}?subject=App%20does%20not%20launch">${email}</a>
|
this.currentIndex += 1;
|
||||||
</div>
|
this.currentStatus = text;
|
||||||
|
this.statusText.innerText = text;
|
||||||
<div class="lower">
|
|
||||||
<button class="resetApp styledButton">Reset App</button>
|
const numSteps = 10; // FIXME
|
||||||
<i>Build ${G_BUILD_VERSION} @ ${G_BUILD_COMMIT_HASH}</i>
|
|
||||||
</div>
|
const percentage = (this.currentIndex / numSteps) * 100.0;
|
||||||
</div>
|
this.statusBar.style.width = percentage + "%";
|
||||||
`;
|
this.statusBarText.innerText = findNiceValue(percentage) + "%";
|
||||||
|
|
||||||
this.htmlElement.classList.add("failure");
|
return Promise.resolve();
|
||||||
this.htmlElement.appendChild(subElement);
|
}
|
||||||
|
|
||||||
const resetBtn = subElement.querySelector("button.resetApp");
|
showFailMessage(text) {
|
||||||
this.trackClicks(resetBtn, this.showResetConfirm);
|
logger.error("App init failed:", text);
|
||||||
}
|
|
||||||
|
const email = "bugs@shapez.io";
|
||||||
showResetConfirm() {
|
|
||||||
if (confirm("Are you sure you want to reset the app? This will delete all your savegames")) {
|
const subElement = document.createElement("div");
|
||||||
this.resetApp();
|
subElement.classList.add("failureBox");
|
||||||
}
|
|
||||||
}
|
subElement.innerHTML = `
|
||||||
|
<div class="logo">
|
||||||
resetApp() {
|
<img src="${cachebust("res/logo.png")}" alt="Shapez.io Logo">
|
||||||
this.app.settings
|
</div>
|
||||||
.resetEverythingAsync()
|
<div class="failureInner">
|
||||||
.then(() => {
|
<div class="errorHeader">
|
||||||
this.app.savegameMgr.resetEverythingAsync();
|
Failed to initialize application!
|
||||||
})
|
</div>
|
||||||
.then(() => {
|
<div class="errorMessage">
|
||||||
this.app.settings.resetEverythingAsync();
|
${this.currentStatus} failed:<br/>
|
||||||
})
|
${text}
|
||||||
.then(() => {
|
</div>
|
||||||
window.location.reload();
|
|
||||||
});
|
<div class="supportHelp">
|
||||||
}
|
Please send me an email with steps to reproduce and what you did before this happened:
|
||||||
}
|
<br /><a class="email" href="mailto:${email}?subject=App%20does%20not%20launch">${email}</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="lower">
|
||||||
|
<button class="resetApp styledButton">Reset App</button>
|
||||||
|
<i>Build ${G_BUILD_VERSION} @ ${G_BUILD_COMMIT_HASH}</i>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
this.htmlElement.classList.add("failure");
|
||||||
|
this.htmlElement.appendChild(subElement);
|
||||||
|
|
||||||
|
const resetBtn = subElement.querySelector("button.resetApp");
|
||||||
|
this.trackClicks(resetBtn, this.showResetConfirm);
|
||||||
|
|
||||||
|
this.hintsText.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
showResetConfirm() {
|
||||||
|
if (confirm("Are you sure you want to reset the app? This will delete all your savegames!")) {
|
||||||
|
this.resetApp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetApp() {
|
||||||
|
this.app.settings
|
||||||
|
.resetEverythingAsync()
|
||||||
|
.then(() => {
|
||||||
|
this.app.savegameMgr.resetEverythingAsync();
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.app.settings.resetEverythingAsync();
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
window.location.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ The base language is English and can be found [here](base-en.yaml).
|
|||||||
|
|
||||||
## Editing existing translations
|
## Editing existing translations
|
||||||
|
|
||||||
If you want to edit an existing translation (Fixing typos, Updating it to a newer version, etc), you can just use the github file editor to edit the file.
|
If you want to edit an existing translation (Fixing typos, updating it to a newer version, etc), you can just use the github file editor to edit the file.
|
||||||
|
|
||||||
- Click the language you want to edit from the list above
|
- Click the language you want to edit from the list above
|
||||||
- Click the small "edit" symbol on the top right
|
- Click the small "edit" symbol on the top right
|
||||||
@ -61,6 +61,8 @@ If you want to edit an existing translation (Fixing typos, Updating it to a newe
|
|||||||
|
|
||||||
Please DM me on Discord (tobspr#5407), so I can add the language template for you.
|
Please DM me on Discord (tobspr#5407), so I can add the language template for you.
|
||||||
|
|
||||||
|
**Important: I am currently not accepting new languages until the wires update is out!**
|
||||||
|
|
||||||
Please use the following template:
|
Please use the following template:
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -77,4 +79,4 @@ PS: I'm super busy, but I'll give my best to do it quickly!
|
|||||||
|
|
||||||
## Updating a language to the latest version
|
## Updating a language to the latest version
|
||||||
|
|
||||||
Run `yarn syncTranslations` in the root directory to synchronize all translations to the latest version! This will remove obsolete keys and add newly added keys. (Run `yarn` before to install packes).
|
Run `yarn syncTranslations` in the root directory to synchronize all translations to the latest version! This will remove obsolete keys and add newly added keys. (Run `yarn` before to install packages).
|
||||||
|
|||||||
@ -66,7 +66,7 @@ steamPage:
|
|||||||
[*] Verschiedene Karten und Herausforderungen (z.B. Karten mit Hindernissen)
|
[*] Verschiedene Karten und Herausforderungen (z.B. Karten mit Hindernissen)
|
||||||
[*] Puzzle (Liefere die geforderte Form mit begrenztem Platz/limitierten Gebäuden)
|
[*] Puzzle (Liefere die geforderte Form mit begrenztem Platz/limitierten Gebäuden)
|
||||||
[*] Eine Kampagne mit Gebäudekosten
|
[*] Eine Kampagne mit Gebäudekosten
|
||||||
[*] Konfigurierbarer Kartengenerator (Ändere die Grösse/Anzahl/Dichte der Ressourcenflecken, den Seed und viel mehr)
|
[*] Konfigurierbarer Kartengenerator (Ändere die Grösse/Anzahl/Dichte der Ressourcenflecken, den Seed und vieles mehr)
|
||||||
[*] Mehr Formentypen
|
[*] Mehr Formentypen
|
||||||
[*] Performanceverbesserungen (Das Spiel läuft bereits sehr gut!)
|
[*] Performanceverbesserungen (Das Spiel läuft bereits sehr gut!)
|
||||||
[*] Und vieles mehr!
|
[*] Und vieles mehr!
|
||||||
@ -256,7 +256,7 @@ dialogs:
|
|||||||
title: Nützliche Hotkeys
|
title: Nützliche Hotkeys
|
||||||
desc: >-
|
desc: >-
|
||||||
Dieses Spiel hat viele Hotkeys, die den Bau von Fabriken vereinfachen und beschleunigen.
|
Dieses Spiel hat viele Hotkeys, die den Bau von Fabriken vereinfachen und beschleunigen.
|
||||||
Hier sind ein paar, aber prüfe am besten die <strong>Tastenbelegung-Einstellungen</strong>!<br><br>
|
Hier sind ein paar Beispiele, aber prüfe am besten die <strong>Tastenbelegung-Einstellungen</strong>!<br><br>
|
||||||
<code class='keybinding'>STRG</code> + Ziehen: Wähle Areal aus.<br>
|
<code class='keybinding'>STRG</code> + Ziehen: Wähle Areal aus.<br>
|
||||||
<code class='keybinding'>UMSCH</code>: Halten, um mehrere Gebäude zu platzieren.<br>
|
<code class='keybinding'>UMSCH</code>: Halten, um mehrere Gebäude zu platzieren.<br>
|
||||||
<code class='keybinding'>ALT</code>: Invertiere die Platzierungsrichtung der Förderbänder.<br>
|
<code class='keybinding'>ALT</code>: Invertiere die Platzierungsrichtung der Förderbänder.<br>
|
||||||
@ -635,7 +635,7 @@ storyRewards:
|
|||||||
no_reward:
|
no_reward:
|
||||||
title: Nächstes Level
|
title: Nächstes Level
|
||||||
desc: >-
|
desc: >-
|
||||||
Dieses Level hat dir keine Belohnung gegeben, aber dafür das Nächste schon! <br><br> PS: Denke daran, deine alten Fabriken nicht zu zerstören - Du wirst sie später <strong>alle</strong> noch brauchen, um <strong>Upgrades freizuschalten</strong>!
|
Dieses Level hat dir keine Belohnung gegeben, aber im Nächsten gibt es eine! <br><br> PS: Denke daran, deine alten Fabriken nicht zu zerstören - Du wirst sie später <strong>alle</strong> noch brauchen, um <strong>Upgrades freizuschalten</strong>!
|
||||||
|
|
||||||
no_reward_freeplay:
|
no_reward_freeplay:
|
||||||
title: Nächstes Level
|
title: Nächstes Level
|
||||||
@ -694,7 +694,7 @@ settings:
|
|||||||
movementSpeed:
|
movementSpeed:
|
||||||
title: Bewegungsgeschwindigkeit
|
title: Bewegungsgeschwindigkeit
|
||||||
description: >-
|
description: >-
|
||||||
Ändert die Geschwindigkeit, mit der der Bildschirm durch die Pfeiltasten bewegt wird.
|
Ändert die Geschwindigkeit, mit welcher der Bildschirm durch die Pfeiltasten bewegt wird.
|
||||||
speeds:
|
speeds:
|
||||||
super_slow: Sehr langsam
|
super_slow: Sehr langsam
|
||||||
slow: Langsam
|
slow: Langsam
|
||||||
@ -711,7 +711,7 @@ settings:
|
|||||||
enableColorBlindHelper:
|
enableColorBlindHelper:
|
||||||
title: Modus für Farbenblinde
|
title: Modus für Farbenblinde
|
||||||
description: >-
|
description: >-
|
||||||
Aktiviert verschiedene Werkzeuge, die dir das Spielen trotz Farbenblindheit ermöglichen.
|
Aktiviert verschiedene Werkzeuge, welche dir das Spielen trotz Farbenblindheit ermöglichen.
|
||||||
|
|
||||||
fullscreen:
|
fullscreen:
|
||||||
title: Vollbild
|
title: Vollbild
|
||||||
@ -775,7 +775,7 @@ settings:
|
|||||||
rotationByBuilding:
|
rotationByBuilding:
|
||||||
title: Rotation pro Gebäudetyp
|
title: Rotation pro Gebäudetyp
|
||||||
description: >-
|
description: >-
|
||||||
Jeder Gebäudetyp merkt sich einzeln, in welche Richtung er zeigt.
|
Jeder Gebäudetyp merkt sich eigenständig, in welche Richtung er zeigt.
|
||||||
Das fühlt sich möglicherweise besser an, wenn du häufig zwischen verschiedenen Gebäudetypen wechselst.
|
Das fühlt sich möglicherweise besser an, wenn du häufig zwischen verschiedenen Gebäudetypen wechselst.
|
||||||
|
|
||||||
compactBuildingInfo:
|
compactBuildingInfo:
|
||||||
@ -786,7 +786,7 @@ settings:
|
|||||||
disableCutDeleteWarnings:
|
disableCutDeleteWarnings:
|
||||||
title: Deaktiviere Warnungsdialog beim Löschen
|
title: Deaktiviere Warnungsdialog beim Löschen
|
||||||
description: >-
|
description: >-
|
||||||
Deaktiviert die Warnung, die beim Löschen und Ausschneiden von mehr als 100 Feldern angezeigt wird.
|
Deaktiviert die Warnung, welche beim Löschen und Ausschneiden von mehr als 100 Feldern angezeigt wird.
|
||||||
|
|
||||||
keybindings:
|
keybindings:
|
||||||
title: Tastenbelegung
|
title: Tastenbelegung
|
||||||
|
|||||||
@ -898,6 +898,11 @@ settings:
|
|||||||
description: >-
|
description: >-
|
||||||
Enabled by default, selects the miner if you use the pipette when hovering a resource patch.
|
Enabled by default, selects the miner if you use the pipette when hovering a resource patch.
|
||||||
|
|
||||||
|
simplifiedBelts:
|
||||||
|
title: Simplified Belts (Ugly)
|
||||||
|
description: >-
|
||||||
|
Does not render belt items except when hovering the belt, to save performance.
|
||||||
|
|
||||||
keybindings:
|
keybindings:
|
||||||
title: Keybindings
|
title: Keybindings
|
||||||
hint: >-
|
hint: >-
|
||||||
@ -1004,3 +1009,53 @@ demo:
|
|||||||
exportingBase: Exporting whole Base as Image
|
exportingBase: Exporting whole Base as Image
|
||||||
|
|
||||||
settingNotAvailable: Not available in the demo.
|
settingNotAvailable: Not available in the demo.
|
||||||
|
|
||||||
|
tips:
|
||||||
|
- The hub accepts input of any kind, not just the current shape!
|
||||||
|
- Make sure your factories are stackable - it will pay out!
|
||||||
|
- Don't build too close to the hub, or it will be a huge chaos!
|
||||||
|
- If stacking does not work, try switching the inputs.
|
||||||
|
- You can toggle the belt planner direction by pressing <b>R</b>.
|
||||||
|
- Holding <b>CTRL</b> allows dragging of belts without auto-orientation.
|
||||||
|
- Ratios stay the same, as long as all upgrades are on the same Tier.
|
||||||
|
- Serial execution is more efficient than parallel.
|
||||||
|
- You will unlock more variants of buildings later in the game!
|
||||||
|
- You can use <b>T</b> to switch between different variants.
|
||||||
|
- Symmetry is key!
|
||||||
|
- You can weave different tiers of tunnels.
|
||||||
|
- Try to build compact factories - it will pay out!
|
||||||
|
- The painter has a mirrored variant which you can select with <b>T</b>
|
||||||
|
- Having the right building ratios will maximize efficiency.
|
||||||
|
- At maximum level, 5 extractors will fill a single belt.
|
||||||
|
- Don't forget about tunnels!
|
||||||
|
- You don't need to divide up items evenly for full efficiency.
|
||||||
|
- Holding <b>SHIFT</b> will activate the belt planner, letting you place long lines of belts easily.
|
||||||
|
- Cutters always cut vertically, regardless of their orientation.
|
||||||
|
- To get white mix all three colors.
|
||||||
|
- The storage buffer priorities the first output.
|
||||||
|
- Invest time to build repeatable designs - it's worth it!
|
||||||
|
- Holding <b>CTRL</b> allows to place multiple buildings.
|
||||||
|
- You can hold <b>ALT</b> to invert the direction of placed belts.
|
||||||
|
- Efficiency is key!
|
||||||
|
- Shape patches that are further away from the hub are more complex.
|
||||||
|
- Machines have a limited speed, divide them up for maximum efficiency.
|
||||||
|
- Use balancers to maximize your efficiency.
|
||||||
|
- Organization is important. Try not to cross conveyors too much.
|
||||||
|
- Plan in advance, or it will be a huge chaos!
|
||||||
|
- Don't remove your old factories! You'll need them to unlock upgrades.
|
||||||
|
- Try beating level 18 on your own before seeking for help!
|
||||||
|
- Don't complicate things, try to stay simple and you'll go far.
|
||||||
|
- You may need to re-use factories later in the game. Plan your factories to be re-usable.
|
||||||
|
- Sometimes, you can find a needed shape in the map without creating it with stackers.
|
||||||
|
- Full windmills / pinwheels can never spawn naturally.
|
||||||
|
- Color your shapes before cutting for maximum efficiency.
|
||||||
|
- With modules, space is merely a perception; a concern for mortal men.
|
||||||
|
- Make a separate blueprint factory. They're important for modules.
|
||||||
|
- Have a closer look on the color mixer, and your questions will be answered.
|
||||||
|
- Use <b>CTRL</b> + Click to select an area.
|
||||||
|
- Building too close to the hub can get in the way of later projects.
|
||||||
|
- The pin icon next to each shape in the upgrade list pins it to the screen.
|
||||||
|
- Mix all primary colours together to make white!
|
||||||
|
- You have an infinite map, don't cramp your factory, expand!
|
||||||
|
- Also try Factorio! It's my favourite game.
|
||||||
|
- The quad cutter cuts clockwise starting from the top right!
|
||||||
|
|||||||
@ -168,7 +168,7 @@ dialogs:
|
|||||||
deleteGame: Tiedän mitä olen tekemässä
|
deleteGame: Tiedän mitä olen tekemässä
|
||||||
viewUpdate: Näytä päivitys
|
viewUpdate: Näytä päivitys
|
||||||
showUpgrades: Näytä Päivitykset
|
showUpgrades: Näytä Päivitykset
|
||||||
showKeybindings: Show Keybindings
|
showKeybindings: Näytä pikanäppäimet
|
||||||
|
|
||||||
importSavegameError:
|
importSavegameError:
|
||||||
title: Tuonti Virhe
|
title: Tuonti Virhe
|
||||||
@ -258,7 +258,7 @@ dialogs:
|
|||||||
createMarker:
|
createMarker:
|
||||||
title: Uusi Merkki
|
title: Uusi Merkki
|
||||||
desc: Anna merkille kuvaava nimi, voit myös sisällyttää muodon <strong>lyhyen avaimen</strong> siihen. (Lyhyen avaimen voit luoda <a href="https://viewer.shapez.io" target="_blank">täällä</a>)
|
desc: Anna merkille kuvaava nimi, voit myös sisällyttää muodon <strong>lyhyen avaimen</strong> siihen. (Lyhyen avaimen voit luoda <a href="https://viewer.shapez.io" target="_blank">täällä</a>)
|
||||||
titleEdit: Edit Marker
|
titleEdit: Muokkaa merkkiä
|
||||||
|
|
||||||
markerDemoLimit:
|
markerDemoLimit:
|
||||||
desc: Voit tehdä vain kaksi mukautettua merkkiä demoversiossa. Hanki itsenäinen versio saadaksesi loputtoman määrän merkkejä!
|
desc: Voit tehdä vain kaksi mukautettua merkkiä demoversiossa. Hanki itsenäinen versio saadaksesi loputtoman määrän merkkejä!
|
||||||
@ -267,8 +267,8 @@ dialogs:
|
|||||||
title: Vie kuvakaappaus
|
title: Vie kuvakaappaus
|
||||||
desc: Pyysit tukikohtasi viemistä kuvakaappauksena. Huomaa, että tämä voi olla melko hidasta isolla tukikohdalla ja voi jopa kaataa pelisi!
|
desc: Pyysit tukikohtasi viemistä kuvakaappauksena. Huomaa, että tämä voi olla melko hidasta isolla tukikohdalla ja voi jopa kaataa pelisi!
|
||||||
massCutInsufficientConfirm:
|
massCutInsufficientConfirm:
|
||||||
title: Confirm cut
|
title: Vahvista leikkaus
|
||||||
desc: You can not afford to paste this area! Are you sure you want to cut it?
|
desc: Sinulla ei ole varaa leikata tätä aluetta! Oletko varma että haluat leikata sen?
|
||||||
|
|
||||||
ingame:
|
ingame:
|
||||||
# This is shown in the top left corner and displays useful keybindings in
|
# This is shown in the top left corner and displays useful keybindings in
|
||||||
@ -303,8 +303,8 @@ ingame:
|
|||||||
purple: Violetti
|
purple: Violetti
|
||||||
cyan: Syaani
|
cyan: Syaani
|
||||||
white: Valkoinen
|
white: Valkoinen
|
||||||
uncolored: Ei Väriä
|
uncolored: Väritön
|
||||||
black: Black
|
black: Musta
|
||||||
|
|
||||||
# Everything related to placing buildings (I.e. as soon as you selected a building
|
# Everything related to placing buildings (I.e. as soon as you selected a building
|
||||||
# from the toolbar)
|
# from the toolbar)
|
||||||
@ -465,7 +465,7 @@ buildings:
|
|||||||
|
|
||||||
tier2:
|
tier2:
|
||||||
name: Tunneli Taso II
|
name: Tunneli Taso II
|
||||||
description: Sallii resurssien kuljetuksen rakennuksien ja hihnojen alta.
|
description: Sallii resurssien kuljetuksen rakennuksien ja hihnojen alta pidemmältä kantamalta.
|
||||||
|
|
||||||
splitter: # Internal name for the Balancer
|
splitter: # Internal name for the Balancer
|
||||||
default:
|
default:
|
||||||
@ -498,11 +498,11 @@ buildings:
|
|||||||
name: &rotater Kääntäjä
|
name: &rotater Kääntäjä
|
||||||
description: Kääntää muotoja 90 astetta myötäpäivään.
|
description: Kääntää muotoja 90 astetta myötäpäivään.
|
||||||
ccw:
|
ccw:
|
||||||
name: Rotate (Vastapäivään)
|
name: Kääntäjä (Vastapäivään)
|
||||||
description: Kääntää muotoja 90 astetta vastapäivään.
|
description: Kääntää muotoja 90 astetta vastapäivään.
|
||||||
fl:
|
fl:
|
||||||
name: Rotate (180)
|
name: Kääntäkä (180)
|
||||||
description: Rotates shapes by 180 degrees.
|
description: Kääntää muotoja 180 astetta.
|
||||||
|
|
||||||
stacker:
|
stacker:
|
||||||
default:
|
default:
|
||||||
@ -550,11 +550,11 @@ buildings:
|
|||||||
description: Tuottaa sähköä kuluttamalla muotoja. Jokainen sähkögeneraattori vaatii eri muotoja.
|
description: Tuottaa sähköä kuluttamalla muotoja. Jokainen sähkögeneraattori vaatii eri muotoja.
|
||||||
wire_crossings:
|
wire_crossings:
|
||||||
default:
|
default:
|
||||||
name: Wire Splitter
|
name: Johdon jakaja
|
||||||
description: Splits a energy wire into two.
|
description: Jakaa energiajohdon kahteen.
|
||||||
merger:
|
merger:
|
||||||
name: Wire Merger
|
name: Johtojen yhdistäjä
|
||||||
description: Merges two energy wires into one.
|
description: Yhdistää kaksi energiajohtoa yhteen.
|
||||||
|
|
||||||
storyRewards:
|
storyRewards:
|
||||||
# Those are the rewards gained from completing the store
|
# Those are the rewards gained from completing the store
|
||||||
@ -642,9 +642,9 @@ storyRewards:
|
|||||||
settings:
|
settings:
|
||||||
title: Asetukset
|
title: Asetukset
|
||||||
categories:
|
categories:
|
||||||
general: General
|
general: Yleinen
|
||||||
userInterface: User Interface
|
userInterface: Käyttöliittyma
|
||||||
advanced: Advanced
|
advanced: Kehittynyt
|
||||||
|
|
||||||
versionBadges:
|
versionBadges:
|
||||||
dev: Kehitys
|
dev: Kehitys
|
||||||
@ -736,17 +736,17 @@ settings:
|
|||||||
refreshRate:
|
refreshRate:
|
||||||
title: Simulaatiotavoite
|
title: Simulaatiotavoite
|
||||||
description: >-
|
description: >-
|
||||||
Jos sinulla on 144hz näyttö, muuta virkistystaajuus täällä jotta pelin simulaatio toimii oikein isommilla virkistystaajuuksilla. Tämä voi laskea FPS nopeutta jos tietokoneesi on liian hidas.
|
Jos sinulla on 144hz näyttö, muuta virkistystaajuus täällä jotta pelin simulaatio toimii oikein isommilla virkistystaajuuksilla. Tämä voi laskea FPS nopeutta, jos tietokoneesi on liian hidas.
|
||||||
|
|
||||||
alwaysMultiplace:
|
alwaysMultiplace:
|
||||||
title: Monisijoitus
|
title: Monisijoitus
|
||||||
description: >-
|
description: >-
|
||||||
Jos käytössä, kaikki rakennukset pysyvät valittuina sijoittamisen jälkeen kunnes peruutat sen. Tämä vastaa SHIFT:in pitämistö pohjassa ikuisesti.
|
Jos käytössä, kaikki rakennukset pysyvät valittuina sijoittamisen jälkeen kunnes peruutat sen. Tämä vastaa SHIFT:in pitämistä pohjassa ikuisesti.
|
||||||
|
|
||||||
offerHints:
|
offerHints:
|
||||||
title: Vihjeet & Oppaat
|
title: Vihjeet & Oppaat
|
||||||
description: >-
|
description: >-
|
||||||
Tarjotaanko pelaamisen aikana vihjeitä ja oppaita. Myös piilottaa tietyt käyttöliittymäelementit tietyn tason mukaan, jotta alkuunpääseminen olisi helpompaa.
|
Tarjoaa pelaamisen aikana vihjeitä ja oppaita. Myös piilottaa tietyt käyttöliittymäelementit tietyn tason mukaan, jotta alkuunpääseminen olisi helpompaa.
|
||||||
|
|
||||||
enableTunnelSmartplace:
|
enableTunnelSmartplace:
|
||||||
title: Älykkäät Tunnelit
|
title: Älykkäät Tunnelit
|
||||||
@ -771,12 +771,12 @@ settings:
|
|||||||
disableCutDeleteWarnings:
|
disableCutDeleteWarnings:
|
||||||
title: Poista Leikkaus/Poisto Varoitukset
|
title: Poista Leikkaus/Poisto Varoitukset
|
||||||
description: >-
|
description: >-
|
||||||
Poista varoitusikkunat dialogs brought up when cutting/deleting more than 100 entities.
|
Poista varoitusikkunat jotka ilmestyy kun leikkaat/poistat enemmän kuin 100 entiteettiä
|
||||||
|
|
||||||
keybindings:
|
keybindings:
|
||||||
title: Pikanäppäimet
|
title: Pikanäppäimet
|
||||||
hint: >-
|
hint: >-
|
||||||
Tip: Muista käyttää CTRL, VAIHTO and ALT! Ne ottavat käyttöön erilaisia sijoitteluvaihtoehtoja.
|
Tip: Muista käyttää CTRL, VAIHTO ja ALT! Ne ottavat käyttöön erilaisia sijoitteluvaihtoehtoja.
|
||||||
|
|
||||||
resetKeybindings: Nollaa Pikanäppäimet
|
resetKeybindings: Nollaa Pikanäppäimet
|
||||||
|
|
||||||
@ -843,13 +843,13 @@ keybindings:
|
|||||||
|
|
||||||
placementDisableAutoOrientation: Poista automaattinen suunta käytöstä
|
placementDisableAutoOrientation: Poista automaattinen suunta käytöstä
|
||||||
placeMultiple: Pysy sijoittamistilassa
|
placeMultiple: Pysy sijoittamistilassa
|
||||||
placeInverse: Käännä automaattinen hihnan suunta
|
placeInverse: Käännä automaattinen hihnan suunta päinvastoin
|
||||||
menuClose: Close Menu
|
menuClose: Sulje valikko
|
||||||
|
|
||||||
about:
|
about:
|
||||||
title: Tietoja tästä pelistä
|
title: Tietoja tästä pelistä
|
||||||
body: >-
|
body: >-
|
||||||
Tämä peli on avoimen lähdekoodin ja kehitettä on <a href="https://github.com/tobspr" target="_blank">Tobias Springer</a> (tämä on minä).<br><br>
|
Tämä peli on avointa lähdekoodia ja kehittäjä on <a href="https://github.com/tobspr" target="_blank">Tobias Springer</a> (tämä on minä).<br><br>
|
||||||
|
|
||||||
Jos haluat osallistua, tarkista <a href="<githublink>" target="_blank">shapez.io githubissa</a>.<br><br>
|
Jos haluat osallistua, tarkista <a href="<githublink>" target="_blank">shapez.io githubissa</a>.<br><br>
|
||||||
|
|
||||||
|
|||||||
@ -32,15 +32,15 @@ steamPage:
|
|||||||
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
||||||
|
|
||||||
shapez.io est un jeu dans lequel vous devrez construire des usines pour automatiser la création et la combinaison de formes de plus en plus complexes sur une carte infinie.
|
shapez.io est un jeu dans lequel vous devrez construire des usines pour automatiser la création et la combinaison de formes de plus en plus complexes sur une carte infinie.
|
||||||
Lors de la livraison des formes requises vous progresserez et débloquerez des améliorations pour accélerer votre usine.
|
En livrant les formes requises, vous progresserez et débloquerez des améliorations pour accélérer votre usine.
|
||||||
|
|
||||||
Au vu de l'augmentation des demandes de formes, vous devrez agrandir votre usine pour répondre à la forte demande - Mais n'oubliez pas les ressources, vous drevrez vous étendre au milieu de cette [b]carte infinie[/b] !
|
Vous devrez agrandir votre usine pour répondre à l’augmentation de la demande en formes — Mais n’oubliez pas les ressources, vous devrez vous étendre au milieu de cette [b]carte infinie[/b] !
|
||||||
|
|
||||||
Bientôt vous devrez mixer les couleurs et peindre vos formes avec - Combinez les ressources de couleurs rouge, verte et bleue pour produire différentes couleurs et peindre les formes avec pour satisfaire la demande.
|
Bientôt, vous devrez mélanger les couleurs et peindre vos formes avec — Combinez les ressources de couleurs rouge, verte et bleue pour produire différentes couleurs et peindre les formes avec pour satisfaire la demande.
|
||||||
|
|
||||||
Ce jeu propose 18 niveaux progressifs (qui devraient déjà vous occuper quelques heures !) mais j'ajoute constamment de nouveau contenus - Il y en a beaucoup de prévus !
|
Ce jeu propose 18 niveaux progressifs (qui devraient déjà vous occuper quelques heures !) mais je développe constamment plus de contenu — Il y a beaucoup de choses prévues !
|
||||||
|
|
||||||
Acheter le jeu vous donne accès à la version complète qui a des fonctionnalités additionnelles et vous recevrez aussi un accès à des fonctionnalités fraîchement développées.
|
Acheter le jeu vous donne accès à la version complète qui a des fonctionnalités supplémentaires, et vous pourrez aussi accéder aux fonctionnalités fraîchement développées.
|
||||||
|
|
||||||
[b]Avantages de la version complète (standalone)[/b]
|
[b]Avantages de la version complète (standalone)[/b]
|
||||||
|
|
||||||
@ -48,30 +48,30 @@ steamPage:
|
|||||||
[*] Mode sombre
|
[*] Mode sombre
|
||||||
[*] Balises infinies
|
[*] Balises infinies
|
||||||
[*] Parties infinies
|
[*] Parties infinies
|
||||||
[*] Plus d'options
|
[*] Plus d’options
|
||||||
[*] Prochainement: Câbles et énergie ! Prévu pour (environ) fin Juillet 2020.
|
[*] Prochainement : Câbles et énergie ! Prévu pour (environ) fin juillet 2020.
|
||||||
[*] Prochainement: Plus de niveaux
|
[*] Prochainement : Plus de niveaux
|
||||||
[*] Aidez moi à continuer de développer shapez.io ❤️
|
[*] Aidez-moi à continuer de développer shapez.io ❤️
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b]Mises à jour futures[/b]
|
[b]Mises à jour à venir[/b]
|
||||||
|
|
||||||
Je fais souvent des mises à jour et essaye d'en sortir une par semaine!
|
Je fais souvent des mises à jour et j’essaye d’en sortir une par semaine !
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
[*] Différentes cartes et challenges (e.g. carte avec obstacles)
|
[*] Différentes cartes et challenges (e.g. carte avec obstacles)
|
||||||
[*] Puzzles (Délivrer la forme requise avec une zone limitée/jeu de bâtiments)
|
[*] Casse-tête (Livrer la forme requise avec une zone limitée / jeu de bâtiments)
|
||||||
[*] Un mode histoire où les bâtiments ont un coût
|
[*] Un mode histoire où les bâtiments ont un coût
|
||||||
[*] Générateur de carte configurable (configuration des ressources/formes/taille/densitée, seed et plus)
|
[*] Générateur de carte configurable (configuration des ressources / formes / taille / densité, graine aléatoire et plus)
|
||||||
[*] Plus de formes
|
[*] Plus de niveaux
|
||||||
[*] Amélioration des performances (Le jeu tourne déjà plutot bien !)
|
[*] Amélioration des performances (Le jeu tourne déjà plutôt bien !)
|
||||||
[*] Et bien plus !
|
[*] Et bien plus !
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b]Ce jeu est open source ![/b]
|
[b]Ce jeu est open source ![/b]
|
||||||
|
|
||||||
Tout le monde peut contribuer, je suis très impliqué dans la communauté et j'essaye de répondre à toutes les suggestions et prendre en compte vos retours si possible.
|
Tout le monde peut contribuer, je suis très impliqué dans la communauté et j’essaye de répondre à toutes les suggestions et prendre en compte vos retours si possible.
|
||||||
Jetez un coup d'œil à mon Trello pour le suivi du projet et la planification du développement !
|
Jetez un coup d’œil à mon Trello pour le suivi du projet et les plans de développement !
|
||||||
[b]Liens[/b]
|
[b]Liens[/b]
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
@ -82,19 +82,20 @@ steamPage:
|
|||||||
[*] [url=https://github.com/tobspr/shapez.io/blob/master/translations/README.md]Aidez à traduire[/url]
|
[*] [url=https://github.com/tobspr/shapez.io/blob/master/translations/README.md]Aidez à traduire[/url]
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
discordLink: Discord officiel - Parlez avec moi!
|
discordLink: Discord officiel — Parlez avec moi !
|
||||||
|
|
||||||
global:
|
global:
|
||||||
loading: Chargement
|
loading: Chargement
|
||||||
error: Erreur
|
error: Erreur
|
||||||
|
|
||||||
# How big numbers are rendered, e.g. "10,000"
|
# How big numbers are rendered, e.g. "10,000"
|
||||||
thousandsDivider: " "
|
# En français, le séparateur des milliers est l’espace (fine) insécable
|
||||||
|
thousandsDivider: " "
|
||||||
|
|
||||||
# What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4"
|
# What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4"
|
||||||
decimalSeparator: ","
|
decimalSeparator: ","
|
||||||
|
|
||||||
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc. cf wikipedia système international d'unité
|
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc. cf wikipedia système international d’unité
|
||||||
# For french: https://fr.wikipedia.org/wiki/Pr%C3%A9fixes_du_Syst%C3%A8me_international_d%27unit%C3%A9s
|
# For french: https://fr.wikipedia.org/wiki/Pr%C3%A9fixes_du_Syst%C3%A8me_international_d%27unit%C3%A9s
|
||||||
suffix:
|
suffix:
|
||||||
thousands: k
|
thousands: k
|
||||||
@ -108,20 +109,20 @@ global:
|
|||||||
time:
|
time:
|
||||||
# Used for formatting past time dates
|
# Used for formatting past time dates
|
||||||
oneSecondAgo: il y a une seconde
|
oneSecondAgo: il y a une seconde
|
||||||
xSecondsAgo: il y a <x> secondes
|
xSecondsAgo: il y a <x> secondes
|
||||||
oneMinuteAgo: il y a une minute
|
oneMinuteAgo: il y a une minute
|
||||||
xMinutesAgo: il y a <x> minutes
|
xMinutesAgo: il y a <x> minutes
|
||||||
oneHourAgo: il y a une heure
|
oneHourAgo: il y a une heure
|
||||||
xHoursAgo: il y a <x> heures
|
xHoursAgo: il y a <x> heures
|
||||||
oneDayAgo: il y a un jour
|
oneDayAgo: il y a un jour
|
||||||
xDaysAgo: il y a <x> jours
|
xDaysAgo: il y a <x> jours
|
||||||
|
|
||||||
# Short formats for times, e.g. '5h 23m'
|
# Short formats for times, e.g. '5h 23m'
|
||||||
secondsShort: <seconds>s
|
secondsShort: <seconds> s
|
||||||
minutesAndSecondsShort: <minutes>m <seconds>s
|
minutesAndSecondsShort: <minutes> m <seconds> s
|
||||||
hoursAndMinutesShort: <hours>h <minutes>m
|
hoursAndMinutesShort: <hours> h <minutes> m
|
||||||
|
|
||||||
xMinutes: <x> minutes
|
xMinutes: <x> minutes
|
||||||
|
|
||||||
keys:
|
keys:
|
||||||
tab: TAB
|
tab: TAB
|
||||||
@ -135,21 +136,21 @@ demoBanners:
|
|||||||
# This is the "advertisement" shown in the main menu and other various places
|
# This is the "advertisement" shown in the main menu and other various places
|
||||||
title: Version démo
|
title: Version démo
|
||||||
intro: >-
|
intro: >-
|
||||||
Achetez la version complète pour débloquer toutes les fonctionnalités !
|
Achetez la version complète pour débloquer toutes les fonctionnalités !
|
||||||
|
|
||||||
mainMenu:
|
mainMenu:
|
||||||
play: Jouer
|
play: Jouer
|
||||||
changelog: Historique
|
changelog: Historique
|
||||||
importSavegame: Importer
|
importSavegame: Importer
|
||||||
openSourceHint: Ce jeu est open source !
|
openSourceHint: Ce jeu est open source !
|
||||||
discordLink: Serveur Discord officiel
|
discordLink: Serveur Discord officiel
|
||||||
helpTranslate: Contribuez à la traduction !
|
helpTranslate: Contribuez à la traduction !
|
||||||
|
|
||||||
# This is shown when using firefox and other browsers which are not supported.
|
# This is shown when using firefox and other browsers which are not supported.
|
||||||
browserWarning: >-
|
browserWarning: >-
|
||||||
Désolé, ce jeu est connu pour tourner lentement sur votre navigateur web ! Procurez-vous la version complète ou téléchargez Chrome pour une meilleure expérience.
|
Désolé, ce jeu sera lent sur votre navigateur web ! Procurez-vous la version complète ou téléchargez Chrome pour une meilleure expérience.
|
||||||
|
|
||||||
savegameLevel: Niveau <x>
|
savegameLevel: Niveau <x>
|
||||||
savegameLevelUnknown: Niveau inconnu
|
savegameLevelUnknown: Niveau inconnu
|
||||||
|
|
||||||
continue: Continuer
|
continue: Continuer
|
||||||
@ -165,16 +166,16 @@ dialogs:
|
|||||||
later: Plus tard
|
later: Plus tard
|
||||||
restart: Relancer
|
restart: Relancer
|
||||||
reset: Réinitialiser
|
reset: Réinitialiser
|
||||||
getStandalone: Se procurer la version complète
|
getStandalone: Obtenir la version complète
|
||||||
deleteGame: Je sais ce que je fais
|
deleteGame: Je sais ce que je fais
|
||||||
viewUpdate: Voir les mises à jour
|
viewUpdate: Voir les mises à jour
|
||||||
showUpgrades: Montrer les améliorations
|
showUpgrades: Montrer les améliorations
|
||||||
showKeybindings: Montrer les raccourcis
|
showKeybindings: Montrer les raccourcis
|
||||||
|
|
||||||
importSavegameError:
|
importSavegameError:
|
||||||
title: Erreur d'importation
|
title: Erreur d’importation
|
||||||
text: >-
|
text: >-
|
||||||
Impossible d'importer votre sauvegarde:
|
Impossible d’importer votre sauvegarde :
|
||||||
|
|
||||||
importSavegameSuccess:
|
importSavegameSuccess:
|
||||||
title: Sauvegarde importée
|
title: Sauvegarde importée
|
||||||
@ -184,17 +185,17 @@ dialogs:
|
|||||||
gameLoadFailure:
|
gameLoadFailure:
|
||||||
title: La sauvegarde est corrompue
|
title: La sauvegarde est corrompue
|
||||||
text: >-
|
text: >-
|
||||||
Impossible de charger votre sauvegarde:
|
Impossible de charger votre sauvegarde :
|
||||||
|
|
||||||
confirmSavegameDelete:
|
confirmSavegameDelete:
|
||||||
title: Confirmez la suppression
|
title: Confirmez la suppression
|
||||||
text: >-
|
text: >-
|
||||||
Êtes-vous certains de vouloir supprimer votre partie ?
|
Êtes-vous sûr de vouloir supprimer votre partie ?
|
||||||
|
|
||||||
savegameDeletionError:
|
savegameDeletionError:
|
||||||
title: Impossible de supprimer
|
title: Impossible de supprimer
|
||||||
text: >-
|
text: >-
|
||||||
Impossible de supprimer votre sauvegarde:
|
Impossible de supprimer votre sauvegarde :
|
||||||
|
|
||||||
restartRequired:
|
restartRequired:
|
||||||
title: Redémarrage requis
|
title: Redémarrage requis
|
||||||
@ -211,91 +212,91 @@ dialogs:
|
|||||||
|
|
||||||
keybindingsResetOk:
|
keybindingsResetOk:
|
||||||
title: Réinitialisation des contrôles
|
title: Réinitialisation des contrôles
|
||||||
desc: Les contrôles ont été réinitialisés dans leur état par défaut respectifs !
|
desc: Les contrôles ont été remis à défaut !
|
||||||
|
|
||||||
featureRestriction:
|
featureRestriction:
|
||||||
title: Version démo
|
title: Version démo
|
||||||
desc: Vous avez essayé d'accéder à la fonction (<feature>) qui n'est pas disponible dans la démo. Considérez l'achat de la version complète pour une expérience optimale !
|
desc: Vous avez essayé d’accéder à la fonction (<feature>) qui n’est pas disponible dans la démo. Pensez à acheter la version complète pour une expérience optimale !
|
||||||
|
|
||||||
oneSavegameLimit:
|
oneSavegameLimit:
|
||||||
title: Sauvegardes limitées
|
title: Sauvegardes limitées
|
||||||
desc: Vous ne pouvez avoir qu'une seule sauvegarde en même temps dans la version démo. Merci d'effacer celle en cours ou alternativement de vous procurer la version complète !
|
desc: Vous ne pouvez avoir qu’une seule sauvegarde en même temps dans la version démo. Merci d’effacer celle en cours ou bien de vous procurer la version complète !
|
||||||
|
|
||||||
updateSummary:
|
updateSummary:
|
||||||
title: Nouvelle mise à jour !
|
title: Nouvelle mise à jour !
|
||||||
desc: >-
|
desc: >-
|
||||||
Voici les modifications depuis votre dernière session:
|
Voici les changements depuis votre dernière session :
|
||||||
|
|
||||||
upgradesIntroduction:
|
upgradesIntroduction:
|
||||||
title: Débloquer les améliorations
|
title: Débloquer les améliorations
|
||||||
desc: >-
|
desc: >-
|
||||||
Toutes les formes que vous produisez peuvent être utilisées pour débloquer des améliorations - <strong>Ne détruisez pas vos anciennes usines !</strong>
|
Toutes les formes que vous produisez peuvent être utilisées pour débloquer des améliorations — <strong>Ne détruisez pas vos anciennes usines !</strong>
|
||||||
L'onglet des améliorations se trouve dans le coin supérieur droit de l'écran.
|
L’onglet des améliorations se trouve dans le coin supérieur droit de l’écran.
|
||||||
|
|
||||||
massDeleteConfirm:
|
massDeleteConfirm:
|
||||||
title: Confirmation de suppression
|
title: Confirmation de suppression
|
||||||
desc: >-
|
desc: >-
|
||||||
Vous allez supprimer pas mal de bâtiments (<count> pour être exact) ! Êtes vous certains de vouloir faire ça ?
|
Vous allez supprimer beaucoup de bâtiments (<count> pour être précis) ! Êtes-vous sûr de vouloir faire ça ?
|
||||||
|
|
||||||
massCutConfirm:
|
massCutConfirm:
|
||||||
title: Confirmer la coupure
|
title: Confirmer la coupure
|
||||||
desc: >-
|
desc: >-
|
||||||
Vous vous apprêtez à couper beaucoup de bâtiments (<count> pour être précis) ! Êtes-vous certains de vouloir faire ça ?
|
Vous allez couper beaucoup de bâtiments (<count> pour être précis) ! Êtes-vous sûr de vouloir faire ça ?
|
||||||
|
|
||||||
blueprintsNotUnlocked:
|
blueprintsNotUnlocked:
|
||||||
title: Pas encore débloqué
|
title: Pas encore débloqué
|
||||||
desc: >-
|
desc: >-
|
||||||
Les patrons n'ont pas encore étés débloqués ! Terminez encore quelques niveaux pour y avoir accès.
|
Les patrons n’ont pas encore été débloqués ! Terminez le niveau 12 pour y avoir accès.
|
||||||
|
|
||||||
keybindingsIntroduction:
|
keybindingsIntroduction:
|
||||||
title: Raccourcis utiles
|
title: Raccourcis utiles
|
||||||
desc: >-
|
desc: >-
|
||||||
Le jeu a de nombreux raccourcis facilitant la construction de grandes usines.
|
Le jeu a de nombreux raccourcis facilitant la construction de grandes usines.
|
||||||
En voici quelques uns, n'hésitez pas à aller <strong>découvrir les raccourcis</strong> !<br><br>
|
En voici quelques-uns, n’hésitez pas à aller <strong>découvrir les raccourcis</strong> !<br><br>
|
||||||
<code class='keybinding'>CTRL</code> + Glisser: Sélectionne une zone à copier / effacer.<br>
|
<code class='keybinding'>CTRL</code> + glisser : Sélectionne une zone à copier / effacer.<br>
|
||||||
<code class='keybinding'>SHIFT</code>: Laissez appuyé pour placer plusieurs fois le même bâtiment.<br>
|
<code class='keybinding'>MAJ</code> : Laissez appuyé pour placer plusieurs fois le même bâtiment.<br>
|
||||||
<code class='keybinding'>ALT</code>: Inverse l'orientation des convoyeurs placés.<br>
|
<code class='keybinding'>ALT</code> : Inverse l’orientation des convoyeurs placés.<br>
|
||||||
|
|
||||||
createMarker:
|
createMarker:
|
||||||
title: Nouvelle balise
|
title: Nouvelle balise
|
||||||
desc: Donnez-lui un nom, vous pouvez aussi inclure <strong>le raccourci </strong> d'une forme (Que vous pouvez générer <a href="https://viewer.shapez.io" target="_blank">ici</a>)
|
desc: Donnez-lui un nom, vous pouvez aussi inclure <strong>le raccourci</strong> d’une forme (que vous pouvez générer <a href="https://viewer.shapez.io" target="_blank">ici</a>).
|
||||||
titleEdit: Éditer cette balise
|
titleEdit: Modifier cette balise
|
||||||
|
|
||||||
markerDemoLimit:
|
markerDemoLimit:
|
||||||
desc: Vous ne pouvez créer que deux balises dans la démo. Achetez la version complète pour en faire autant que vous voulez !
|
desc: Vous ne pouvez créer que deux balises dans la démo. Achetez la version complète pour en placer autant que vous voulez !
|
||||||
|
|
||||||
exportScreenshotWarning:
|
exportScreenshotWarning:
|
||||||
title: Exporter une capture d'écran
|
title: Exporter une capture d’écran
|
||||||
desc: >-
|
desc: >-
|
||||||
Vous avez demandé à exporter votre base sous la forme d'une capture d'écran. Soyez conscient que cela peut s'avérer passablement lent pour une grande base, voire même faire planter votre jeu !
|
Vous avez demandé à exporter une capture d’écran de votre base. Soyez conscient que cela peut s’avérer passablement lent pour une grande base, voire faire planter votre jeu !
|
||||||
|
|
||||||
massCutInsufficientConfirm:
|
massCutInsufficientConfirm:
|
||||||
title: Confirmer la coupe
|
title: Confirmer la coupe
|
||||||
desc: Vous n'avez pas les moyens de copier cette zone ! Etes vous certain de vouloir la couper ?
|
desc: Vous n’avez pas les moyens de copier cette zone ! Êtes-vous sûr de vouloir la couper ?
|
||||||
|
|
||||||
ingame:
|
ingame:
|
||||||
# This is shown in the top left corner and displays useful keybindings in
|
# This is shown in the top left corner and displays useful keybindings in
|
||||||
# every situation
|
# every situation
|
||||||
keybindingsOverlay:
|
keybindingsOverlay:
|
||||||
moveMap: Déplacer
|
moveMap: Déplacer
|
||||||
selectBuildings: Sélection d'une zone
|
selectBuildings: Sélection d’une zone
|
||||||
stopPlacement: Arrêter le placement
|
stopPlacement: Arrêter de placer
|
||||||
rotateBuilding: Tourner le bâtiment
|
rotateBuilding: Tourner le bâtiment
|
||||||
placeMultiple: Placement multiple
|
placeMultiple: Placement multiple
|
||||||
reverseOrientation: Changer l'orientation
|
reverseOrientation: Changer l’orientation
|
||||||
disableAutoOrientation: Désactiver l'orientation automatique
|
disableAutoOrientation: Désactiver l’orientation automatique
|
||||||
toggleHud: Basculer l'affichage tête haute (ATH)
|
toggleHud: Basculer l’affichage tête haute (ATH)
|
||||||
placeBuilding: Placer un bâtiment
|
placeBuilding: Placer un bâtiment
|
||||||
createMarker: Créer une balise
|
createMarker: Créer une balise
|
||||||
delete: Supprimer
|
delete: Supprimer
|
||||||
pasteLastBlueprint: Copier le dernier patron
|
pasteLastBlueprint: Copier le dernier patron
|
||||||
lockBeltDirection: Utiliser le plannificateur de convoyeurs
|
lockBeltDirection: Utiliser le planificateur de convoyeurs
|
||||||
plannerSwitchSide: Échanger la direction du plannificateur
|
plannerSwitchSide: Inverser la direction du planificateur
|
||||||
cutSelection: Couper
|
cutSelection: Couper
|
||||||
copySelection: Copier
|
copySelection: Copier
|
||||||
clearSelection: Effacer la sélection
|
clearSelection: Effacer la sélection
|
||||||
pipette: Pipette
|
pipette: Pipette
|
||||||
switchLayers: Échanger les calques
|
switchLayers: Changer de calque
|
||||||
|
|
||||||
# Everything related to placing buildings (I.e. as soon as you selected a building
|
# Everything related to placing buildings (I.e. as soon as you selected a building
|
||||||
# from the toolbar)
|
# from the toolbar)
|
||||||
@ -306,29 +307,29 @@ ingame:
|
|||||||
|
|
||||||
# Shows the hotkey in the ui, e.g. "Hotkey: Q"
|
# Shows the hotkey in the ui, e.g. "Hotkey: Q"
|
||||||
hotkeyLabel: >-
|
hotkeyLabel: >-
|
||||||
Raccourci: <key>
|
Raccourci : <key>
|
||||||
|
|
||||||
infoTexts:
|
infoTexts:
|
||||||
speed: Vitesse
|
speed: Vitesse
|
||||||
range: Portée
|
range: Portée
|
||||||
storage: Espace de stockage
|
storage: Espace de stockage
|
||||||
oneItemPerSecond: 1 forme / s
|
oneItemPerSecond: 1 forme ⁄ s
|
||||||
itemsPerSecond: <x> formes / s
|
itemsPerSecond: <x> formes ⁄ s
|
||||||
itemsPerSecondDouble: (x2)
|
itemsPerSecondDouble: (×2)
|
||||||
|
|
||||||
tiles: <x> cases
|
tiles: <x> cases
|
||||||
|
|
||||||
# The notification when completing a level
|
# The notification when completing a level
|
||||||
levelCompleteNotification:
|
levelCompleteNotification:
|
||||||
# <level> is replaced by the actual level, so this gets 'Level 03' for example.
|
# <level> is replaced by the actual level, so this gets 'Level 03' for example.
|
||||||
levelTitle: Niveau <level>
|
levelTitle: Niveau <level>
|
||||||
completed: Terminé
|
completed: Terminé
|
||||||
unlockText: <reward> débloqué !
|
unlockText: <reward> débloqué !
|
||||||
buttonNextLevel: Niveau suivant
|
buttonNextLevel: Niveau suivant
|
||||||
|
|
||||||
# Notifications on the lower right
|
# Notifications on the lower right
|
||||||
notifications:
|
notifications:
|
||||||
newUpgrade: Une nouvelle amélioration est disponible !
|
newUpgrade: Une nouvelle amélioration est disponible !
|
||||||
gameSaved: Votre partie a été sauvegardée.
|
gameSaved: Votre partie a été sauvegardée.
|
||||||
|
|
||||||
# The "Upgrades" window
|
# The "Upgrades" window
|
||||||
@ -337,11 +338,11 @@ ingame:
|
|||||||
buttonUnlock: Améliorer
|
buttonUnlock: Améliorer
|
||||||
|
|
||||||
# Gets replaced to e.g. "Tier IX"
|
# Gets replaced to e.g. "Tier IX"
|
||||||
tier: Niveau <x>
|
tier: Niveau <x>
|
||||||
|
|
||||||
# The roman number for each tier
|
# The roman number for each tier
|
||||||
tierLabels: [I, II, III, IV, V, VI, VII, VIII, IX, X]
|
tierLabels: [I, II, III, IV, V, VI, VII, VIII, IX, X]
|
||||||
maximumLevel: NIVEAU MAXIMAL (Vitesse x<currentMult>)
|
maximumLevel: NIVEAU MAXIMAL (Vitesse ×<currentMult>)
|
||||||
|
|
||||||
# The "Statistics" window
|
# The "Statistics" window
|
||||||
statistics:
|
statistics:
|
||||||
@ -352,14 +353,14 @@ ingame:
|
|||||||
description: Affiche le nombre de formes stockées dans votre bâtiment central.
|
description: Affiche le nombre de formes stockées dans votre bâtiment central.
|
||||||
produced:
|
produced:
|
||||||
title: Produit
|
title: Produit
|
||||||
description: Affiche tous les formes que votre usine produit, en incluant les formes intermédiaires.
|
description: Affiche toutes les formes que votre usine produit, y compris les formes intermédiaires.
|
||||||
delivered:
|
delivered:
|
||||||
title: Délivré
|
title: Livré
|
||||||
description: Affiche les formes qui ont été livrées dans votre bâtiment central.
|
description: Affiche les formes qui ont été livrées dans votre bâtiment central.
|
||||||
noShapesProduced: Aucune forme n'a été produite jusqu'à présent.
|
noShapesProduced: Aucune forme produite pour le moment.
|
||||||
|
|
||||||
# Displays the shapes per minute, e.g. '523 / m'
|
# Displays the shapes per minute, e.g. '523 / m'
|
||||||
shapesPerMinute: <shapes> / m
|
shapesPerMinute: <shapes> ⁄ m
|
||||||
|
|
||||||
# Settings menu, when you press "ESC"
|
# Settings menu, when you press "ESC"
|
||||||
settingsMenu:
|
settingsMenu:
|
||||||
@ -375,7 +376,7 @@ ingame:
|
|||||||
|
|
||||||
# Bottom left tutorial hints
|
# Bottom left tutorial hints
|
||||||
tutorialHints:
|
tutorialHints:
|
||||||
title: Besoin d'aide ?
|
title: Besoin d’aide ?
|
||||||
showHint: Indice
|
showHint: Indice
|
||||||
hideHint: Fermer
|
hideHint: Fermer
|
||||||
|
|
||||||
@ -387,19 +388,19 @@ ingame:
|
|||||||
waypoints:
|
waypoints:
|
||||||
waypoints: Balise
|
waypoints: Balise
|
||||||
hub: Centre
|
hub: Centre
|
||||||
description: Cliquez une balise pour vous y rendre, clic-droit pour l'effacer.<br><br>Appuyez sur <keybinding> pour créer une balise sur la vue actuelle, ou <strong>clic-droit</strong> pour en créer une sur l'endroit pointé.
|
description: Cliquez sur une balise pour vous y rendre, clic-droit pour l’effacer.<br><br>Appuyez sur <keybinding> pour créer une balise sur la vue actuelle, ou <strong>clic-droit</strong> pour en créer une sur l’endroit pointé.
|
||||||
creationSuccessNotification: La balise a été créée.
|
creationSuccessNotification: La balise a été créée.
|
||||||
|
|
||||||
# Interactive tutorial
|
# Interactive tutorial
|
||||||
interactiveTutorial:
|
interactiveTutorial:
|
||||||
title: Tutoriel
|
title: Tutoriel
|
||||||
hints:
|
hints:
|
||||||
1_1_extractor: Placez un <strong>extracteur</strong> sur une <strong>forme en cercle</strong> pour l'extraire !
|
1_1_extractor: Placez un <strong>extracteur</strong> sur une <strong>forme en cercle</strong> pour l’extraire !
|
||||||
1_2_conveyor: >-
|
1_2_conveyor: >-
|
||||||
Connectez l'extracteur avec un <strong>convoyeur</strong> vers votre centre !<br><br>Astuce: <strong>Cliquez et faites glisser</strong> le convoyeur avec votre souris !
|
Connectez l’extracteur avec un <strong>convoyeur</strong> vers votre centre !<br><br>Astuce : <strong>Cliquez et faites glisser</strong> le convoyeur avec votre souris !
|
||||||
|
|
||||||
1_3_expand: >-
|
1_3_expand: >-
|
||||||
Ceci n'est <strong>PAS</strong> un jeu incrémental et inactif ! Construisez plus d'extracteurs et de convoyeurs pour atteindre plus vite votre votre but.<br><br>Astuce: Gardez <strong>MAJ</strong> enfoncé pour placer plusieurs extracteurs, et utilisez <strong>R</strong> pour les faire pivoter.
|
Ceci n’est <strong>PAS</strong> un jeu incrémental et inactif ! Construisez plus d’extracteurs et de convoyeurs pour atteindre plus vite votre but.<br><br>Astuce : Gardez <strong>MAJ</strong> enfoncé pour placer plusieurs extracteurs, et utilisez <strong>R</strong> pour les faire pivoter.
|
||||||
|
|
||||||
colors:
|
colors:
|
||||||
red: Rouge
|
red: Rouge
|
||||||
@ -409,92 +410,92 @@ ingame:
|
|||||||
purple: Violet
|
purple: Violet
|
||||||
cyan: Cyan
|
cyan: Cyan
|
||||||
white: Blanc
|
white: Blanc
|
||||||
uncolored: Non coloré
|
uncolored: Sans couleur
|
||||||
black: Noir
|
black: Noir
|
||||||
shapeViewer:
|
shapeViewer:
|
||||||
title: Calques
|
title: Calques
|
||||||
empty: Vide
|
empty: Vide
|
||||||
copyKey: Copier la clé de forme
|
copyKey: Copier le raccourci de la forme
|
||||||
|
|
||||||
# All shop upgrades
|
# All shop upgrades
|
||||||
shopUpgrades:
|
shopUpgrades:
|
||||||
belt:
|
belt:
|
||||||
name: Convoyeurs, Distributeurs et Tunnels
|
name: Convoyeurs, distributeurs et tunnels
|
||||||
description: Vitesse x<currentMult> → x<newMult>
|
description: Vitesse ×<currentMult> → ×<newMult>
|
||||||
|
|
||||||
miner:
|
miner:
|
||||||
name: Extraction
|
name: Extraction
|
||||||
description: Vitesse x<currentMult> → x<newMult>
|
description: Vitesse ×<currentMult> → ×<newMult>
|
||||||
|
|
||||||
processors:
|
processors:
|
||||||
name: Découpage, Rotation et Empilage
|
name: Découpage, rotation et empilage
|
||||||
description: Vitesse x<currentMult> → x<newMult>
|
description: Vitesse ×<currentMult> → ×<newMult>
|
||||||
|
|
||||||
painting:
|
painting:
|
||||||
name: Mélange et Peinture
|
name: Mélange et peinture
|
||||||
description: Vitesse x<currentMult> → x<newMult>
|
description: Vitesse ×<currentMult> → ×<newMult>
|
||||||
|
|
||||||
# Buildings and their name / description
|
# Buildings and their name / description
|
||||||
buildings:
|
buildings:
|
||||||
belt:
|
belt:
|
||||||
default:
|
default:
|
||||||
name: &belt Convoyeur
|
name: &belt Convoyeur
|
||||||
description: Transporte les objects, maintenez et faites glisser pour en placer plusieurs.
|
description: Transporte les objets, maintenez et faites glisser pour en placer plusieurs.
|
||||||
|
|
||||||
miner: # Internal name for the Extractor
|
miner: # Internal name for the Extractor
|
||||||
default:
|
default:
|
||||||
name: &miner Extracteur
|
name: &miner Extracteur
|
||||||
description: Placez-le au dessus d'une forme ou couleur pour l'extraire.
|
description: Placez-le au-dessus d’une forme ou couleur pour l’extraire.
|
||||||
|
|
||||||
chainable:
|
chainable:
|
||||||
name: Extracteur en série
|
name: Extracteur en série
|
||||||
description: Placez-le au dessus d'une forme ou couleur pour l'extraire. Peut être mis en série.
|
description: Placez-le au-dessus d’une forme ou couleur pour l’extraire. Peut être mis en série.
|
||||||
|
|
||||||
underground_belt: # Internal name for the Tunnel
|
underground_belt: # Internal name for the Tunnel
|
||||||
default:
|
default:
|
||||||
name: &underground_belt Tunnel
|
name: &underground_belt Tunnel
|
||||||
description: Permet de faire passer des ressources en dessous de bâtiment et de convoyeurs.
|
description: Permet de faire passer des ressources sous les bâtiments et les convoyeurs.
|
||||||
|
|
||||||
tier2:
|
tier2:
|
||||||
name: Tunnel Niveau II
|
name: Tunnel niveau II
|
||||||
description: Permet de faire passer des ressources en dessous de bâtiment et de convoyeurs.
|
description: Permet de faire passer des ressources sous les bâtiments et les convoyeurs.
|
||||||
|
|
||||||
splitter: # Internal name for the Balancer
|
splitter: # Internal name for the Balancer
|
||||||
default:
|
default:
|
||||||
name: &splitter Répartiteur
|
name: &splitter Répartiteur
|
||||||
description: Multifonctionnel - Distribue de manière équitable toutes les entrées vers toutes les sorties.
|
description: Multifonctions — Distribue équitablement toutes les entrées vers toutes les sorties.
|
||||||
|
|
||||||
compact:
|
compact:
|
||||||
name: Fusionneur (compact)
|
name: Fusionneur (compact)
|
||||||
description: Fusionne deux convoyeurs en un.
|
description: Fusionne deux convoyeurs en un seul.
|
||||||
|
|
||||||
compact-inverse:
|
compact-inverse:
|
||||||
name: Fusionneur (compact)
|
name: Fusionneur (compact)
|
||||||
description: Fusionne deux convoyeurs en un.
|
description: Fusionne deux convoyeurs en un seul.
|
||||||
|
|
||||||
cutter:
|
cutter:
|
||||||
default:
|
default:
|
||||||
name: &cutter Découpeur
|
name: &cutter Découpeur
|
||||||
description: Coupe une forme de haut en bas et sort les deux parties. <strong>Si vous n'utilisez qu'une seule partie, assurez-vous de détruite l'autre ou sinon, gare au blocage !</strong>
|
description: Coupe une forme de haut en bas et sort les deux parties. <strong>Si vous n’utilisez qu’une seule partie, assurez-vous de détruire l’autre ou sinon, gare au blocage !</strong>
|
||||||
quad:
|
quad:
|
||||||
name: Découpeur (Quatre)
|
name: Découpeur (quadruple)
|
||||||
description: Coupe une forme en quatre parties. <strong>Si vous n'utilisez pas toutes les parties, assurez-vous de détruite les autres ou sinon, gare au blocage !</strong>
|
description: Coupe une forme en quatre parties. <strong>Si vous n’utilisez pas toutes les parties, assurez-vous de détruire les autres ou sinon, gare au blocage !</strong>
|
||||||
|
|
||||||
rotater:
|
rotater:
|
||||||
default:
|
default:
|
||||||
name: &rotater Pivoteur
|
name: &rotater Pivoteur
|
||||||
description: Fait pivoter une forme de 90 degrés vers la droite.
|
description: Fait pivoter une forme de 90 degrés vers la droite.
|
||||||
ccw:
|
ccw:
|
||||||
name: Pivoteur inversé
|
name: Pivoteur inversé
|
||||||
description: Fait pivoter une forme de 90 degrés vers la gauche.
|
description: Fait pivoter une forme de 90 degrés vers la gauche.
|
||||||
fl:
|
fl:
|
||||||
name: Retourneur
|
name: Retourneur
|
||||||
description: Tourne la forme de 180 degrés.
|
description: Tourne une forme de 180 degrés.
|
||||||
|
|
||||||
stacker:
|
stacker:
|
||||||
default:
|
default:
|
||||||
name: &stacker Combineur
|
name: &stacker Combineur
|
||||||
description: Combine deux formes. Si elles ne peuvent pas êtres combinées, la forme de droite est placée sur la forme de gauche.
|
description: Combine deux formes. Si elles ne peuvent pas être combinées, la forme de droite est placée sur la forme de gauche.
|
||||||
|
|
||||||
mixer:
|
mixer:
|
||||||
default:
|
default:
|
||||||
@ -506,11 +507,11 @@ buildings:
|
|||||||
name: &painter Peintre
|
name: &painter Peintre
|
||||||
description: &painter_desc Colorie entièrement la forme de gauche avec la couleur de droite.
|
description: &painter_desc Colorie entièrement la forme de gauche avec la couleur de droite.
|
||||||
double:
|
double:
|
||||||
name: Peintre (Double)
|
name: Peintre (double)
|
||||||
description: Colorie les deux formes de gauche avec la couleur de droite.
|
description: Colorie les deux formes de gauche avec la couleur de droite.
|
||||||
quad:
|
quad:
|
||||||
name: Peintre (Quadruple)
|
name: Peintre (quadruple)
|
||||||
description: Permet de colorier chaque quadrant d'une forme avec une couleur différente.
|
description: Colorie chaque quadrant d’une forme avec une couleur différente.
|
||||||
mirrored:
|
mirrored:
|
||||||
name: *painter
|
name: *painter
|
||||||
description: *painter_desc
|
description: *painter_desc
|
||||||
@ -518,125 +519,125 @@ buildings:
|
|||||||
trash:
|
trash:
|
||||||
default:
|
default:
|
||||||
name: &trash Poubelle
|
name: &trash Poubelle
|
||||||
description: Accepte des formes de n'importe quel côté et les détruit... pour toujours.
|
description: Accepte des formes de n’importe quel côté et les détruit… pour toujours.
|
||||||
|
|
||||||
storage:
|
storage:
|
||||||
name: Stockage
|
name: Stockage
|
||||||
description: Stocke les formes en trop jusqu'à une certaine capacité. Peut être utilisé comme tampon.
|
description: Stocke les formes en trop jusqu’à une certaine capacité. Peut être utilisé pour absorber un surplus.
|
||||||
hub:
|
hub:
|
||||||
deliver: Délivrez
|
deliver: Livrez
|
||||||
toUnlock: pour débloquer
|
toUnlock: pour débloquer
|
||||||
levelShortcut: NV
|
levelShortcut: NV
|
||||||
wire:
|
wire:
|
||||||
default:
|
default:
|
||||||
name: Ligne énergétique
|
name: Câble
|
||||||
description: Permet de transporter de l'énergie.
|
description: Permet de transporter de l’énergie.
|
||||||
advanced_processor:
|
advanced_processor:
|
||||||
default:
|
default:
|
||||||
name: Inverseur de couleur
|
name: Inverseur de couleur
|
||||||
description: Accepte une couleur ou une forme et l'inverse.
|
description: Accepte une couleur ou une forme, et l’inverse.
|
||||||
energy_generator:
|
energy_generator:
|
||||||
deliver: Délivrer
|
deliver: Livrer
|
||||||
toGenerateEnergy: Pour
|
toGenerateEnergy: Pour
|
||||||
default:
|
default:
|
||||||
name: Générateur d'énergie
|
name: Générateur d’énergie
|
||||||
description: Genère de l'énergie en consommant des formes.
|
description: Génère de l’énergie en consommant des formes.
|
||||||
wire_crossings:
|
wire_crossings:
|
||||||
default:
|
default:
|
||||||
name: Duplicateur de ligne
|
name: Duplicateur de câble
|
||||||
description: Sépare une ligne énergétique en deux.
|
description: Sépare un câble en deux.
|
||||||
merger:
|
merger:
|
||||||
name: Fusionneur de ligne
|
name: Fusionneur de câble
|
||||||
description: Fusionne deux lignes énergétiques en une seule.
|
description: Fusionne deux câbles en un seul.
|
||||||
|
|
||||||
storyRewards:
|
storyRewards:
|
||||||
# Those are the rewards gained from completing the store
|
# Those are the rewards gained from completing the store
|
||||||
reward_cutter_and_trash:
|
reward_cutter_and_trash:
|
||||||
title: Découper des formes
|
title: Découpage de formes
|
||||||
desc: Vous venez de débloquer le <strong>découpeur</strong> - il coupe des formes en deux <strong>de haut en bas</strong> quel que soit son orientation !<br><br>Assurez-vous de vous débarasser des déchets, sinon <strong>gare au blocage</strong> - À cet effet, je mets à votre disposition la poubelle, qui détruit tout ce que vous y mettez !
|
desc: Vous venez de débloquer le <strong>découpeur</strong> — il coupe des formes en deux <strong>de haut en bas</strong> quelle que soit son orientation !<br><br>Assurez-vous de vous débarrasser des déchets, sinon <strong>gare au blocage</strong> — À cet effet, je mets à votre disposition la poubelle, qui détruit tout ce que vous y mettez !
|
||||||
|
|
||||||
reward_rotater:
|
reward_rotater:
|
||||||
title: Rotation
|
title: Rotation
|
||||||
desc: Le <strong>pivoteur</strong> a été débloqué ! Il pivote les formes de 90 degrés vers la droite.
|
desc: Le <strong>pivoteur</strong> a été débloqué ! Il pivote les formes de 90 degrés vers la droite.
|
||||||
|
|
||||||
reward_painter:
|
reward_painter:
|
||||||
title: Peintre
|
title: Peintre
|
||||||
desc: >-
|
desc: >-
|
||||||
Le <strong>peintre</strong> a été débloqué - Extrayez des pigments de couleur (comme vous le faites avec les formes) et combinez les avec une forme dans un peintre pour les colorier !<br><br>PS: Si vous êtes daltonien, il y a un <strong>mode daltonien</strong> paramétrable dans les préférences !
|
Le <strong>peintre</strong> a été débloqué — Extrayez des pigments de couleur (comme vous le faites avec les formes) et combinez-les avec une forme dans un peintre pour les colorier !<br><br>PS : Si vous êtes daltonien, il y a un <strong>mode daltonien</strong> paramétrable dans les préférences !
|
||||||
|
|
||||||
reward_mixer:
|
reward_mixer:
|
||||||
title: Mélangeur de couleurs
|
title: Mélangeur de couleurs
|
||||||
desc: Le <strong>mélangeur</strong> a été débloqué - Combinez deux couleurs en utilisant <strong>la synthèse additive des couleurs</strong> avec ce bâtiment !
|
desc: Le <strong>mélangeur</strong> a été débloqué — Combinez deux couleurs en utilisant <strong>la synthèse additive des couleurs</strong> avec ce bâtiment !
|
||||||
|
|
||||||
reward_stacker:
|
reward_stacker:
|
||||||
title: Combineur
|
title: Combineur
|
||||||
desc: Vous pouvez maintenant combiner deux formes avec le <strong>combineur</strong> ! Les deux entrées sont combinées et si elles ne peuvent êtres mises l'une à côté de l'autre, elles sont <strong>fusionnées</strong>. Sinon, la forme de droite est <strong>placée au dessus</strong> de la forme de gauche après avoir été légèrement réduite.
|
desc: Vous pouvez maintenant combiner deux formes avec le <strong>combineur</strong> ! Les deux entrées sont combinées et si elles peuvent être mises l’une à côté de l’autre, elles sont <strong>fusionnées</strong>. Sinon, la forme de droite est <strong>placée au-dessus</strong> de la forme de gauche.
|
||||||
|
|
||||||
reward_splitter:
|
reward_splitter:
|
||||||
title: Distributeur/Rassembleur
|
title: Distributeur / rassembleur
|
||||||
desc: Le <strong>répartiteur</strong> multifonctionnel a été débloqué - Il peut être utilisé pour construire de plus grandes usines en <strong>distribuant équitablement et rassemblant les formes</strong> entre plusieurs convoyeurs !<br><br>
|
desc: Le <strong>répartiteur</strong> multifonctionnel a été débloqué — Il peut être utilisé pour construire de plus grandes usines en <strong>distribuant équitablement et rassemblant les formes</strong> entre plusieurs convoyeurs !<br><br>
|
||||||
|
|
||||||
reward_tunnel:
|
reward_tunnel:
|
||||||
title: Tunnel
|
title: Tunnel
|
||||||
desc: Le <strong>tunnel</strong> a été débloqué - À présent il devient possible de faire passer des formes sous les convoyeurs et les bâtiments !
|
desc: Le <strong>tunnel</strong> a été débloqué — Vous pouvez maintenant faire passer des formes sous les convoyeurs et les bâtiments !
|
||||||
|
|
||||||
reward_rotater_ccw:
|
reward_rotater_ccw:
|
||||||
title: Pivoteur inversé
|
title: Pivoteur inversé
|
||||||
desc: Vous avez débloqué une variante du <strong>pivoteur</strong> - Elle permet de faire pivoter vers la gauche ! Pour le construire, sélectionnez le pivoteur et <strong>appuyez sur 'T' pour alterner entre les variantes</strong> !
|
desc: Vous avez débloqué une variante du <strong>pivoteur</strong> — Elle permet de faire pivoter vers la gauche ! Pour le construire, sélectionnez le pivoteur et <strong>appuyez sur 'T' pour alterner entre les variantes</strong> !
|
||||||
|
|
||||||
reward_miner_chainable:
|
reward_miner_chainable:
|
||||||
title: Extracteur en série
|
title: Extracteur en série
|
||||||
desc: Vous avez débloqué <strong>l'extracteur en série</strong> ! Il permet de <strong>transférer ses resources</strong> à d'autres extracteurs pour augmenter le débit sortant !
|
desc: Vous avez débloqué <strong>l’extracteur en série</strong> ! Il permet de <strong>transférer ses ressources</strong> à d’autres extracteurs pour augmenter le débit sortant !
|
||||||
|
|
||||||
reward_underground_belt_tier_2:
|
reward_underground_belt_tier_2:
|
||||||
title: Tunnel niveau II
|
title: Tunnel niveau II
|
||||||
desc: Vous avez débloqué une nouvelle variante du <strong>tunnel</strong> - Elle a une <strong>portée plus grande</strong>, et vous pouvez à présent superposer les deux variantes de tunnels !
|
desc: Vous avez débloqué une nouvelle variante du <strong>tunnel</strong> — Elle a une <strong>portée plus grande</strong>, et vous pouvez superposer les deux variantes de tunnels !
|
||||||
|
|
||||||
reward_splitter_compact:
|
reward_splitter_compact:
|
||||||
title: Répartiteur compact
|
title: Répartiteur compact
|
||||||
desc: >-
|
desc: >-
|
||||||
Vous avez débloqué une variante compacte du <strong>répartiteur</strong> - Elle accepte deux entrées et les rassemble en une sortie !
|
Vous avez débloqué une variante compacte du <strong>répartiteur</strong> — Elle accepte deux entrées et les rassemble en une sortie !
|
||||||
|
|
||||||
reward_cutter_quad:
|
reward_cutter_quad:
|
||||||
title: Quadruple découpeur
|
title: Quadruple découpeur
|
||||||
desc: Vous avez débloqué une variante du <strong>découpeur</strong> - Elle permet de découper les formes en <strong>quatre parties</strong> à la place de simplement deux !
|
desc: Vous avez débloqué une variante du <strong>découpeur</strong> — Elle permet de découper les formes en <strong>quatre parties</strong> à la place de simplement deux !
|
||||||
|
|
||||||
reward_painter_double:
|
reward_painter_double:
|
||||||
title: Double peintre
|
title: Double peintre
|
||||||
desc: Vous avez débloqué une variante du <strong>peintre</strong> - Elle fonctionne comme le peintre de base, mais elle permet de traiter <strong>deux formes à la fois</strong> en ne consommant qu'une couleur au lieu de deux !
|
desc: Vous avez débloqué une variante du <strong>peintre</strong> — Elle fonctionne comme le peintre de base, mais elle permet de traiter <strong>deux formes à la fois</strong> en ne consommant qu’une couleur au lieu de deux !
|
||||||
|
|
||||||
reward_painter_quad:
|
reward_painter_quad:
|
||||||
title: Quadruple peintre
|
title: Quadruple peintre
|
||||||
desc: Vous avez débloqué une variante du <strong>peintre</strong> - Elle permet de colorier chaque partie d'une forme individuellement !
|
desc: Vous avez débloqué une variante du <strong>peintre</strong> — Elle permet de colorier chaque partie d’une forme individuellement !
|
||||||
|
|
||||||
reward_storage:
|
reward_storage:
|
||||||
title: Tampon de stockage
|
title: Tampon de stockage
|
||||||
desc: Vous avez débloqué une variante de <strong>la poubelle</strong> - Elle permet de stocker des formes jusqu'à une certaine limite !
|
desc: Vous avez débloqué une variante de <strong>la poubelle</strong> — Elle permet de stocker des formes jusqu’à une certaine limite !
|
||||||
|
|
||||||
reward_freeplay:
|
reward_freeplay:
|
||||||
title: Mode libre
|
title: Mode libre
|
||||||
desc: Vous y êtes arrivé ! Vous avez débloqué le <strong>mode libre</strong> ! Cela veut dire que dorénavant, les formes sont générées aléatoirement ! (Ne vous en faites pas, plus de contenu est prévu pour la version complète !)
|
desc: Vous y êtes arrivé ! Vous avez débloqué le <strong>mode libre</strong> ! Cela veut dire que dorénavant, les formes sont générées aléatoirement ! (Ne vous en faites pas, encore plus de contenu est prévu pour la version complète !)
|
||||||
|
|
||||||
reward_blueprints:
|
reward_blueprints:
|
||||||
title: Patrons
|
title: Patrons
|
||||||
desc: Vous pouvez maintenant <strong>copier et coller</strong> des parties de votre usines ! Sélectionnez une zone (Appuyez sur CTRL, et sélectionnez avec votre souris), et appuyez sur 'C' pour la copier.<br><br>Coller n'est <strong>pas gratuit</strong>, vous devez produire <strong>des formes de patrons</strong> pour vous le payer (les mêmes que celles que vous venez de livrer).
|
desc: Vous pouvez maintenant <strong>copier et coller</strong> des parties de votre usine ! Sélectionnez une zone (Appuyez sur CTRL, et sélectionnez avec votre souris), et appuyez sur 'C' pour la copier.<br><br>Coller n’est <strong>pas gratuit</strong>, vous devez produire <strong>des formes de patrons</strong> pour vous le payer (les mêmes que celles que vous venez de livrer).
|
||||||
|
|
||||||
# Special reward, which is shown when there is no reward actually
|
# Special reward, which is shown when there is no reward actually
|
||||||
no_reward:
|
no_reward:
|
||||||
title: Niveau suivant
|
title: Niveau suivant
|
||||||
desc: >-
|
desc: >-
|
||||||
Ce niveau n'a pas de récompense mais le prochain, oui ! <br><br>PS: Vous ne devriez pas détruire votre usine actuelle - Vous aurez besoin de <strong>toutes</strong> ces formes plus tard pour <strong>débloquer des améliorations</strong>
|
Ce niveau n’a pas de récompense mais le prochain, si !<br><br>PS : Ne détruisez pas votre usine actuelle — Vous aurez besoin de <strong>toutes</strong> ces formes plus tard pour <strong>débloquer des améliorations</strong>.
|
||||||
|
|
||||||
no_reward_freeplay:
|
no_reward_freeplay:
|
||||||
title: Niveau suivant
|
title: Niveau suivant
|
||||||
desc: >-
|
desc: >-
|
||||||
Bravo ! À propos, plus de contenu est prévu pour la version complète !
|
Bravo ! À propos, plus de contenu est prévu pour la version complète !
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
title: Options
|
title: Options
|
||||||
categories:
|
categories:
|
||||||
general: Général
|
general: Général
|
||||||
userInterface: Interface Utilisateur
|
userInterface: Interface utilisateur
|
||||||
advanced: Avancé
|
advanced: Avancé
|
||||||
performance: Performance
|
performance: Performance
|
||||||
|
|
||||||
@ -648,26 +649,26 @@ settings:
|
|||||||
|
|
||||||
labels:
|
labels:
|
||||||
uiScale:
|
uiScale:
|
||||||
title: Taille de l'interface
|
title: Taille de l’interface
|
||||||
description: >-
|
description: >-
|
||||||
Change la taille de l'interface utilisateur. Cette interface se redimensionnera suivant la résolution de votre appareil, mais cette option contrôle le facteur de résolution.
|
Change la taille de l’interface utilisateur. Cette interface se redimensionnera suivant la résolution de votre écran, mais cette option contrôle le facteur de résolution.
|
||||||
scales:
|
scales:
|
||||||
super_small: Très petite
|
super_small: Très petite
|
||||||
small: Petite
|
small: Petite
|
||||||
regular: Normale
|
regular: Normale
|
||||||
large: Large
|
large: Grande
|
||||||
huge: Très large
|
huge: Très grande
|
||||||
|
|
||||||
scrollWheelSensitivity:
|
scrollWheelSensitivity:
|
||||||
title: Sensibilité du zoom
|
title: Sensibilité du zoom
|
||||||
description: >-
|
description: >-
|
||||||
Change la sensibilité du zoom (aussi bien de la roulette de la souris que du pavé tactile).
|
Change la sensibilité du zoom (roulette de la souris et pavé tactile).
|
||||||
sensitivity:
|
sensitivity:
|
||||||
super_slow: Super lent
|
super_slow: Très lent
|
||||||
slow: Lent
|
slow: Lent
|
||||||
regular: Normal
|
regular: Normal
|
||||||
fast: Rapide
|
fast: Rapide
|
||||||
super_fast: Super rapide
|
super_fast: Très rapide
|
||||||
|
|
||||||
fullscreen:
|
fullscreen:
|
||||||
title: Plein écran
|
title: Plein écran
|
||||||
@ -687,7 +688,7 @@ settings:
|
|||||||
theme:
|
theme:
|
||||||
title: Thème
|
title: Thème
|
||||||
description: >-
|
description: >-
|
||||||
Choisissez votre thème (clair / sombre).
|
Choisissez votre thème (clair / sombre).
|
||||||
|
|
||||||
themes:
|
themes:
|
||||||
dark: Sombre
|
dark: Sombre
|
||||||
@ -701,7 +702,7 @@ settings:
|
|||||||
alwaysMultiplace:
|
alwaysMultiplace:
|
||||||
title: Placement multiple
|
title: Placement multiple
|
||||||
description: >-
|
description: >-
|
||||||
Si activé, tous les bâtiments resterons sélectionnés tant que vous n'aurez pas annulé. Ceci revient à garder la touche SHIFT appuyée en permanence.
|
Si activé, tous les bâtiments resteront sélectionnés tant que vous n’aurez pas annulé. Ceci revient à garder la touche MAJ appuyée en permanence.
|
||||||
|
|
||||||
offerHints:
|
offerHints:
|
||||||
title: Indices
|
title: Indices
|
||||||
@ -711,13 +712,13 @@ settings:
|
|||||||
language:
|
language:
|
||||||
title: Langue
|
title: Langue
|
||||||
description: >-
|
description: >-
|
||||||
Change la langue. Toutes les traductions sont des contributions des utilisateurs et pourraient être partiellement incomplètes !
|
Change la langue. Les traductions sont une contribution des utilisateurs et peuvent être incomplètes !
|
||||||
|
|
||||||
movementSpeed:
|
movementSpeed:
|
||||||
title: Vitesse de déplacement
|
title: Vitesse de déplacement
|
||||||
description: Change la vitesse à laquelle l'écran se déplace lors de l'utilisation du clavier.
|
description: Change la vitesse de déplacement de l’écran avec les touches clavier.
|
||||||
speeds:
|
speeds:
|
||||||
super_slow: Super lent
|
super_slow: Très lent
|
||||||
slow: Lent
|
slow: Lent
|
||||||
regular: Normal
|
regular: Normal
|
||||||
fast: Rapide
|
fast: Rapide
|
||||||
@ -728,75 +729,75 @@ settings:
|
|||||||
title: Tunnels intelligents
|
title: Tunnels intelligents
|
||||||
description: >-
|
description: >-
|
||||||
Si cette option est sélectionnée, placer des tunnels effacera automatiquement les convoyeurs inutiles.
|
Si cette option est sélectionnée, placer des tunnels effacera automatiquement les convoyeurs inutiles.
|
||||||
Cela permet aussi d'étirer les tunnels et les tunnels en surnombre seront effacés.
|
Cela permet aussi d’étirer les tunnels, et les tunnels en surnombre seront effacés.
|
||||||
|
|
||||||
vignette:
|
vignette:
|
||||||
title: Effet de vignette
|
title: Effet de vignette
|
||||||
description: >-
|
description: >-
|
||||||
Permet l'affichage de l'effet de vignette qui assombrit les coins de l'écran afin de rendre le texte plus facile à lire.
|
Permet l’affichage de l’effet de vignette qui assombrit les coins de l’écran afin de rendre le texte plus facile à lire.
|
||||||
|
|
||||||
autosaveInterval:
|
autosaveInterval:
|
||||||
title: Fréquence des sauvegardes automatiques
|
title: Fréquence des sauvegardes automatiques
|
||||||
description: >-
|
description: >-
|
||||||
Contrôle avec quelle fréquence le jeu sera sauvegardé automatiquement. Vous pouvez aussi entièrement désactiver cette fonctionnalité ici.
|
Contrôle avec quelle fréquence le jeu sera sauvegardé automatiquement. Vous pouvez aussi entièrement désactiver cette fonctionnalité ici.
|
||||||
intervals:
|
intervals:
|
||||||
one_minute: 1 Minute
|
one_minute: 1 minute
|
||||||
two_minutes: 2 Minutes
|
two_minutes: 2 minutes
|
||||||
five_minutes: 5 Minutes
|
five_minutes: 5 minutes
|
||||||
ten_minutes: 10 Minutes
|
ten_minutes: 10 minutes
|
||||||
twenty_minutes: 20 Minutes
|
twenty_minutes: 20 minutes
|
||||||
disabled: Désactivé
|
disabled: Désactivé
|
||||||
|
|
||||||
compactBuildingInfo:
|
compactBuildingInfo:
|
||||||
title: Informations réduites sur les bâtiments
|
title: Informations réduites sur les bâtiments
|
||||||
description: >-
|
description: >-
|
||||||
Raccourcit les panneaux d'information sur les bâtiments en n'affichant que les ratios. Dans le cas contraire, une description et une imagine sont présentés.
|
Raccourcit les panneaux d’information sur les bâtiments en n’affichant que les ratios. Si désactivé, montre une description et une image.
|
||||||
|
|
||||||
disableCutDeleteWarnings:
|
disableCutDeleteWarnings:
|
||||||
title: Désactive les avertissement pour Couper/Effacer
|
title: Désactive les avertissements pour Couper / Effacer
|
||||||
description: >-
|
description: >-
|
||||||
Désactive la boîte de dialogue qui s'affiche lorsque vous vous apprêtez à couper/effacer plus de 100 entités.
|
Désactive la boîte de dialogue qui s’affiche lorsque vous vous apprêtez à couper / effacer plus de 100 entités.
|
||||||
|
|
||||||
enableColorBlindHelper:
|
enableColorBlindHelper:
|
||||||
title: Mode Daltonien
|
title: Mode daltonien
|
||||||
description: Active divers outils qui permettent de jouer à ce jeu si vous êtes daltonien.
|
description: Active divers outils qui permettent de jouer à ce jeu si vous êtes daltonien.
|
||||||
|
|
||||||
rotationByBuilding:
|
rotationByBuilding:
|
||||||
title: Rotation par catégorie de bâtiment
|
title: Rotation par catégorie de bâtiment
|
||||||
description: >-
|
description: >-
|
||||||
Chaque catégorie de bâtiment enregistre le sens de rotation que vous lui avez assigné la dernière fois, de manière individuelle.
|
Chaque catégorie de bâtiment enregistre le sens de rotation que vous lui avez assigné la dernière fois, de manière individuelle.
|
||||||
Cela sera sans doute plus confortable si vous alternez fréquemment entre le placement de différents types de bâtiments.
|
Cela sera sans doute plus agréable si vous alternez fréquemment entre le placement de différents types de bâtiments.
|
||||||
|
|
||||||
lowQualityMapResources:
|
lowQualityMapResources:
|
||||||
title: Ressources de la carte de plus basse qualité
|
title: Ressources de la carte de plus basse qualité
|
||||||
description: >-
|
description: >-
|
||||||
Simplifie le rendu des ressources sur la carte lorsqu'elle est zoomée opur améliorer les performances.
|
Simplifie le rendu des ressources sur la carte lorsqu’elle est zoomée pour améliorer les performances.
|
||||||
C'est encore plus clean, n'oubliez pas d'essayer !
|
Ça donne un rendu encore plus propre, alors essayez-le !
|
||||||
|
|
||||||
disableTileGrid:
|
disableTileGrid:
|
||||||
title: Desactiver la grille de placement
|
title: Désactiver la grille de placement
|
||||||
description: >-
|
description: >-
|
||||||
Desactiver la grille de placement peut aider les performances. Ça rend aussi le jeu encore plus uni!
|
Désactiver la grille de placement peut améliorer les performances. Ça rend aussi l’apparence plus unie !
|
||||||
|
|
||||||
clearCursorOnDeleteWhilePlacing:
|
clearCursorOnDeleteWhilePlacing:
|
||||||
title: Effacer le curseur avec clic droit
|
title: Déselectionner avec le clic droit
|
||||||
description: >-
|
description: >-
|
||||||
Activé par défaut, efface le curseur lorsque vous faites un clic droit en ayant un bâtiment selectioné pour la constructio. Si desactivé, vous pouvez detruire les bâtiments en faisant un clic droit tout en placant un bâtiment.
|
Activé par défaut. Désélectionne le bâtiment choisi pour la construction lorsque vous faites un clic droit sur un bâtiment existant. Si désactivé, vous pouvez détruire des bâtiments avec un clic droit puis continuer de placer le bâtiment sélectionné.
|
||||||
|
|
||||||
lowQualityTextures:
|
lowQualityTextures:
|
||||||
title: Textures de basse résolution (Moche)
|
title: Textures de basse résolution (moche)
|
||||||
description: >-
|
description: >-
|
||||||
Utilise des textures de basse qualité pour augmenter les performances. Cela va rendre le jeu moche!
|
Utilise des textures de basse qualité pour améliorer les performances. Rend le jeu très moche !
|
||||||
|
|
||||||
displayChunkBorders:
|
displayChunkBorders:
|
||||||
title: Monter les bordures de chunks
|
title: Monter les secteurs
|
||||||
description: >-
|
description: >-
|
||||||
Le jeu est divisé en parties de 16x16 cases, si ce réglage est activé, les bordures de chaque partie sont affichées.
|
Le jeu est divisé en secteurs de 16×16 cases. Si ce réglage est activé, les limites de chaque secteur sont affichées.
|
||||||
|
|
||||||
keybindings:
|
keybindings:
|
||||||
title: Contrôles
|
title: Contrôles
|
||||||
hint: >-
|
hint: >-
|
||||||
Astuce: Soyez sûr d'utiliser CTRL, SHIFT et ALT ! Ces touches activent différentes options de placement.
|
Astuce : N’oubliez pas d’utiliser CTRL, MAJ et ALT ! Ces touches activent différentes options de placement.
|
||||||
|
|
||||||
resetKeybindings: Réinitialiser les contrôles
|
resetKeybindings: Réinitialiser les contrôles
|
||||||
|
|
||||||
@ -805,7 +806,7 @@ keybindings:
|
|||||||
ingame: Jeu
|
ingame: Jeu
|
||||||
navigation: Navigation
|
navigation: Navigation
|
||||||
placement: Placement
|
placement: Placement
|
||||||
massSelect: Suppression de zone
|
massSelect: Sélection d’une zone
|
||||||
buildings: Raccourcis bâtiment
|
buildings: Raccourcis bâtiment
|
||||||
placementModifiers: Modificateurs de placement
|
placementModifiers: Modificateurs de placement
|
||||||
|
|
||||||
@ -825,8 +826,8 @@ keybindings:
|
|||||||
menuOpenShop: Améliorations
|
menuOpenShop: Améliorations
|
||||||
menuOpenStats: Statistiques
|
menuOpenStats: Statistiques
|
||||||
|
|
||||||
toggleHud: Basculer l'affichage tête haute (ATH)
|
toggleHud: Basculer l’affichage tête haute (ATH)
|
||||||
toggleFPSInfo: Basculer l'affichage des IPS (itérations par seconde) et des informations de débogage
|
toggleFPSInfo: Basculer l’affichage des IPS (itérations par seconde) et des informations de débogage
|
||||||
belt: *belt
|
belt: *belt
|
||||||
splitter: *splitter
|
splitter: *splitter
|
||||||
underground_belt: *underground_belt
|
underground_belt: *underground_belt
|
||||||
@ -840,49 +841,49 @@ keybindings:
|
|||||||
|
|
||||||
rotateWhilePlacing: Pivoter
|
rotateWhilePlacing: Pivoter
|
||||||
rotateInverseModifier: >-
|
rotateInverseModifier: >-
|
||||||
Variante: Pivote à gauche
|
Variante : Pivote à gauche
|
||||||
cycleBuildingVariants: Alterner entre les variantes
|
cycleBuildingVariants: Alterner entre les variantes
|
||||||
confirmMassDelete: Confirmer la suppression de la sélection
|
confirmMassDelete: Confirmer la suppression de la sélection
|
||||||
cycleBuildings: Alterner entre les bâtiments
|
cycleBuildings: Alterner entre les bâtiments
|
||||||
|
|
||||||
massSelectStart: Cliquez et maintenez pour commencer
|
massSelectStart: Cliquez et glissez pour commencer
|
||||||
massSelectSelectMultiple: Sélectionner plusieurs zones
|
massSelectSelectMultiple: Sélectionner plusieurs zones
|
||||||
massSelectCopy: Copier la sélection
|
massSelectCopy: Copier la sélection
|
||||||
|
|
||||||
placementDisableAutoOrientation: Désactiver l'orientation automatique
|
placementDisableAutoOrientation: Désactiver l’orientation automatique
|
||||||
placeMultiple: Rester en mode placement
|
placeMultiple: Rester en mode placement
|
||||||
placeInverse: Inverser le mode d'orientation automatique
|
placeInverse: Inverser le mode d’orientation automatique
|
||||||
pasteLastBlueprint: Copier le dernier patron
|
pasteLastBlueprint: Copier le dernier patron
|
||||||
massSelectCut: Couper la sélection
|
massSelectCut: Couper la sélection
|
||||||
exportScreenshot: Exporter toute la base en tant qu'image.
|
exportScreenshot: Exporter une image de toute la base
|
||||||
mapMoveFaster: Se déplacer plus vite
|
mapMoveFaster: Se déplacer plus vite
|
||||||
lockBeltDirection: Utiliser le plannificateur de convoyeurs
|
lockBeltDirection: Utiliser le planificateur de convoyeurs
|
||||||
switchDirectionLockSide: "Plannificateur: changer de côté"
|
switchDirectionLockSide: "Planificateur : changer de côté"
|
||||||
pipette: Pipette
|
pipette: Pipette
|
||||||
menuClose: Fermer le menu
|
menuClose: Fermer le menu
|
||||||
switchLayers: Échanger les calques
|
switchLayers: Basculer le calque
|
||||||
advanced_processor: Inverseur de couleur
|
advanced_processor: Inverseur de couleur
|
||||||
energy_generator: Générateur d'énergie
|
energy_generator: Générateur d’énergie
|
||||||
wire: Ligne énergétique
|
wire: Câble
|
||||||
|
|
||||||
about:
|
about:
|
||||||
title: À propos de ce jeu
|
title: À propos de ce jeu
|
||||||
body: >-
|
body: >-
|
||||||
Ce jeu est open source et développé par <a href="https://github.com/tobspr"
|
Ce jeu est open source et développé par <a href="https://github.com/tobspr"
|
||||||
target="_blank">Tobias Springer</a> (c'est moi).<br><br>
|
target="_blank">Tobias Springer</a> (c’est moi).<br><br>
|
||||||
|
|
||||||
Si vous souhaitez contribuer, allez voir <a href="<githublink>"
|
Si vous souhaitez contribuer, allez voir <a href="<githublink>"
|
||||||
target="_blank">shapez.io sur github</a>.<br><br>
|
target="_blank">shapez.io sur github</a>.<br><br>
|
||||||
|
|
||||||
Ce jeu n'aurait pu être réalisé sans la précieuse communauté Discord autour de
|
Ce jeu n’aurait pas pu être réalisé sans la précieuse communauté Discord autour de
|
||||||
mes jeux - Vous devriez vraiment envisager de joindre le <a href="<discordlink>"
|
mes jeux — Vous devriez vraiment rejoindre le <a href="<discordlink>"
|
||||||
target="_blank">serveur Discord</a> !<br><br>
|
target="_blank">serveur Discord</a> !<br><br>
|
||||||
|
|
||||||
La bande son a été créée par <a href="https://soundcloud.com/pettersumelius"
|
La bande son a été créée par <a href="https://soundcloud.com/pettersumelius"
|
||||||
target="_blank">Peppsen</a> - Il est impressionnant !<br><br>
|
target="_blank">Peppsen</a> — Il est génial !<br><br>
|
||||||
|
|
||||||
Pour terminer, un immense merci à mon meilleur amis <a
|
Pour terminer, un immense merci à mon meilleur ami <a
|
||||||
href="https://github.com/niklas-dahl" target="_blank">Niklas</a> - Sans nos sessions sur factorio, ce jeu n'aurait jamais existé.
|
href="https://github.com/niklas-dahl" target="_blank">Niklas</a> — Sans nos sessions sur Factorio, ce jeu n’aurait jamais existé.
|
||||||
|
|
||||||
changelog:
|
changelog:
|
||||||
title: Historique
|
title: Historique
|
||||||
@ -893,7 +894,7 @@ demo:
|
|||||||
importingGames: Importer des sauvegardes
|
importingGames: Importer des sauvegardes
|
||||||
oneGameLimit: Limité à une sauvegarde
|
oneGameLimit: Limité à une sauvegarde
|
||||||
customizeKeybindings: Personnalisation des contrôles
|
customizeKeybindings: Personnalisation des contrôles
|
||||||
exportingBase: Exporter toute la base en tant qu'image
|
exportingBase: Exporter une image de toute la base
|
||||||
|
|
||||||
settingNotAvailable: Indisponible dans la démo.
|
settingNotAvailable: Indisponible dans la démo.
|
||||||
#
|
#
|
||||||
|
|||||||
@ -22,10 +22,10 @@
|
|||||||
---
|
---
|
||||||
steamPage:
|
steamPage:
|
||||||
# This is the short text appearing on the steam page
|
# This is the short text appearing on the steam page
|
||||||
shortText: shapez.io adalah permainan membangun pabrik-pabrik dengan tujuan untuk mengautomatiskan pembentukan dan pemrosesan bentuk-bentuk yang bertambah semakin kompleks di dalam area permainan yang meluas secara tak terhingga.
|
shortText: Shapez.io adalah game tentang membangun pabrik untuk mengotomatiskan pembuatan dan pemrosesan bentuk-bentuk yang semakin kompleks di peta yang meluas tanpa batas.
|
||||||
|
|
||||||
# This is the text shown above the discord link
|
# This is the text shown above the discord link
|
||||||
discordLink: Tautan Resmi Discord – Obrol dengan saya!
|
discordLink: Tautan Resmi Discord – Mari mengobrol dengan saya!
|
||||||
# This is the long description for the steam page - It is contained here so you can help to translate it, and I will regulary update the store page.
|
# This is the long description for the steam page - It is contained here so you can help to translate it, and I will regulary update the store page.
|
||||||
# NOTICE:
|
# NOTICE:
|
||||||
# - Do not translate the first line (This is the gif image at the start of the store)
|
# - Do not translate the first line (This is the gif image at the start of the store)
|
||||||
@ -33,13 +33,13 @@ steamPage:
|
|||||||
longText: >-
|
longText: >-
|
||||||
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
||||||
|
|
||||||
shapez.io adalah permainan membangun pabrik-pabrik dengan tujuan untuk mengautomatiskan pembentukan dan pemrosesan bentuk-bentuk yang bertambah semakin kompleks di dalam area permainan yang meluas secara tak terhingga.
|
shapez.io adalah permainan membangun pabrik dengan tujuan untuk mengautomatiskan pembentukan dan pemrosesan bentuk-bentuk yang bertambah semakin kompleks di peta yang meluas tanpa batas.
|
||||||
|
|
||||||
Setelah pengiriman bentuk-bentuk yang diminta, Anda akan maju dalam permainan dan membuka tingkatan versi-versi mesin selanjutnya untuk mempercepat pabrik Anda.
|
Setelah pengiriman bentuk-bentuk yang diminta, Anda akan maju dalam permainan dan membuka tingkatan versi-versi mesin selanjutnya untuk mempercepat pabrik Anda.
|
||||||
|
|
||||||
Seiring meningkatnya kesulitan dari bentuk-bentuk yang diminta, Anda harus meningkatkan pabrik Anda untuk mengatasi kesulitan tersebut – Jangan lupa dengan sumber-sumber daya, Anda harus memperluas ke seluruh [b]area yang tidak terbatas[/b]!
|
Seiring meningkatnya kesulitan dari bentuk-bentuk yang diminta, Anda harus meningkatkan pabrik Anda untuk mengatasi kesulitan tersebut – Jangan lupa dengan sumber daya, Anda harus memperluas ke seluruh [b]area yang tidak terbatas[/b]!
|
||||||
|
|
||||||
Kemudian Anda harus mencampurkan warna-warna dan mencat bentuk-bentuk dengannya – Campurkan merah, hijau, dan biru untuk memproduksi warna-warna lain dan mencat bentuk-bentuk dengannya untuk memenuhi permintaan.
|
Kemudian Anda harus mencampurkan warna-warna dan mencat bentuk-bentuk tersebut – Campurkan merah, hijau, dan biru untuk memproduksi warna-warna lain dan mencat bentuk-bentuk tersebut untuk memenuhi permintaan.
|
||||||
|
|
||||||
Permainan ini mempunyai 18 level-level progresif (yang mana akan membuat Anda sibuk berjam-jam!), akan tetapi saya akan terus menambahkan konten-konten baru – Ada banyak yang direncanakan!
|
Permainan ini mempunyai 18 level-level progresif (yang mana akan membuat Anda sibuk berjam-jam!), akan tetapi saya akan terus menambahkan konten-konten baru – Ada banyak yang direncanakan!
|
||||||
|
|
||||||
@ -48,16 +48,16 @@ steamPage:
|
|||||||
[b]Keuntungan Versi Penuh[/b]
|
[b]Keuntungan Versi Penuh[/b]
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
[*] Versi Permainan Gelap
|
[*] Mode Malam
|
||||||
[*] Titik Arah Tak Terhingga
|
[*] Titik Arah Tak Terhingga
|
||||||
[*] Penyimpanan Permainan Tak Terhingga
|
[*] Penyimpanan Permainan Tak Terhingga
|
||||||
[*] Pengaturan-pengaturan Tambahan
|
[*] Pengaturan-pengaturan Tambahan
|
||||||
[*] Akan datang: Kawat & Energi! Akan dicoba untuk dicapai untuk (kira-kira) akhir Juli 2020.
|
[*] Akan datang: Kawat & Energi! Akan dicoba untuk dicapai sekitar akhir Juli 2020.
|
||||||
[*] Akan datang: Level-level tambahan
|
[*] Akan datang: Level-level tambahan
|
||||||
[*] Memperkenankan saya untuk terus mengembangkan shapez.io ❤️
|
[*] Mendukung saya untuk terus mengembangkan shapez.io ❤️
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
[b]Pembaruan di Masa Depan[/b]
|
[b]Pembaruan di masa yang akan datang[/b]
|
||||||
|
|
||||||
Saya seringkali membarui permainan ini dan terus mencoba untuk menciptakan pembaruan paling sedikit sekali seminggu!
|
Saya seringkali membarui permainan ini dan terus mencoba untuk menciptakan pembaruan paling sedikit sekali seminggu!
|
||||||
|
|
||||||
@ -87,8 +87,8 @@ steamPage:
|
|||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
global:
|
global:
|
||||||
loading: Memuat
|
loading: Sedang memuat
|
||||||
error: Terdapat kesalahan
|
error: Terjadi kesalahan
|
||||||
|
|
||||||
# How big numbers are rendered, e.g. "10,000"
|
# How big numbers are rendered, e.g. "10,000"
|
||||||
thousandsDivider: ","
|
thousandsDivider: ","
|
||||||
@ -98,9 +98,9 @@ global:
|
|||||||
|
|
||||||
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc.
|
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc.
|
||||||
suffix:
|
suffix:
|
||||||
thousands: k
|
thousands: K
|
||||||
millions: M
|
millions: J
|
||||||
billions: B
|
billions: M
|
||||||
trillions: T
|
trillions: T
|
||||||
|
|
||||||
# Shown for infinitely big numbers
|
# Shown for infinitely big numbers
|
||||||
@ -108,13 +108,13 @@ global:
|
|||||||
|
|
||||||
time:
|
time:
|
||||||
# Used for formatting past time dates
|
# Used for formatting past time dates
|
||||||
oneSecondAgo: satu detik yang lalu
|
oneSecondAgo: sedetik yang lalu
|
||||||
xSecondsAgo: <x> detik yang lalu
|
xSecondsAgo: <x> detik yang lalu
|
||||||
oneMinuteAgo: satu menit yang lalu
|
oneMinuteAgo: semenit yang lalu
|
||||||
xMinutesAgo: <x> menit yang lalu
|
xMinutesAgo: <x> menit yang lalu
|
||||||
oneHourAgo: satu jam yang lalu
|
oneHourAgo: sejam yang lalu
|
||||||
xHoursAgo: <x> jam yang lalu
|
xHoursAgo: <x> jam yang lalu
|
||||||
oneDayAgo: satu hari yang lalu
|
oneDayAgo: sehari yang lalu
|
||||||
xDaysAgo: <x> hari yang lalu
|
xDaysAgo: <x> hari yang lalu
|
||||||
|
|
||||||
# Short formats for times, e.g. '5h 23m'
|
# Short formats for times, e.g. '5h 23m'
|
||||||
@ -142,7 +142,7 @@ mainMenu:
|
|||||||
play: Mulai Permainan
|
play: Mulai Permainan
|
||||||
continue: Lanjutkan Permainan
|
continue: Lanjutkan Permainan
|
||||||
newGame: Permainan Baru
|
newGame: Permainan Baru
|
||||||
changelog: Ganti Data Log
|
changelog: Catatan Perubahan
|
||||||
subreddit: Reddit
|
subreddit: Reddit
|
||||||
importSavegame: Impor Data Simpanan
|
importSavegame: Impor Data Simpanan
|
||||||
openSourceHint: Permainan ini bekerja secara open source!
|
openSourceHint: Permainan ini bekerja secara open source!
|
||||||
@ -166,7 +166,7 @@ dialogs:
|
|||||||
restart: Mulai Ulang
|
restart: Mulai Ulang
|
||||||
reset: Setel Ulang
|
reset: Setel Ulang
|
||||||
getStandalone: Dapatkan Versi Penuh
|
getStandalone: Dapatkan Versi Penuh
|
||||||
deleteGame: Saya tahu apa yang saya kerjakan
|
deleteGame: Saya tahu apa yang saya lakukan
|
||||||
viewUpdate: Tampilkan Pembaruan
|
viewUpdate: Tampilkan Pembaruan
|
||||||
showUpgrades: Tunjukkan Tingkatan
|
showUpgrades: Tunjukkan Tingkatan
|
||||||
showKeybindings: Tunjukan Tombol Pintas
|
showKeybindings: Tunjukan Tombol Pintas
|
||||||
|
|||||||
@ -87,7 +87,7 @@ steamPage:
|
|||||||
|
|
||||||
global:
|
global:
|
||||||
loading: Laden
|
loading: Laden
|
||||||
error: Error
|
error: Fout
|
||||||
|
|
||||||
# How big numbers are rendered, e.g. "10,000"
|
# How big numbers are rendered, e.g. "10,000"
|
||||||
thousandsDivider: "."
|
thousandsDivider: "."
|
||||||
@ -172,7 +172,7 @@ dialogs:
|
|||||||
showKeybindings: Zie Sneltoetsen
|
showKeybindings: Zie Sneltoetsen
|
||||||
|
|
||||||
importSavegameError:
|
importSavegameError:
|
||||||
title: Importeer error
|
title: Importeerfout
|
||||||
text: >-
|
text: >-
|
||||||
Het importeren van je savegame is mislukt:
|
Het importeren van je savegame is mislukt:
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ ingame:
|
|||||||
# <level> is replaced by the actual level, so this gets 'Level 03' for example.
|
# <level> is replaced by the actual level, so this gets 'Level 03' for example.
|
||||||
levelTitle: Level <level>
|
levelTitle: Level <level>
|
||||||
completed: Voltooid
|
completed: Voltooid
|
||||||
unlockText: Ontgrendeld <reward>!
|
unlockText: <reward> ontgrendeld!
|
||||||
buttonNextLevel: Volgende Level
|
buttonNextLevel: Volgende Level
|
||||||
|
|
||||||
# Notifications on the lower right
|
# Notifications on the lower right
|
||||||
@ -633,9 +633,9 @@ storyRewards:
|
|||||||
settings:
|
settings:
|
||||||
title: Opties
|
title: Opties
|
||||||
categories:
|
categories:
|
||||||
general: General
|
general: Algemeen
|
||||||
userInterface: User Interface
|
userInterface: Opmaak
|
||||||
advanced: Advanced
|
advanced: Geavanceerd
|
||||||
|
|
||||||
versionBadges:
|
versionBadges:
|
||||||
dev: Ontwikkeling
|
dev: Ontwikkeling
|
||||||
@ -795,8 +795,8 @@ keybindings:
|
|||||||
menuOpenShop: Upgrades
|
menuOpenShop: Upgrades
|
||||||
menuOpenStats: Statistieken
|
menuOpenStats: Statistieken
|
||||||
|
|
||||||
toggleHud: Toggle HUD
|
toggleHud: Schakel HUD
|
||||||
toggleFPSInfo: Toggle FPS en Debug Info
|
toggleFPSInfo: Schakel FPS en Debug Info
|
||||||
belt: *belt
|
belt: *belt
|
||||||
splitter: *splitter
|
splitter: *splitter
|
||||||
underground_belt: *underground_belt
|
underground_belt: *underground_belt
|
||||||
|
|||||||
@ -22,7 +22,7 @@
|
|||||||
---
|
---
|
||||||
steamPage:
|
steamPage:
|
||||||
# This is the short text appearing on the steam page
|
# This is the short text appearing on the steam page
|
||||||
shortText: shapez.io é um jogo sobre construir fábricas, automatizando a criação e combinação de formas cada vez mais complexas num mapa infinito.
|
shortText: Shapez.io é um jogo sobre construir fábricas, automatizando a criação e combinação de formas cada vez mais complexas num mapa infinito.
|
||||||
|
|
||||||
# This is the text shown above the Discord link
|
# This is the text shown above the Discord link
|
||||||
discordLink: Discord Oficial - Converse comigo!
|
discordLink: Discord Oficial - Converse comigo!
|
||||||
@ -34,17 +34,17 @@ steamPage:
|
|||||||
longText: >-
|
longText: >-
|
||||||
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
[img]{STEAM_APP_IMAGE}/extras/store_page_gif.gif[/img]
|
||||||
|
|
||||||
shapez.io é um jogo sobre construir fábricas, automatizando a criação e combinação de formas cada vez mais complexas num mapa infinito.
|
Shapez.io é um jogo sobre construir fábricas, automatizando a criação e combinação de formas cada vez mais complexas num mapa infinito.
|
||||||
|
|
||||||
Após a entrega das formas requisitadas você progredirá no jogo e desbloqueará melhorias para acelerar sua fábrica.
|
Após a entrega das formas requisitadas, você avançará no jogo e desbloqueará melhorias para acelerar sua produção.
|
||||||
|
|
||||||
Conforme sua demanda por formas aumenta, você irá que aumentar sua fábrica para alcançar-la - Mas não se esqueça dos recursos, você precisará expandir pelo [b]mapa infinito[/b]!
|
Conforme sua demanda por formas aumenta, você terá que aumentar sua fábrica para alcançá-la - Mas não se esqueça dos recursos, você precisará expandir pelo [b]mapa infinito[/b]!
|
||||||
|
|
||||||
Rapidamente você vai ter que misturar cores e pintar suas formas com elas - Combine recursos vermelhos, verdes e azuis para produzir cores diferentes e pintar formas com elas para satisfazer a demanda.
|
Em pouco tempo você terá que misturar cores e pintar suas formas com elas - Combine recursos vermelhos, verdes e azuis para produzir cores diferentes e pintar formas com elas para satisfazer a demanda.
|
||||||
|
|
||||||
O jogo contém 18 níveis progressivos (Que já devem manter você ocupado por horas!) mas eu adiciono novo contéudo constantemente - Tem bastante coisa já planejada!
|
O jogo contém 18 níveis progressivos (que já devem manter você ocupado por horas!) mas eu adiciono novo contéudo constantemente - Tem bastante coisa já planejada!
|
||||||
|
|
||||||
Comprando o jogo você terá acesso à versão completa, que contém recursos adicionais, e além disso você também terá acesso aos recursos que seram desenvolvidos.
|
Comprando o jogo você terá acesso à versão completa, que contém recursos adicionais, e além disso você também terá acesso aos recursos que serão desenvolvidos.
|
||||||
|
|
||||||
[b]Vantagens da versão completa[/b]
|
[b]Vantagens da versão completa[/b]
|
||||||
|
|
||||||
@ -60,15 +60,15 @@ steamPage:
|
|||||||
|
|
||||||
[b]Atualizações Futuras[/b]
|
[b]Atualizações Futuras[/b]
|
||||||
|
|
||||||
Eu lanço atualizações frequentemente e estou tentando lançar pelo menos um por semana!
|
Eu lanço atualizações frequentemente e estou tentando lançar pelo menos uma por semana!
|
||||||
|
|
||||||
[list]
|
[list]
|
||||||
[*] Mapas diferentes e desafios (por exemplo mapas com obstáculos)
|
[*] Mapas diferentes e desafios (por exemplo mapas com obstáculos)
|
||||||
[*] Puzzles (Entregue a forma pedida com uma área restringida ou um certo conjunto de construções)
|
[*] Puzzles (Entregue a forma pedida com uma área restringida ou um certo conjunto de construções)
|
||||||
[*] Um modo história onde as construções têm um custo
|
[*] Um modo história onde as construções têm um custo
|
||||||
[*] Um geredor de mapa customizável (Configure recursos, forma, tamanho, densidade, semente e mais)
|
[*] Um gerador de mapa customizável (configure recursos, formas, tamanho, densidade, semente e mais)
|
||||||
[*] Mais tipos de formas
|
[*] Mais tipos de formas
|
||||||
[*] Melhorias de desempenho (O jogo já roda bem!)
|
[*] Melhorias de desempenho (o jogo já roda bem!)
|
||||||
[*] E muito mais!
|
[*] E muito mais!
|
||||||
[/list]
|
[/list]
|
||||||
|
|
||||||
@ -130,8 +130,8 @@ global:
|
|||||||
control: CTRL
|
control: CTRL
|
||||||
alt: ALT
|
alt: ALT
|
||||||
escape: ESC
|
escape: ESC
|
||||||
shift: SHIFT
|
shift: Shift
|
||||||
space: ESPAÇO
|
space: Espaço
|
||||||
|
|
||||||
demoBanners:
|
demoBanners:
|
||||||
# This is the "advertisement" shown in the main menu and other various places
|
# This is the "advertisement" shown in the main menu and other various places
|
||||||
@ -145,7 +145,7 @@ mainMenu:
|
|||||||
newGame: Novo jogo
|
newGame: Novo jogo
|
||||||
changelog: Changelog
|
changelog: Changelog
|
||||||
subreddit: Reddit
|
subreddit: Reddit
|
||||||
importSavegame: Importar
|
importSavegame: Importar save
|
||||||
openSourceHint: Esse jogo tem código aberto!
|
openSourceHint: Esse jogo tem código aberto!
|
||||||
discordLink: Discord oficial
|
discordLink: Discord oficial
|
||||||
helpTranslate: Ajude a traduzir!
|
helpTranslate: Ajude a traduzir!
|
||||||
@ -183,7 +183,7 @@ dialogs:
|
|||||||
Seu jogo salvo foi importado com sucesso.
|
Seu jogo salvo foi importado com sucesso.
|
||||||
|
|
||||||
gameLoadFailure:
|
gameLoadFailure:
|
||||||
title: Jogo salvo quebrado
|
title: Jogo salvo corrompido
|
||||||
text: >-
|
text: >-
|
||||||
Houve uma falha ao carregar seu jogo salvo:
|
Houve uma falha ao carregar seu jogo salvo:
|
||||||
|
|
||||||
@ -198,13 +198,13 @@ dialogs:
|
|||||||
Houve uma falha ao deletar seu jogo salvo:
|
Houve uma falha ao deletar seu jogo salvo:
|
||||||
|
|
||||||
restartRequired:
|
restartRequired:
|
||||||
title: Ação necessária
|
title: Reinicialização necessária
|
||||||
text: >-
|
text: >-
|
||||||
Você precisa reiniciar o jogo para aplicar as mudanças.
|
Você precisa reiniciar o jogo para aplicar as mudanças.
|
||||||
|
|
||||||
editKeybinding:
|
editKeybinding:
|
||||||
title: Alterar tecla
|
title: Alterar tecla
|
||||||
desc: Pressiona a tecla que deseja vincular, ou ESC para cancelar.
|
desc: Pressione a tecla que deseja vincular, ou ESC para cancelar.
|
||||||
|
|
||||||
resetKeybindingsConfirmation:
|
resetKeybindingsConfirmation:
|
||||||
title: Resetar controles
|
title: Resetar controles
|
||||||
@ -234,17 +234,17 @@ dialogs:
|
|||||||
O guia de melhorias pode ser encontrado no canto superior direito da tela.
|
O guia de melhorias pode ser encontrado no canto superior direito da tela.
|
||||||
|
|
||||||
massDeleteConfirm:
|
massDeleteConfirm:
|
||||||
title: Deletar
|
title: Deletar?
|
||||||
desc: >-
|
desc: >-
|
||||||
Você está deletando vários objetos (<count> para ser exato)! Você quer continuar?
|
Você está deletando vários objetos (<count> para ser exato)! Você quer continuar?
|
||||||
|
|
||||||
massCutConfirm:
|
massCutConfirm:
|
||||||
title: Confirmar corte
|
title: Confirmar corte?
|
||||||
desc: >-
|
desc: >-
|
||||||
Você está cortando vários objetos (<count> para ser exato)! Você quer continuar?
|
Você está cortando vários objetos (<count> para ser exato)! Você quer continuar?
|
||||||
|
|
||||||
massCutInsufficientConfirm:
|
massCutInsufficientConfirm:
|
||||||
title: Confirmar Corte
|
title: Confirmar Corte?
|
||||||
desc: >-
|
desc: >-
|
||||||
You can not afford to paste this area! Are you sure you want to cut it?
|
You can not afford to paste this area! Are you sure you want to cut it?
|
||||||
|
|
||||||
@ -290,8 +290,8 @@ ingame:
|
|||||||
createMarker: Criar marcador
|
createMarker: Criar marcador
|
||||||
delete: Destruir
|
delete: Destruir
|
||||||
pasteLastBlueprint: Colar último projeto
|
pasteLastBlueprint: Colar último projeto
|
||||||
lockBeltDirection: Ativar Planejador de Esteiras
|
lockBeltDirection: Ativar Planejamento de Esteiras
|
||||||
plannerSwitchSide: Girar Planejador
|
plannerSwitchSide: Girar Planejamento
|
||||||
cutSelection: Cortar
|
cutSelection: Cortar
|
||||||
copySelection: Copiar
|
copySelection: Copiar
|
||||||
clearSelection: Limpar Seleção
|
clearSelection: Limpar Seleção
|
||||||
@ -363,13 +363,13 @@ ingame:
|
|||||||
dataSources:
|
dataSources:
|
||||||
stored:
|
stored:
|
||||||
title: Estoque
|
title: Estoque
|
||||||
description: Exibindo a quantidade de formas armazenadas em sua construção central.
|
description: Exibindo a quantidade de formas armazenadas no seu HUB.
|
||||||
produced:
|
produced:
|
||||||
title: Produção
|
title: Produção
|
||||||
description: Exibindo todas as formas que toda a sua fábrica produz, incluindo produtos intermediários..
|
description: Exibindo todas as formas que toda a sua fábrica produz, incluindo produtos intermediários..
|
||||||
delivered:
|
delivered:
|
||||||
title: Entregue
|
title: Entregue
|
||||||
description: Exibindo formas entregues na sua construção central.
|
description: Exibindo formas entregues no seu HUB.
|
||||||
noShapesProduced: Nenhuma forma foi produzida até o momento.
|
noShapesProduced: Nenhuma forma foi produzida até o momento.
|
||||||
|
|
||||||
# Displays the shapes per minute, e.g. '523 / m'
|
# Displays the shapes per minute, e.g. '523 / m'
|
||||||
@ -384,14 +384,14 @@ ingame:
|
|||||||
|
|
||||||
buttons:
|
buttons:
|
||||||
continue: Continuar
|
continue: Continuar
|
||||||
settings: Definições
|
settings: Configurações
|
||||||
menu: Voltar ao menu
|
menu: Voltar ao menu
|
||||||
|
|
||||||
# Bottom left tutorial hints
|
# Bottom left tutorial hints
|
||||||
tutorialHints:
|
tutorialHints:
|
||||||
title: Quer ajuda?
|
title: Quer ajuda?
|
||||||
showHint: Mostrar dica
|
showHint: Mostrar dica
|
||||||
hideHint: Fechar
|
hideHint: Esconder dica
|
||||||
|
|
||||||
# When placing a blueprint
|
# When placing a blueprint
|
||||||
blueprintPlacer:
|
blueprintPlacer:
|
||||||
@ -401,7 +401,7 @@ ingame:
|
|||||||
waypoints:
|
waypoints:
|
||||||
waypoints: Marcadores
|
waypoints: Marcadores
|
||||||
hub: HUB
|
hub: HUB
|
||||||
description: Clique com o botão esquerdo do mouse em um marcador para pular, clique com o botão direito do mouse para excluí-lo. <br><br> Pressione <keybinding> para criar um marcador a partir da exibição atual ou <strong>clique com o botão direito do mouse</strong> para criar um marcador no local selecionado.
|
description: Clique com o botão esquerdo do mouse em um marcador para pular, clique com o botão direito do mouse para excluí-lo. <br><br> Pressione <keybinding> para criar um marcador à partir da exibição atual ou <strong>clique com o botão direito do mouse</strong> para criar um marcador no local selecionado.
|
||||||
creationSuccessNotification: Marcador criado.
|
creationSuccessNotification: Marcador criado.
|
||||||
|
|
||||||
# Shape viewer
|
# Shape viewer
|
||||||
@ -419,7 +419,7 @@ ingame:
|
|||||||
Conecte o extrator com uma <strong>esteira transportadora</strong> até a sua base!<br><br>Dica, <strong>clique e arraste</strong> a esteira com o mouse!
|
Conecte o extrator com uma <strong>esteira transportadora</strong> até a sua base!<br><br>Dica, <strong>clique e arraste</strong> a esteira com o mouse!
|
||||||
|
|
||||||
1_3_expand: >-
|
1_3_expand: >-
|
||||||
Este <strong>NÃO</strong> é um jogo inativo! Construa mais extratores e esteiras para concluir o objetivo mais rapidamente.<br><br>Dica, segure <strong>SHIFT</strong> para colocar vários extratores e use <strong>R</strong> para girá-los.
|
Este <strong>NÃO</strong> é um jogo idle! Construa mais extratores e esteiras para concluir o objetivo mais rapidamente.<br><br>Dica, segure <strong>SHIFT</strong> para colocar vários extratores e use <strong>R</strong> para girá-los.
|
||||||
|
|
||||||
# All shop upgrades
|
# All shop upgrades
|
||||||
shopUpgrades:
|
shopUpgrades:
|
||||||
@ -433,7 +433,7 @@ shopUpgrades:
|
|||||||
name: Corte, Rotação e Montagem
|
name: Corte, Rotação e Montagem
|
||||||
description: Velocidade x<currentMult> → x<newMult>
|
description: Velocidade x<currentMult> → x<newMult>
|
||||||
painting:
|
painting:
|
||||||
name: Mistura e Pintura
|
name: Mistura de cores e Pintura
|
||||||
description: Velocidade x<currentMult> → x<newMult>
|
description: Velocidade x<currentMult> → x<newMult>
|
||||||
|
|
||||||
# Buildings and their name / description
|
# Buildings and their name / description
|
||||||
@ -469,7 +469,7 @@ buildings:
|
|||||||
|
|
||||||
tier2:
|
tier2:
|
||||||
name: Túnel Classe II
|
name: Túnel Classe II
|
||||||
description: Permite transportar recursos por baixo de construções e esteiras.
|
description: Permite transportar recursos por baixo de construções e outras esteiras.
|
||||||
|
|
||||||
splitter: # Internal name for the Balancer
|
splitter: # Internal name for the Balancer
|
||||||
default:
|
default:
|
||||||
@ -541,7 +541,7 @@ buildings:
|
|||||||
|
|
||||||
storage:
|
storage:
|
||||||
name: Estoque
|
name: Estoque
|
||||||
description: Armazena itens em excesso, até uma determinada capacidade. Pode ser usado como uma porta de transbordamento.
|
description: Armazena itens em excesso, até uma determinada capacidade. Pode ser usado como uma eclusa.
|
||||||
|
|
||||||
energy_generator:
|
energy_generator:
|
||||||
deliver: Entregar
|
deliver: Entregar
|
||||||
@ -575,7 +575,7 @@ storyRewards:
|
|||||||
reward_painter:
|
reward_painter:
|
||||||
title: Pintura
|
title: Pintura
|
||||||
desc: >-
|
desc: >-
|
||||||
O <strong>Pintor</strong> foi desbloqueado - Extrai alguns pigmentos coloridos (assim como você fez com as formas) e combina-os com uma forma no pintor para os colorir!<br><br>PS: Se for daltônico, existe um <strong>modo daltônico</strong> nas definições!
|
O <strong>Pintor</strong> foi desbloqueado - Extraia alguns pigmentos coloridos (assim como você fez com as formas) e combine-os com uma forma no pintor para colorí-las!<br><br>PS: Se for daltônico, existe um <strong>modo daltônico</strong> nas definições!
|
||||||
|
|
||||||
reward_mixer:
|
reward_mixer:
|
||||||
title: Misturando cores
|
title: Misturando cores
|
||||||
@ -591,7 +591,7 @@ storyRewards:
|
|||||||
|
|
||||||
reward_tunnel:
|
reward_tunnel:
|
||||||
title: Túnel
|
title: Túnel
|
||||||
desc: O <strong>túnel</strong> foi desbloqueado - Agora você pode canalizar itens sob construções!
|
desc: O <strong>túnel</strong> foi desbloqueado - Agora você pode transportar itens abaixo do solo!
|
||||||
|
|
||||||
reward_rotater_ccw:
|
reward_rotater_ccw:
|
||||||
title: Rotação anti-horária
|
title: Rotação anti-horária
|
||||||
@ -646,7 +646,7 @@ storyRewards:
|
|||||||
Parabéns! Aliás, mais conteúdo vindo na versão completa!
|
Parabéns! Aliás, mais conteúdo vindo na versão completa!
|
||||||
|
|
||||||
settings:
|
settings:
|
||||||
title: opções
|
title: Opções
|
||||||
categories:
|
categories:
|
||||||
general: Geral
|
general: Geral
|
||||||
userInterface: Interface de Usuário
|
userInterface: Interface de Usuário
|
||||||
@ -671,7 +671,7 @@ settings:
|
|||||||
huge: Gigante
|
huge: Gigante
|
||||||
|
|
||||||
autosaveInterval:
|
autosaveInterval:
|
||||||
title: Intervalo de gravação automática
|
title: Intervalo de save automático
|
||||||
description: >-
|
description: >-
|
||||||
Controla a frequência com que o jogo salva automaticamente. Você também pode desativá-lo totalmente aqui.
|
Controla a frequência com que o jogo salva automaticamente. Você também pode desativá-lo totalmente aqui.
|
||||||
|
|
||||||
@ -714,7 +714,7 @@ settings:
|
|||||||
enableColorBlindHelper:
|
enableColorBlindHelper:
|
||||||
title: Modo daltônico.
|
title: Modo daltônico.
|
||||||
description: >-
|
description: >-
|
||||||
Permite várias ferramentas que permitem jogar se você é daltônico.
|
Habilita várias ferramentas que te permitem jogar se você é daltônico.
|
||||||
|
|
||||||
fullscreen:
|
fullscreen:
|
||||||
title: Tela Cheia
|
title: Tela Cheia
|
||||||
@ -745,24 +745,24 @@ settings:
|
|||||||
Se você possui um monitor de 144 hz, altere a taxa de atualização aqui para que o jogo seja simulado corretamente com taxas de atualização mais altas. Isso diminuir o FPS consideravelmente se o computador for muito lento.
|
Se você possui um monitor de 144 hz, altere a taxa de atualização aqui para que o jogo seja simulado corretamente com taxas de atualização mais altas. Isso diminuir o FPS consideravelmente se o computador for muito lento.
|
||||||
|
|
||||||
alwaysMultiplace:
|
alwaysMultiplace:
|
||||||
title: Multiplicidade
|
title: Posicionamento Múltiplo
|
||||||
description: >-
|
description: >-
|
||||||
Se ativado, todas as construções permanecerão selecionadas após o posicionamento até que você a cancele. Isso é equivalente a pressionar SHIFT permanentemente.
|
Se ativado, todas as construções permanecerão selecionadas após o posicionamento até que você a cancele. Isso é equivalente a pressionar SHIFT permanentemente.
|
||||||
|
|
||||||
offerHints:
|
offerHints:
|
||||||
title: Dicas e tutoriais
|
title: Dicas e Tutoriais
|
||||||
description: >-
|
description: >-
|
||||||
Se ativado, oferece dicas e tutoriais enquanto se joga. Além disso, esconde certos elementos da interface até certo ponto, para facilitar o começo do jogo.
|
Se ativado, oferece dicas e tutoriais enquanto se joga. Além disso, esconde certos elementos da interface até certo ponto, para facilitar o começo do jogo.
|
||||||
|
|
||||||
enableTunnelSmartplace:
|
enableTunnelSmartplace:
|
||||||
title: Túneis inteligentes
|
title: Túneis Inteligentes
|
||||||
description: >-
|
description: >-
|
||||||
Quando colocados, irão remover automaticamente esteiras desnecessárias. Isso também permite arrastar túneis e túneis em excesso serão removidos.
|
Quando colocados, irão remover automaticamente esteiras desnecessárias. Isso também permite arrastar túneis e túneis em excesso serão removidos.
|
||||||
|
|
||||||
vignette:
|
vignette:
|
||||||
title: Vinheta
|
title: Vinheta
|
||||||
description: >-
|
description: >-
|
||||||
Permite o modo vinheta que escurece os cantos da tela e facilita a leitura do texto.
|
Habilita o modo vinheta que escurece os cantos da tela e facilita a leitura do texto.
|
||||||
|
|
||||||
rotationByBuilding:
|
rotationByBuilding:
|
||||||
title: Rotação por tipo de construção
|
title: Rotação por tipo de construção
|
||||||
@ -777,7 +777,7 @@ settings:
|
|||||||
disableCutDeleteWarnings:
|
disableCutDeleteWarnings:
|
||||||
title: Desativar avisos de recorte / exclusão
|
title: Desativar avisos de recorte / exclusão
|
||||||
description: >-
|
description: >-
|
||||||
Desative as caixas de diálogo de aviso exibidas ao cortar / excluir mais de 100 entidades.
|
Desativa as caixas de diálogo de aviso exibidas ao cortar / excluir mais de 100 entidades.
|
||||||
|
|
||||||
keybindings:
|
keybindings:
|
||||||
title: Controles
|
title: Controles
|
||||||
@ -790,9 +790,9 @@ keybindings:
|
|||||||
general: Geral
|
general: Geral
|
||||||
ingame: Jogo
|
ingame: Jogo
|
||||||
navigation: Navegação
|
navigation: Navegação
|
||||||
placement: Construção
|
placement: Posicionamento
|
||||||
massSelect: Seleção
|
massSelect: Seleção em Massa
|
||||||
buildings: Atalhos de objetos
|
buildings: Construções
|
||||||
placementModifiers: Modificadores
|
placementModifiers: Modificadores
|
||||||
|
|
||||||
mappings:
|
mappings:
|
||||||
@ -807,7 +807,7 @@ keybindings:
|
|||||||
|
|
||||||
mapZoomIn: Aproximar
|
mapZoomIn: Aproximar
|
||||||
mapZoomOut: Distanciar
|
mapZoomOut: Distanciar
|
||||||
createMarker: Criar marcação
|
createMarker: Criar marcador
|
||||||
|
|
||||||
menuOpenShop: Melhorias
|
menuOpenShop: Melhorias
|
||||||
menuOpenStats: Estatísticas
|
menuOpenStats: Estatísticas
|
||||||
@ -839,7 +839,7 @@ keybindings:
|
|||||||
confirmMassDelete: Confirmar exclusão em massa
|
confirmMassDelete: Confirmar exclusão em massa
|
||||||
pasteLastBlueprint: Colar último projeto
|
pasteLastBlueprint: Colar último projeto
|
||||||
cycleBuildings: Trocar de construção
|
cycleBuildings: Trocar de construção
|
||||||
lockBeltDirection: Ativar planejador de correia
|
lockBeltDirection: Ativar planejamento de esteira
|
||||||
switchDirectionLockSide: >-
|
switchDirectionLockSide: >-
|
||||||
Planejador: Mudar de lado
|
Planejador: Mudar de lado
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user