Lift unlocking into first-class unlock groups defined in unlocks.toml, so one defence-station drop can grant a bundle of ships/modules/buildings/ recipes at once (e.g. the salvager module + salvage bay), and buildings can now be locked at game start and unlocked via a drop. Config: - New UnlocksConfig + ConfigLoader::loadUnlocks + validateUnlocks (unknown/ duplicate/non-assembler grants, unknown requires, empty group all fail load). - Drop unlock_at_station_level/unlock_requires from ship/module/recipe defs; add unlocked_at_start bool to recipes for graph-unreachable base recipes. Simulation: - Track awarded groups + per-building unlock state; an item starts unlocked iff no group grants it. Rework generateSchematicChoices/applySchematicChoice to operate on groups (grant all members at once). Extend state checksum. - isBuildingUnlocked query; tryPlaceBuilding rejects locked types. UI: - Build-menu buttons for locked buildings start hidden, revealed via a new UnlockedBuildingsChangedEvent (emitted from GameWorldView's poll loop). - Schematic choice dialog lists a group's granted items. - Blueprint placement excludes locked building types (REQ-LOCK-UI-BLUEPRINT). Data: unlocks.toml (app + test) reproduces the prior per-item gates as singleton groups and adds salvage_operations (salvager + salvage_bay, lvl 1) and reprocessing (reprocessing_plant, lvl 2). Tests: rewrote unlock/config/recipe-schematic/artifact/wave/shipyard tests for the group model; added UnlockGroupTest. All 443 cases pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y7N59FsLA5e2kuVdqe4Uhc
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
// The kind of a single granted schematic within an unlock option.
|
|
enum class SchematicType
|
|
{
|
|
Ship,
|
|
Module,
|
|
Building,
|
|
Recipe
|
|
};
|
|
|
|
// One item granted by an unlock group (REQ-LOCK-EXPLICIT), shown in the
|
|
// schematic choice dialog's granted-items list.
|
|
struct GrantedSchematic
|
|
{
|
|
SchematicType type;
|
|
std::string id;
|
|
std::string displayName;
|
|
};
|
|
|
|
// One option presented to the player in the schematic choice dialog
|
|
// (REQ-DEF-SCHEMATIC-DROP). Built by the simulation when enemy stations are
|
|
// destroyed; the UI reads these to populate the dialog. A non-artifact option
|
|
// represents one unlock group; selecting it awards the whole group.
|
|
struct SchematicChoiceOption
|
|
{
|
|
bool isArtifact = false;
|
|
|
|
// Unlock group id (empty for the artifact option).
|
|
std::string unlockGroupId;
|
|
|
|
// Display name shown as the option's title: the unlock group's derived name,
|
|
// or "Artifact" for the artifact option.
|
|
std::string displayName;
|
|
|
|
// The ships, modules, buildings, and assembler recipes this group grants
|
|
// (empty for the artifact option).
|
|
std::vector<GrantedSchematic> grantedItems;
|
|
|
|
// Ids of miner/assembler recipes that would newly become implicitly
|
|
// unlocked (REQ-LOCK-IMPLICIT) if this option is selected. Sorted
|
|
// alphabetically by display name; empty if none.
|
|
std::vector<std::string> newlyUnlockedRecipeIds;
|
|
};
|