Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
/* 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 { HUDGameMenu } from "../hud/parts/game_menu";
|
|
|
|
import { HUDInteractiveTutorial } from "../hud/parts/interactive_tutorial";
|
|
|
|
import { HUDKeybindingOverlay } from "../hud/parts/keybinding_overlay";
|
|
|
|
import { HUDPartTutorialHints } from "../hud/parts/tutorial_hints";
|
|
|
|
import { HUDPinnedShapes } from "../hud/parts/pinned_shapes";
|
|
|
|
import { HUDWaypoints } from "../hud/parts/waypoints";
|
2021-04-29 16:27:46 +00:00
|
|
|
import { HUDMassSelector } from "../hud/parts/mass_selector";
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
|
2021-04-30 15:57:01 +00:00
|
|
|
this.hiddenHudParts = {
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
[HUDGameMenu.name]: false,
|
2021-04-29 16:27:46 +00:00
|
|
|
[HUDMassSelector.name]: false,
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
[HUDInteractiveTutorial.name]: false,
|
|
|
|
[HUDKeybindingOverlay.name]: false,
|
|
|
|
[HUDPartTutorialHints.name]: false,
|
|
|
|
[HUDPinnedShapes.name]: false,
|
|
|
|
[HUDWaypoints.name]: false,
|
2021-04-29 20:31:06 +00:00
|
|
|
};
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
|
|
|
|
this.setDimensions(data.zoneWidth, data.zoneHeight);
|
|
|
|
}
|
|
|
|
|
|
|
|
setDimensions(w = 16, h = 9) {
|
|
|
|
this.zoneWidth = w < 2 ? 2 : w;
|
|
|
|
this.zoneHeight = h < 2 ? 2 : h;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSaveData() {
|
|
|
|
const save = this.root.savegame.getCurrentDump();
|
|
|
|
if (!save) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
return save.gameMode.data;
|
|
|
|
}
|
|
|
|
|
|
|
|
createCenteredRectangle(width, height) {
|
|
|
|
return new Rectangle(-Math.ceil(width / 2), -Math.ceil(height / 2), width, height);
|
|
|
|
}
|
|
|
|
|
2021-04-29 20:31:06 +00:00
|
|
|
getCameraBounds() {
|
|
|
|
return this.createCenteredRectangle(this.zoneWidth + 20, this.zoneHeight + 20);
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
}
|
|
|
|
|
2021-04-29 20:31:06 +00:00
|
|
|
getBuildableZones() {
|
|
|
|
return [this.createCenteredRectangle(this.zoneWidth, this.zoneHeight)];
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hasHub() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
hasResources() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
getMinimumZoom() {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2021-04-30 12:34:11 +00:00
|
|
|
getMaximumZoom() {
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
|
2021-04-29 16:27:46 +00:00
|
|
|
getIsSaveable() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSupportsCopyPaste() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-04-29 20:31:06 +00:00
|
|
|
throughputDoesNotMatter() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
getSupportsWires() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-04-30 12:34:11 +00:00
|
|
|
getIsDeterministic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
getFixedTickrate() {
|
|
|
|
return 300;
|
|
|
|
}
|
|
|
|
|
Puzzle mode (#1135)
* Add mode button to main menu
* [WIP] Add mode menu. Add factory-based gameMode creation
* Add savefile migration, serialize, deserialize
* Add hidden HUD elements, zone, and zoom, boundary constraints
* Clean up lint issues
* Add building, HUD exclusion, building exclusion, and refactor
- [WIP] Add ConstantProducer building that combines ConstantSignal
and ItemProducer functionality. Currently using temp assets.
- Add pre-placement check to the zone
- Use Rectangles for zone and boundary
- Simplify zone drawing
- Account for exclusion in savegame data
- [WIP] Add puzzle play and edit buttons in puzzle mode menu
* [WIP] Add building, component, and systems for producing and
accepting user-specified items and checking goal criteria
* Add ingame puzzle mode UI elements
- Add minimal menus in puzzle mode for back, next navigation
- Add lower menu for changing zone dimenensions
Co-authored-by: Greg Considine <gconsidine@users.noreply.github.com>
2021-04-12 12:03:47 +00:00
|
|
|
/** @returns {boolean} */
|
|
|
|
getIsFreeplayAvailable() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|