mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
* added the new splitter * Update base-en.yaml * added the new splitter Update changelog and update translation regarding 20 upgrade tiers, closes #907 * Update base-en.yaml * Added back copy/paste in puzzle mode * fixed rotating non-rotatable buildings as blueprints and made blocker non-rotatable
111 lines
2.4 KiB
JavaScript
111 lines
2.4 KiB
JavaScript
/* typehints:start */
|
|
import { GameRoot } from "../root";
|
|
/* typehints:end */
|
|
|
|
import { Rectangle } from "../../core/rectangle";
|
|
import { types } from "../../savegame/serialization";
|
|
import { enumGameModeTypes, GameMode } from "../game_mode";
|
|
import { HUDPuzzleBackToMenu } from "../hud/parts/puzzle_back_to_menu";
|
|
import { HUDPuzzleDLCLogo } from "../hud/parts/puzzle_dlc_logo";
|
|
import { HUDBlueprintPlacer } from "../hud/parts/blueprint_placer";
|
|
import { HUDMassSelector } from "../hud/parts/mass_selector";
|
|
|
|
export class PuzzleGameMode extends GameMode {
|
|
static getType() {
|
|
return enumGameModeTypes.puzzle;
|
|
}
|
|
|
|
/** @returns {object} */
|
|
static getSchema() {
|
|
return {
|
|
zoneHeight: types.uint,
|
|
zoneWidth: types.uint,
|
|
};
|
|
}
|
|
|
|
/** @param {GameRoot} root */
|
|
constructor(root) {
|
|
super(root);
|
|
|
|
const data = this.getSaveData();
|
|
|
|
this.additionalHudParts = {
|
|
puzzleBackToMenu: HUDPuzzleBackToMenu,
|
|
puzzleDlcLogo: HUDPuzzleDLCLogo,
|
|
blueprintPlacer: HUDBlueprintPlacer,
|
|
massSelector: HUDMassSelector,
|
|
};
|
|
|
|
this.zoneWidth = data.zoneWidth || 8;
|
|
this.zoneHeight = data.zoneHeight || 6;
|
|
}
|
|
|
|
/**
|
|
* @param {typeof import("../meta_building").MetaBuilding} building
|
|
*/
|
|
isBuildingExcluded(building) {
|
|
return this.hiddenBuildings.indexOf(building) >= 0;
|
|
}
|
|
|
|
getSaveData() {
|
|
const save = this.root.savegame.getCurrentDump();
|
|
if (!save) {
|
|
return {};
|
|
}
|
|
return save.gameMode.data;
|
|
}
|
|
|
|
getCameraBounds() {
|
|
return Rectangle.centered(this.zoneWidth + 20, this.zoneHeight + 20);
|
|
}
|
|
|
|
getBuildableZones() {
|
|
return [Rectangle.centered(this.zoneWidth, this.zoneHeight)];
|
|
}
|
|
|
|
hasHub() {
|
|
return false;
|
|
}
|
|
|
|
hasResources() {
|
|
return false;
|
|
}
|
|
|
|
getMinimumZoom() {
|
|
return 1;
|
|
}
|
|
|
|
getMaximumZoom() {
|
|
return 4;
|
|
}
|
|
|
|
getIsSaveable() {
|
|
return false;
|
|
}
|
|
|
|
getHasFreeCopyPaste() {
|
|
return true;
|
|
}
|
|
|
|
throughputDoesNotMatter() {
|
|
return true;
|
|
}
|
|
|
|
getSupportsWires() {
|
|
return false;
|
|
}
|
|
|
|
getFixedTickrate() {
|
|
return 300;
|
|
}
|
|
|
|
getIsDeterministic() {
|
|
return true;
|
|
}
|
|
|
|
/** @returns {boolean} */
|
|
getIsFreeplayAvailable() {
|
|
return true;
|
|
}
|
|
}
|