1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Merge branch 'master' into cut-paste-blueprints

This commit is contained in:
hexagonhexagon
2020-06-11 18:05:44 -04:00
54 changed files with 4571 additions and 1612 deletions

View File

@@ -175,6 +175,8 @@ export class MetaUndergroundBeltBuilding extends MetaBuilding {
rotationVariant: 0,
connectedEntities: [contents],
};
} else {
break;
}
}
}

View File

@@ -151,6 +151,11 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
return;
}
if (this.root.camera.getIsMapOverlayActive()) {
this.root.soundProxy.playUiError();
return;
}
// Allow clicking an item again to deselect it
for (const buildingId in this.buildingHandles) {
const handle = this.buildingHandles[buildingId];

View File

@@ -2,6 +2,7 @@ import { makeDiv } from "../../../core/utils";
import { T } from "../../../translations";
import { getStringForKeyCode, KEYMAPPINGS } from "../../key_action_mapper";
import { BaseHUDPart } from "../base_hud_part";
import { TrackedState } from "../../../core/tracked_state";
export class HUDKeybindingOverlay extends BaseHUDPart {
initialize() {
@@ -9,6 +10,8 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
this.onSelectedBuildingForPlacementChanged,
this
);
this.trackedMapOverviewActive = new TrackedState(this.applyCssClasses, this);
}
createElements(parent) {
@@ -35,11 +38,17 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
<div class="binding noPlacementOnly">
<div class="binding noPlacementOnly noOverviewOnly">
<code class="keybinding rightMouse"></code>
<label>${T.ingame.keybindingsOverlay.delete}</label>
</div>
<div class="binding noPlacementOnly overviewOnly">
<code class="keybinding rightMouse"></code>
<label>${T.ingame.keybindingsOverlay.createMarker}</label>
</div>
<div class="binding noPlacementOnly">
<code class="keybinding builtinKey">${getKeycode(
KEYMAPPINGS.massSelect.massSelectStart
@@ -70,12 +79,17 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
<label>${T.ingame.keybindingsOverlay.rotateBuilding}</label>
</div>
` +
(this.root.app.settings.getAllSettings().alwaysMultiplace
? ""
: `
<div class="binding placementOnly">
<code class="keybinding builtinKey shift">${getKeycode(
KEYMAPPINGS.placementModifiers.placeMultiple
)}</code>
<label>${T.ingame.keybindingsOverlay.placeMultiple}</label>
</div>
</div>`) +
`
`
);
}
@@ -84,5 +98,11 @@ export class HUDKeybindingOverlay extends BaseHUDPart {
this.element.classList.toggle("placementActive", !!selectedMetaBuilding);
}
update() {}
applyCssClasses() {
this.element.classList.toggle("mapOverviewActive", this.root.camera.getIsMapOverlayActive());
}
update() {
this.trackedMapOverviewActive.set(this.root.camera.getIsMapOverlayActive());
}
}

View File

@@ -98,7 +98,9 @@ export class HUDShop extends BaseHUDPart {
// Set description
handle.elemDescription.innerText = T.shopUpgrades[upgradeId].description
.replace("<currentMult>", currentTierMultiplier.toString())
.replace("<newMult>", (currentTierMultiplier + tierHandle.improvement).toString());
.replace("<newMult>", (currentTierMultiplier + tierHandle.improvement).toString())
// Backwards compatibility
.replace("<gain>", (tierHandle.improvement * 100.0).toString());
tierHandle.required.forEach(({ shape, amount }) => {
const container = makeDiv(handle.elemRequirements, null, ["requirement"]);

View File

@@ -74,9 +74,7 @@ export class HubSystem extends GameSystemWithFilter {
context.fillText("" + formatBigNumber(delivered), pos.x + textOffsetX, pos.y + textOffsetY);
// Required
context.font = "13px GameFont";
context.fillStyle = "#a4a6b0";
context.fillText(
"/ " + formatBigNumber(goals.required),
@@ -85,16 +83,33 @@ export class HubSystem extends GameSystemWithFilter {
);
// Reward
context.font = "bold 11px GameFont";
const rewardText = T.storyRewards[goals.reward].title.toUpperCase();
if (rewardText.length > 12) {
context.font = "bold 9px GameFont";
} else {
context.font = "bold 11px GameFont";
}
context.fillStyle = "#fd0752";
context.textAlign = "center";
context.fillText(T.storyRewards[goals.reward].title.toUpperCase(), pos.x, pos.y + 46);
context.fillText(rewardText, pos.x, pos.y + 46);
// Level
context.font = "bold 11px GameFont";
context.fillStyle = "#fff";
context.fillText("" + this.root.hubGoals.level, pos.x - 42, pos.y - 36);
// Texts
context.textAlign = "center";
context.fillStyle = "#fff";
context.font = "bold 7px GameFont";
context.fillText(T.buildings.hub.levelShortcut, pos.x - 42, pos.y - 47);
context.fillStyle = "#64666e";
context.font = "bold 11px GameFont";
context.fillText(T.buildings.hub.deliver.toUpperCase(), pos.x, pos.y - 40);
context.fillText(T.buildings.hub.toUnlock.toUpperCase(), pos.x, pos.y + 30);
context.textAlign = "left";
}
}