Further progress on the energy generator / wires, fix translations

This commit is contained in:
tobspr 2020-07-01 17:51:11 +02:00
parent 030194f5b8
commit bd899df5fe
53 changed files with 1243 additions and 893 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:191ff110356e8d8046e0ef05108b06809fad657d086d5e1821219966bbf1b8d7
size 861938
oid sha256:688b663c660bd9f92ec78bd1e4d0d10813bfb09ffe3c95408fab36a908553628
size 962903

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a01502c651ee3de0a4350b3c7fc4c7e964a5a17ec6db031fe79524ed957fd516
size 77563
oid sha256:9adbc719ee8765117f5f1208f6121b6e5d417de1c62cbd6cbb9b127651830382
size 109524

BIN
artwork/thirdparty/spotify/cover.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 MiB

3
artwork/thirdparty/spotify/cover.psd vendored Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:468563187c9f4e2333c353d2822e21cd5859f363fa636a9f7acf88671d777e11
size 47276113

BIN
artwork/thirdparty/spotify/cover.zip vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2adafebb258471fb88b16c16746f7468081e97f128910878740e6b1278003e94
size 92412

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af7d1113b0cb0bbcf626889fc242cc6eabb5a9b50e0eef9bf013334f7e3eb7fa
size 70769
oid sha256:c35f217cbc3c687e3ee7c25a410ce953b38637e106b8ea348caeca55bfeac394
size 70555

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a1200717523a78bc2e98929a5d276458f9ce2041969fa54c40873ba08340b219
size 5196595
oid sha256:db1a0f44bc1b2fa66d18022d941e71063623d8036369739dc02e9b1c577a7d21
size 5197244

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 67 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 214 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 KiB

After

Width:  |  Height:  |  Size: 503 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 968 KiB

After

Width:  |  Height:  |  Size: 1014 KiB

View File

@ -381,6 +381,27 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/advanced_processor.png</key>
<key type="filename">sprites/blueprints/energy_generator.png</key>
<key type="filename">sprites/blueprints/painter-double.png</key>
<key type="filename">sprites/blueprints/trash-storage.png</key>
<key type="filename">sprites/buildings/advanced_processor.png</key>
<key type="filename">sprites/buildings/energy_generator.png</key>
<key type="filename">sprites/buildings/painter-double.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>96,96,192,192</rect>
<key>scale9Paddings</key>
<rect>96,96,192,192</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/cutter-quad.png</key>
<key type="filename">sprites/blueprints/painter-quad.png</key>
<key type="filename">sprites/buildings/cutter-quad.png</key>
@ -420,25 +441,6 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/energy_generator.png</key>
<key type="filename">sprites/blueprints/painter-double.png</key>
<key type="filename">sprites/blueprints/trash-storage.png</key>
<key type="filename">sprites/buildings/energy_generator.png</key>
<key type="filename">sprites/buildings/painter-double.png</key>
<struct type="IndividualSpriteSettings">
<key>pivotPoint</key>
<point_f>0.5,0.5</point_f>
<key>spriteScale</key>
<double>1</double>
<key>scale9Enabled</key>
<false/>
<key>scale9Borders</key>
<rect>96,96,192,192</rect>
<key>scale9Paddings</key>
<rect>96,96,192,192</rect>
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/blueprints/miner-chainable.png</key>
<key type="filename">sprites/blueprints/miner.png</key>
<key type="filename">sprites/blueprints/rotater-ccw.png</key>
@ -589,6 +591,10 @@
<key>scale9FromFile</key>
<false/>
</struct>
<key type="filename">sprites/wires/battery_empty.png</key>
<key type="filename">sprites/wires/battery_full.png</key>
<key type="filename">sprites/wires/battery_low.png</key>
<key type="filename">sprites/wires/battery_medium.png</key>
<key type="filename">sprites/wires/negative_energy.png</key>
<key type="filename">sprites/wires/positive_energy.png</key>
<struct type="IndividualSpriteSettings">

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8c334a9f100fce4647b4803d2a8270b30e26d53622b3717bdb81b3ea07f84aed
size 150286082
oid sha256:df7487fb5e8cb34cecee2519b9c3162a5107d2d7b1301c4a550904cfb108a015
size 223361394

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 936 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -5,6 +5,7 @@ export const CHANGELOG = [
entries: [
"Allow holding ALT in belt planner to reverse direction (by jakobhellermann)",
"Clear cursor when trying to pipette the same building twice (by hexy)",
"Updated the soundtrack again, it is now 20 minutes in total!",
],
},
{

View File

@ -45,7 +45,7 @@ export const globalConfig = {
// Map
mapChunkSize: 16,
mapChunkPrerenderMinZoom: 1.15,
mapChunkPrerenderMinZoom: 0.7,
mapChunkOverviewMinZoom: 0.7,
// Belt speeds

View File

@ -9,6 +9,7 @@ import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot, enumLayer } from "../root";
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
import { EnergyConsumerComponent } from "../components/energy_consumer";
export class MetaAdvancedProcessorBuilding extends MetaBuilding {
constructor() {
@ -61,6 +62,14 @@ export class MetaAdvancedProcessorBuilding extends MetaBuilding {
],
})
);
entity.addComponent(
new EnergyConsumerComponent({
bufferSize: 3,
perCharge: 1,
batteryPosition: new Vector(4, 6.5),
})
);
entity.addComponent(
new WiredPinsComponent({
slots: [

View File

@ -1,13 +1,13 @@
import { enumDirection, Vector } from "../../core/vector";
import { enumItemType } from "../base_item";
import { EnergyGeneratorComponent } from "../components/energy_generator";
import { ItemAcceptorComponent } from "../components/item_acceptor";
import { ItemEjectorComponent } from "../components/item_ejector";
import { enumPinSlotType, WiredPinsComponent } from "../components/wired_pins";
import { Entity } from "../entity";
import { MetaBuilding } from "../meta_building";
import { GameRoot, enumLayer } from "../root";
import { enumLayer, GameRoot } from "../root";
import { enumHubGoalRewards } from "../tutorial_goals";
import { EnergyGeneratorComponent } from "../components/energy_generator";
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
import { enumItemType } from "../base_item";
import { ItemEjectorComponent } from "../components/item_ejector";
export class MetaEnergyGenerator extends MetaBuilding {
constructor() {
@ -51,17 +51,6 @@ export class MetaEnergyGenerator extends MetaBuilding {
entity.addComponent(
new ItemAcceptorComponent({
slots: [
{
pos: new Vector(0, 0),
directions: [enumDirection.top],
filter: enumItemType.shape,
},
{
pos: new Vector(1, 0),
directions: [enumDirection.top],
filter: enumItemType.shape,
},
{
pos: new Vector(0, 1),
directions: [enumDirection.bottom],
@ -72,7 +61,6 @@ export class MetaEnergyGenerator extends MetaBuilding {
directions: [enumDirection.bottom],
filter: enumItemType.shape,
},
{
pos: new Vector(1, 0),
directions: [enumDirection.top],
@ -99,6 +87,7 @@ export class MetaEnergyGenerator extends MetaBuilding {
new EnergyGeneratorComponent({
// Set by the energy generator system later
requiredKey: null,
acceptorSlotIndex: 2,
})
);

View File

@ -12,6 +12,7 @@ import { HubComponent } from "./components/hub";
import { StorageComponent } from "./components/storage";
import { EnergyGeneratorComponent } from "./components/energy_generator";
import { WiredPinsComponent } from "./components/wired_pins";
import { EnergyConsumerComponent } from "./components/energy_consumer";
export function initComponentRegistry() {
gComponentRegistry.register(StaticMapEntityComponent);
@ -27,6 +28,7 @@ export function initComponentRegistry() {
gComponentRegistry.register(StorageComponent);
gComponentRegistry.register(EnergyGeneratorComponent);
gComponentRegistry.register(WiredPinsComponent);
gComponentRegistry.register(EnergyConsumerComponent);
// IMPORTANT ^^^^^ UPDATE ENTITY COMPONENT STORAGE AFTERWARDS

View File

@ -0,0 +1,34 @@
import { Component } from "../component";
import { types } from "../../savegame/serialization";
import { Vector } from "../../core/vector";
export class EnergyConsumerComponent extends Component {
static getId() {
return "EnergyConsumer";
}
static getSchema() {
return {
bufferSize: types.uint,
perCharge: types.uint,
stored: types.uint,
batteryPosition: types.vector,
};
}
/**
*
* @param {object} param0
* @param {number} param0.bufferSize How much energy this consumer can store
* @param {number} param0.perCharge How much energy this consumer needs per charge
* @param {Vector} param0.batteryPosition world space render offset of the battery icon
*/
constructor({ bufferSize = 3, perCharge = 1, batteryPosition = new Vector() }) {
super();
this.bufferSize = bufferSize;
this.perCharge = perCharge;
this.batteryPosition = batteryPosition;
this.stored = 0;
}
}

View File

@ -5,9 +5,6 @@ import { ShapeItem } from "../items/shape_item";
const maxQueueSize = 20;
export const ENERGY_GENERATOR_EJECT_SLOT = 0;
export const ENERGY_GENERATOR_ACCEPT_SLOT = 4;
export class EnergyGeneratorComponent extends Component {
static getId() {
return "EnergyGenerator";
@ -24,8 +21,9 @@ export class EnergyGeneratorComponent extends Component {
*
* @param {object} param0
* @param {string} param0.requiredKey Which shape this generator needs, can be null if not computed yet
* @param {number} param0.acceptorSlotIndex
*/
constructor({ requiredKey }) {
constructor({ requiredKey, acceptorSlotIndex = 0 }) {
super();
this.requiredKey = requiredKey;
@ -34,6 +32,12 @@ export class EnergyGeneratorComponent extends Component {
* @type {number}
*/
this.itemsInQueue = 0;
/**
* Stores which slot accepts the waste
* @type {number}
*/
this.acceptorSlotIndex = acceptorSlotIndex;
}
/**
@ -42,7 +46,7 @@ export class EnergyGeneratorComponent extends Component {
* @param {number} slot
*/
tryTakeItem(item, slot) {
if (slot === ENERGY_GENERATOR_ACCEPT_SLOT) {
if (slot === this.acceptorSlotIndex) {
// this is the acceptor slot on the wires layer
// just destroy it
return true;

View File

@ -405,6 +405,7 @@ export class GameCore {
systems.hub.draw(params);
systems.energyGenerator.draw(params);
systems.storage.draw(params);
systems.energyConsumer.draw(params);
}
root.hud.parts.wiresOverlay.draw(params);

View File

@ -12,6 +12,7 @@ import { HubComponent } from "./components/hub";
import { StorageComponent } from "./components/storage";
import { EnergyGeneratorComponent } from "./components/energy_generator";
import { WiredPinsComponent } from "./components/wired_pins";
import { EnergyConsumerComponent } from "./components/energy_consumer";
/* typehints:end */
/**
@ -61,6 +62,9 @@ export class EntityComponentStorage {
/** @type {WiredPinsComponent} */
this.WiredPins;
/** @type {EnergyConsumerComponent} */
this.EnergyConsumer;
/* typehints:end */
}
}

View File

@ -15,6 +15,7 @@ import { ItemAcceptorSystem } from "./systems/item_acceptor";
import { StorageSystem } from "./systems/storage";
import { EnergyGeneratorSystem } from "./systems/energy_generator";
import { WiredPinsSystem } from "./systems/wired_pins";
import { EnergyConsumerSystem } from "./systems/energy_consumer";
const logger = createLogger("game_system_manager");
@ -64,6 +65,9 @@ export class GameSystemManager {
/** @type {WiredPinsSystem} */
wiredPins: null,
/** @type {EnergyConsumerSystem} */
energyConsumer: null,
/* typehints:end */
};
this.systemUpdateOrder = [];
@ -104,6 +108,8 @@ export class GameSystemManager {
add("wiredPins", WiredPinsSystem);
add("energyConsumer", EnergyConsumerSystem);
// IMPORTANT: Must be after belt system since belt system can change the
// orientation of an entity after it is placed -> the item acceptor cache
// then would be invalid

View File

@ -546,7 +546,6 @@ export class BeltSystem extends GameSystemWithFilter {
return;
}
parameters.context.globalAlpha = 0.5;
const contents = chunk.wireContents;
for (let y = 0; y < globalConfig.mapChunkSize; ++y) {
for (let x = 0; x < globalConfig.mapChunkSize; ++x) {
@ -564,7 +563,6 @@ export class BeltSystem extends GameSystemWithFilter {
}
}
}
parameters.context.globalAlpha = 1;
}
/**

View File

@ -0,0 +1,48 @@
import { GameSystemWithFilter } from "../game_system_with_filter";
import { EnergyConsumerComponent } from "../components/energy_consumer";
import { Loader } from "../../core/loader";
import { DrawParameters } from "../../core/draw_parameters";
import { Entity } from "../entity";
import { enableImageSmoothing } from "../../core/buffer_utils";
export class EnergyConsumerSystem extends GameSystemWithFilter {
constructor(root) {
super(root, [EnergyConsumerComponent]);
this.batterySprites = [
Loader.getSprite("sprites/wires/battery_empty.png"),
Loader.getSprite("sprites/wires/battery_low.png"),
Loader.getSprite("sprites/wires/battery_medium.png"),
Loader.getSprite("sprites/wires/battery_full.png"),
];
}
/**
* Draws everything
* @param {DrawParameters} parameters
*/
draw(parameters) {
this.forEachMatchingEntityOnScreen(parameters, this.drawSingleEntity.bind(this));
}
/**
* Draws a given entity
* @param {DrawParameters} parameters
* @param {Entity} entity
*/
drawSingleEntity(parameters, entity) {
const staticComp = entity.components.StaticMapEntity;
const consumerComp = entity.components.EnergyConsumer;
const position = staticComp
.getTileSpaceBounds()
.getCenter()
.toWorldSpace()
.add(consumerComp.batteryPosition);
const percentage = consumerComp.stored / consumerComp.bufferSize;
const index = Math.floor(percentage * this.batterySprites.length);
this.batterySprites[index].drawCachedCentered(parameters, position.x, position.y, 12);
}
}

View File

@ -1,7 +1,7 @@
import { DrawParameters } from "../../core/draw_parameters";
import { formatBigNumber } from "../../core/utils";
import { T } from "../../translations";
import { EnergyGeneratorComponent, ENERGY_GENERATOR_EJECT_SLOT } from "../components/energy_generator";
import { EnergyGeneratorComponent } from "../components/energy_generator";
import { Entity } from "../entity";
import { GameSystemWithFilter } from "../game_system_with_filter";
import { POSITIVE_ENERGY_ITEM_SINGLETON } from "../items/positive_energy_item";
@ -36,7 +36,8 @@ export class EnergyGeneratorSystem extends GameSystemWithFilter {
}
if (energyGenComp.itemsInQueue > 0) {
if (ejectorComp.tryEject(ENERGY_GENERATOR_EJECT_SLOT, POSITIVE_ENERGY_ITEM_SINGLETON)) {
// FIXME: Find slot dynamically
if (ejectorComp.tryEject(0, POSITIVE_ENERGY_ITEM_SINGLETON)) {
energyGenComp.itemsInQueue -= 1;
}
}

View File

@ -27,7 +27,7 @@ export class WiredPinsSystem extends GameSystemWithFilter {
}
/**
* Draws the given layer
* Draws the pins
* @param {DrawParameters} parameters
*/
draw(parameters) {
@ -35,7 +35,7 @@ export class WiredPinsSystem extends GameSystemWithFilter {
}
/**
* Draws a given chunk
* Draws a given entity
* @param {DrawParameters} parameters
* @param {Entity} entity
*/

View File

@ -527,8 +527,9 @@ storyRewards:
reward_painter:
title: Pintor
desc: El <strong>pintor</strong> ha sido desbloqueado - ¡Extrae vetas de color (igual que lo haces con las figuras) y combínalas con una figura en el pintor para colorearlas! <br><br>PD: Si tienes alguna forma de daltonismo, ¡hay un <strong>modo para daltonicos</strong> en las configuraciones!
desc: >-
El <strong>pintor</strong> ha sido desbloqueado - ¡Extrae vetas de color (igual que lo haces con las figuras) y combínalas con una figura en el pintor para colorearlas! <br><br>PD: Si tienes alguna forma de daltonismo, ¡hay un <strong>modo para daltonicos</strong> en las configuraciones!
reward_mixer:
title: Mezclador de Color
desc: El <strong>mezclador</strong> ha sido desbloqueado - ¡Combina dos colores usando <strong>mezcla aditiva</strong> con este edificio!
@ -592,9 +593,9 @@ storyRewards:
Este nivel no da recompensa, ¡pero el siguiente si! <br><br> PS: Mejor no destruyas la fábrica que tienes - ¡Necesitarás <strong>todas</strong> esas figuras más adelante para <strong>desbloquear mejoras</strong>!
no_reward_freeplay:
title: Siguiente Nivel
desc: >-
¡Felicidades! ¡Por cierto, hay más contenido planeado para el juego completo!
title: Siguiente Nivel
desc: >-
¡Felicidades! ¡Por cierto, hay más contenido planeado para el juego completo!
settings:
title: Opciones
@ -718,10 +719,10 @@ settings:
title: Modo para Daltónicos
description: Activa varias herramientas que facilitan jugar si tienes alguna forma de daltonismo.
rotationByBuilding:
title: Rotación por tipo de edificio
description: >-
Cada tipo de edificio recuerda la última rotación que seleccionaste individualmente.
Esto puede ser mucho más cómodo si cambias a menudo entre colocar diferentes tipos de edificio.
title: Rotación por tipo de edificio
description: >-
Cada tipo de edificio recuerda la última rotación que seleccionaste individualmente.
Esto puede ser mucho más cómodo si cambias a menudo entre colocar diferentes tipos de edificio.
keybindings:
title: Atajos de Teclado

View File

@ -406,7 +406,7 @@ ingame:
purple: 보라
cyan: 청록
white: 하양
uncolored:
uncolored:
shapeViewer:
title: Layers
empty: Empty
@ -641,7 +641,7 @@ settings:
description: >-
키보드를 사용할 때, 화면 이동 속도를 설정합니다.
speeds:
super_slow:매우 느리게
super_slow: 매우 느리게
slow: 느리게
regular: 보통
fast: 빠르게
@ -696,7 +696,7 @@ settings:
description: >-
활성화 시키면, 터널을 설치하는 것이 자동적으로 불필요한 벨트를 없앱니다.
또한, 터널을 당겨서 남는 터널을 없앱니다.
vignette:
title: 삽화
description: >-
@ -722,15 +722,15 @@ settings:
title: 자르기/삭제 경고기능 끄기
description: >-
100개 이상의 건물을 자르기/삭제할 때 경고창이 나오지 않게 합니다.
enableColorBlindHelper:
title: 색맹 모드
description: 색맹이 게임을 플레이하는데 도움을 주는 다양한 도구를 활성화 시킵니다.
rotationByBuilding:
title: 건물 유형에 따른 방향
description: >-
각 건물 유형은 최근에 설정한 방향을 개별적으로 기억합니다.
다른 유형의 건물 배치 간에 자주 방향을 전환할 경우, 이 방법이 더 편할 수 있습니다.
title: 건물 유형에 따른 방향
description: >-
각 건물 유형은 최근에 설정한 방향을 개별적으로 기억합니다.
다른 유형의 건물 배치 간에 자주 방향을 전환할 경우, 이 방법이 더 편할 수 있습니다.
keybindings:
title: 키바인딩