mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6370] [MERGED] feat(game): a ruleset can offer layers that a game turns on in the setup wizard #7153
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7153
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6370
Author: @kolacheee
Created: 9/19/2026
Status: ✅ Merged
Merged: 9/19/2026
Merged by: @kolacheee
Base:
staging← Head:feat/rulesets-layers📝 Commits (10+)
fce2efefeat(rulesets): a ruleset may ship layers, and a base ruleset may guide world generation655cd4efeat(game): resolve a game's ruleset with its layers, freeze the choice into the pin and guide world generation3569720docs(rulesets): layers in the authoring guide, the setup guide, the capability list and the plana5b939bchore(rulesets): regenerate the published ruleset JSON Schemad805217docs(rulesets): record layers L1 in the plan status line and drop an em dash192f8effeat(game): the setup wizard offers a ruleset's layers and the game plays by them020b760test(game): pin the wizard's layer toggles and the picker hiding layered catalog entriesfdc3695docs(rulesets): record that layers L1 is built on the client too0ba0427fix(game): the wizard sends only the layers the chosen ruleset still declares58b75a6fix(game): a layer cannot remove a value a hide rule reads, and the editor schema asks for one hide comparison📊 Changes
38 files changed (+2427 additions, -71 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
docs/development/game-rulesets-and-sheets-implementation.md(+19 -2)📝
docs/development/optional-agent-packages.md(+26 -0)📝
docs/development/ruleset-5e-2014.example.json(+25 -1)📝
docs/examples/rulesets/ember-roads.json(+20 -1)📝
docs/examples/rulesets/gravewatch.json(+19 -1)📝
docs/extending/ruleset.schema.json(+232 -0)📝
docs/extending/writing-rulesets.md(+70 -0)📝
docs/game/getting-started.md(+2 -0)📝
packages/client/src/components/game/GameCharacterSheet.tsx(+14 -1)📝
packages/client/src/components/game/GameRulesetSheet.tsx(+24 -2)📝
packages/client/src/components/game/GameSetupRulesChooser.tsx(+46 -0)📝
packages/client/src/components/game/GameSetupWizard.tsx(+25 -1)📝
packages/client/src/components/game/GameSurface.tsx(+4 -0)📝
packages/client/src/components/rulesets/RulesetCatalogPicker.tsx(+13 -1)📝
packages/client/src/components/rulesets/RulesetSheetEditor.tsx(+7 -0)📝
packages/client/src/hooks/use-game-ruleset.ts(+36 -4)📝
packages/client/src/hooks/use-game.ts(+22 -4)📝
packages/client/src/lib/game-setup-share.ts(+4 -1)📝
packages/client/src/lib/ruleset-catalog.ts(+20 -0)...and 18 more files
📄 Description
Linked issue
Part of #6314 (ruleset layers, first slice; it does not close the issue). Builds on #6368 (dice pools, merged).
Why this change
optionsrecord, which has existed and stayed empty since slice 1.What changed
layersarray inruleset.json(up to 12). A layer has an id, a label, a summary, optionalconflicts, and effects from a closed list: Game Master guidance and world-generation guidance (appended), enum field values removed (never added, with a replacement default when the default goes), the difficulty ladder replaced, and catalog entries hidden from the picker by one comparison on a declared filter. Base rulesets gain thegm.worldGuidanceslot too, which they lacked.hideWhenrule on the sheet reads; a layer's ladder has the shape of the base kind's and passes that kind's own checks; a hidden-entry rule names a real catalog and filter and compares it the way its type allows.applyRulesetLayers(definition, options)in shared is pure, returns the same object when no layer is on, re-validates its result, and falls back layer by layer so a game can never lose its ruleset to a layer.resolveGameRulesetreturns that effective definition (plus the base one and the active layers' labels), so the check resolver, the Game Master prompt, the sheet block, sheet commands and the battle bridge all play by the layered rules with no change of their own.useGameRulesetdoes the same on the client./game/createvalidates the selection (ruleset_layer_unknown,ruleset_layer_conflict, both 400) and freezes it into the pin. A shared setup file keeps the chosen layers, and ids the installed ruleset no longer has are dropped.layersandgm.worldGuidancefor packages.docs/game/getting-started.md,docs/development/optional-agent-packages.md, the plan (what layers L1 settled, L2 open), the generated schema, and a layer on each of the three example rulesets (Ember Roads "Hard winter", Gravewatch "The long night", the 5e example "Low magic" with a conflicting "High magic").game-ruleset-layers(schema refusals, application order, conflicts, unknown options ignored, same reference with none on, a layer that would not validate is skipped,/game/createrefusals and the frozen pin, the prompt text, the 1.25 gate) and the client laneruleset-layers-client(toggle logic, restore, the picker hiding entries).Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Commands run locally by the agent:
pnpm check(exit 0),pnpm localization:check, the full node regression lane (pnpm regression:node, 325 of 326: the one that did not pass isimage-dimension-limit.regression.ts, which prints that it passed and then does not exit on this machine while it is under load; it is the same pino-pretty worker lifetime that #6359 worked around for the storage shutdown regression, this PR does not touch it, and CI's node lane has passed it on every ruleset PR), and the new regressions. Three complete local CodeRabbit sweeps were run before opening (3, 1 and 0 findings). Fixed: a layer may not remove an enum value that ahideWhenrule on the sheet reads, the editor schema asks for exactly onehidecomparison, and the merged guidance cap counts its separators. One suggestion was declined and the reason is now a comment in the code: caching the layered resolution has nothing stable to key on, because the ruleset registry is deliberately re-read on every call so that install, update and import need no invalidation. The e2e suite was checked by reading it: no spec mentions a ruleset or mocks the ruleset routes, the one unnamed checkbox count in the suite runs on a wizard step where the rules chooser is not mounted, and the specs that create games send no ruleset. Playwright was not run locally.The agent drove a scratch server on port 7820 with a fresh data folder through its API: imported the Ember Roads and 5e examples, and created games. A selection naming a layer the ruleset does not have was refused with
ruleset_layer_unknown, "Low magic" together with "High magic" was refused withruleset_layer_conflict, a game created with "Hard winter" carriedoptions: { "layer.hard_winter": true }in its pin, and a game created without layers carried an empty record as before. The agent could not drive the wizard itself in its browser, so nothing visual below was seen.Still to verify by hand:
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)Docs touched:
CHANGELOG.md,docs/extending/writing-rulesets.md,docs/game/getting-started.md,docs/development/optional-agent-packages.md, the plan, the three example rulesets and the generated schema. The[docs-i18n]follow-up is batched for the ruleset slices.UI evidence (if applicable)
To be added by a human: the wizard's layer toggles with a conflicting layer disabled, and the in-game sheet header of a layered game.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.