Admin Surface tab: blank/planet/space-platform creation + Surface Cheats relocation#57
Merged
Merged
Conversation
Adds an admin-only Surface submenu with a name field and create button to create blank surfaces on demand. New surfaces appear live in the Surface Cheats target list via an on_surface_created handler. Backend creation logic is reachable through the remote interface for testing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a Space-Age-gated space-platform creation path to the Surface submenu. The submenu now mirrors the Cheats three-column navigation: a Surface button column (Blank surface / Space platform) opens each section's content as a sub-sub-menu frame beside it. The platform section has a name field and a planet drop-down (enumerated from game.planets, defaulting to nauvis); creating a platform places a hub via the starter pack. A shared resolve_force helper makes the remote wrapper headless-safe (falls back to the default 'player' force) so the behavior tests can drive it without a connected player. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Surface Cheats now lives in the Surface button column alongside the blank-surface and space-platform creation tools, grouping all surface tools together. Its content is still built by the existing cheats machinery via a parallel registry whose container resolves to the Surface submenu, so target selection, select-all, cheat toggles, live refresh, and access gating all continue to work unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Documents the three-level menu hierarchy, the three-column nav pattern, the shared style vocabulary, event-wiring chain, live-refresh, and the headless-safe backend/remote patterns so new menus stay consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a planet-surface creation path as a third section in the Surface submenu (Space Age only). Admins pick a planet from an independent drop-down and create its surface; if the surface already exists the action is a harmless no-op reported as 'already existed'. New surfaces appear live in the Surface Cheats target list. Also aligns the create-button placement and styling across all three sections (button below the inputs, auto-sizing small_default_bold_button so longer captions are not clipped) and fixes a verify.py assertion failure-name list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Artifacts | Task deep link | PR Walkthrough (alpha)
What problems was I solving
CreativeMod is about removing the progression grind, yet it had no surface-creation feature anywhere. An admin who wanted a fresh space platform to prototype a design, or a planet surface that hadn't been generated yet, had to play the game normally to get there.
After this PR, an admin can create surfaces on demand from a new Surface submenu:
Every freshly created surface immediately appears in the Surface Cheats target list for all eligible players — no menu reopen or surface change required. Space-Age paths are feature-gated in both the UI and the backend, so vanilla configurations simply don't see (or accidentally trigger) them.
What user-facing changes did I ship
How I implemented it
The work shipped as three vertical slices, each a full path from backend logic → remote-interface entry point → admin GUI control → live list refresh. See the PR Walkthrough above for an interactive, inline-diff tour.
Backend (
scripts/surface-creation.lua)(success, value-or-error)result so GUI and remote share one code path.space_travel; validates force + planet, creates the platform with the starter pack, thenapply_starter_pack()so the hub is placed immediately.{ surface, already_existed }so a re-create reports success, not an error.GUI (
scripts/gui-menu-surface.lua,scripts/gui-menu.lua)game.planetsin a deterministic sorted order, defaulting to nauvis, so aselected_indexresolves back to a planet id with no per-player state stored.surfaceentry added tosubmenus_gui_data, gated on rawplayer.admin, plus the click/selection fan-outs.Event wiring (
scripts/events.lua,scripts/gui.lua,scripts/gui-menu.lua,scripts/gui-menu-cheats.lua)events → gui → gui_menu → gui_menu_cheatschain. It routes throughadd_or_remove_target_in_cheats_menu_for_all_players, whose per-target access check makes the live refresh honor each player's surface-visibility rights for free.Remote interface (
scripts/remote-interface.lua)resolve_forcehelper that falls back togame.forces["player"]when no player index is given — what lets the headless behavior tests drive force-owning creation with no connected player.Docs (
GUI-DESIGN-SYSTEM.md,README.md)Deviations from the plan
Compared against the structure outline (
04-structure-outline-surface-creation.md).Implemented as planned
create_blank_surface,create_space_platform,create_planet_surface) with the specified validation, return shapes, andspace_travelfeature-gating in both UI and backend.get_container_name/create_or_destroy_menu_for_player/on_gui_click/on_gui_selection_state_changed, two independent planet drop-downs, and admin-only gating.on_surface_createdforwarded down the existing event chain into a live Surface Cheats refresh.resolve_forceheadless fallback;control.luarequires inserted beforegui-menu;defines.lua/ locale /.luacheckrcupdated.Deviations/surprises
surface_cheats_menus_gui_datastruct, a lazyget_container_name_functionwrapper (to dodge a circular require), a new publiccreate_or_destroy_surface_cheats_menu_for_player, and a dedicated dispatch block ingui_menu_cheats.on_gui_click— not just theon_surface_createdaddition the plan mentioned.label | textfield | create-buttonframe Phase 1 described. Structural upgrade, not a defect.Additions not in plan
scripts/cheats.lua) — unrelated to surface creation, addressed on this branch (Factorio 2.1.7 changedteleport()to no longer implicitly exit remote view).GUI-DESIGN-SYSTEM.md(+129 lines) — institutional knowledge captured while building the submenu.resolve_forceextracted as a named helper; nauvis pre-selection as the default in both drop-downs.Items planned but not implemented
selected_indexat create-time (the plan permitted either; no functional impact).How to verify it
git fetch origin git checkout admin-surface-and-space-platform-creation-tool # Headless behavior + static + load checks (sandbox has Space Age enabled) uv run verify.py static uv run verify.py load uv run verify.py behaviorManual Testing
Automated Tests
verify.py behavioradds 10 RCON asserts in the Space-Age sandbox: blank new/duplicate, platform new + hub-valid, planet new/exists/noop/no-duplicate.Description for the changelog
Add an admin-only Surface tab to create blank surfaces (and, on Space Age, space platforms with a hub and planet surfaces) on demand, relocate Surface Cheats into it, and fix Teleport in remote view.