mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Further work on the energy generator
This commit is contained in:
@@ -4,6 +4,7 @@ import { EnergyGeneratorComponent } from "../components/energy_generator";
|
||||
import { Entity } from "../entity";
|
||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||
import { ShapeDefinition } from "../shape_definition";
|
||||
import { formatBigNumber } from "../../core/utils";
|
||||
|
||||
export class EnergyGeneratorSystem extends GameSystemWithFilter {
|
||||
constructor(root) {
|
||||
@@ -62,15 +63,14 @@ export class EnergyGeneratorSystem extends GameSystemWithFilter {
|
||||
|
||||
// deliver: Deliver
|
||||
// toGenerateEnergy: For <x> energy
|
||||
context.font = "bold 7px GameFont";
|
||||
context.font = "bold 9px GameFont";
|
||||
context.fillStyle = "#64666e";
|
||||
context.textAlign = "left";
|
||||
context.fillText(T.buildings.energy_generator.deliver.toUpperCase(), pos.x - 25, pos.y - 18);
|
||||
context.fillText(T.buildings.energy_generator.toGenerateEnergy.toUpperCase(), pos.x - 25, pos.y + 27);
|
||||
|
||||
context.fillText(
|
||||
T.buildings.energy_generator.toGenerateEnergy.replace("<x>", "" + energyGenerated).toUpperCase(),
|
||||
pos.x - 25,
|
||||
pos.y + 28
|
||||
);
|
||||
context.font = "700 9px GameFont";
|
||||
context.fillStyle = "#dee1ea";
|
||||
context.fillText("" + formatBigNumber(energyGenerated), pos.x + 1, pos.y + 27);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
import { GameSystemWithFilter } from "../game_system_with_filter";
|
||||
import { WiredPinsComponent } from "../components/wired_pins";
|
||||
import { WiredPinsComponent, enumPinSlotType } from "../components/wired_pins";
|
||||
import { DrawParameters } from "../../core/draw_parameters";
|
||||
import { Entity } from "../entity";
|
||||
import { THEME } from "../theme";
|
||||
import { Loader } from "../../core/loader";
|
||||
import { globalConfig } from "../../core/config";
|
||||
|
||||
export class WiredPinsSystem extends GameSystemWithFilter {
|
||||
constructor(root) {
|
||||
super(root, [WiredPinsComponent]);
|
||||
|
||||
this.pinSprites = {
|
||||
[enumPinSlotType.energyEjector]: [Loader.getSprite("sprites/wires/pin-energy-on.png")],
|
||||
};
|
||||
}
|
||||
|
||||
update() {
|
||||
@@ -39,13 +45,12 @@ export class WiredPinsSystem extends GameSystemWithFilter {
|
||||
|
||||
const worldPos = tile.toWorldSpaceCenterOfTile();
|
||||
|
||||
parameters.context.fillStyle = THEME.map.wires.pins[slot.type];
|
||||
parameters.context.beginCircle(worldPos.x, worldPos.y, 5);
|
||||
parameters.context.fill();
|
||||
|
||||
parameters.context.lineWidth = 2;
|
||||
parameters.context.fillStyle = "rgba(0, 0, 0, 0.1)";
|
||||
parameters.context.stroke();
|
||||
this.pinSprites[slot.type][0].drawCachedCentered(
|
||||
parameters,
|
||||
worldPos.x,
|
||||
worldPos.y,
|
||||
globalConfig.tileSize
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user