Skip to content

Flat test surface + ignore-surface-conditions cheat#59

Merged
jodli merged 4 commits into
masterfrom
feat/flat-test-surface
Jun 29, 2026
Merged

Flat test surface + ignore-surface-conditions cheat#59
jodli merged 4 commits into
masterfrom
feat/flat-test-surface

Conversation

@jodli

@jodli jodli commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Artifacts | Task deep link

What problems was I solving

The "Create Surface → Blank surface" option called game.create_surface(name) with no MapGenSettings, so the default map generator ran and produced full terrain — water, trees, resources, cliffs, decoratives, and a random biome mix. That is useless for build prototyping and benchmarking, where you want a genuinely empty, flat canvas.

This PR delivers two related build-testing features:

  1. A flat test surface — "Blank surface" now produces an empty, flat, infinite, buildable surface (no resources, water, cliffs, trees, decoratives, or enemies; always day) with a creation-time floor dropdown (Lab tiles / Concrete / Refined concrete).
  2. An "Ignore surface conditions" cheat — a per-surface on/off toggle in the existing Surface Cheats menu that lets planet-gated buildings be placed and planet-gated recipes (Foundry, Metallurgic science pack, Big mining drill, Turbo transport belt) be crafted on the selected surface(s).

Both work with and without Space Age.

What user-facing changes did I ship

How I implemented it

Flat surface generation

  • scripts/surface-creation.luacreate_blank_surface(name) becomes create_blank_surface(name, floor). A module-level floor_options table (lab → no tile, concrete, refined-concrete) defines the dropdown order and is shared with the GUI; resolve_floor defaults to lab tiles for nil/unknown values. The surface is created with flat MapGenSettings (default_enable_all_autoplace_controls = false, no_enemies_mode, peaceful_mode, starting_area = "none", cliffiness = 0, enemy-base-intensity = 0), then always_day = true. Lab-tile surfaces set generate_with_lab_tiles = true (engine-native, no chunk handler); concrete variants record the tile in per-surface storage for the chunk handler.

Per-surface floor tracking + chunk handler

  • scripts/global-util.lua — New storage.creative_mode.surface_cheats.flat_test_floor table (keyed by surface.index → tile name), mirroring the existing dont_generate_enemy init pattern.
  • scripts/cheats.lua — The existing single on_chunk_generated handler is extended: for tracked concrete/refined surfaces it lays the configured tile over the chunk via set_tiles and clears stray decoratives. No second event registration is added.

Floor dropdown GUI

  • defines.lua — New surface_blank_floor_label / surface_blank_floor_drop_down element names.
  • scripts/gui-menu-surface.luabuild_blank_section_content adds a label + drop-down whose items come from surface_creation.floor_options (default index 1 = lab). The create-button handler reads selected_index, resolves the floor key, and passes it to create_blank_surface. The selection-changed handler consumes the dropdown event (selection is read at create time).

Ignore-surface-conditions cheat

  • defines.lua — New ignore_surface_conditions_{container,label,on_button,off_button} names, modeled on peaceful_mode_*.
  • scripts/cheats.lua — Boolean cheat entry modeled on peaceful_mode: get_value_function returns surface.ignore_surface_conditions, apply_to_target_function sets it, and applied messages are printed to the surface.
  • scripts/gui-menu-cheats.lua — A type = on_off cheats_gui_data entry that automatically inherits the shared multi-select surface target picker.
  • locale/en/base.cfg — Caption, tooltip (notes it lifts condition gating only — no lightning/heating/spoilage, lightning rods still unplaceable), and enabled/disabled messages.

Deviations from the plan

Implemented as planned

  • All four phases landed essentially verbatim against the plan: flat_test_floor storage init, the floor_options/resolve_floor/flat-MapGenSettings rework of create_blank_surface, the on_chunk_generated tile-laying extension, the floor dropdown GUI, the ignore_surface_conditions cheat data + GUI entry + element names, and all six locale strings at their planned anchors.

Deviations/surprises

  • Changelog versioning: the plan said to prepend a new version block (version TBD against RELEASE.md). Instead the two feature bullets were appended to the already-pending Version: 2.3.0 block, and its Date: ???? was filled in as 2026-06-29. This is likely intentional (the release was already pending) but differs from the plan's literal instruction.
  • Floor dropdown placement: the plan's diff context implied the create button lived inside blank_container; in reality the label + dropdown are added to blank_container while the create button stays on frame (its pre-existing parent). Effective layout/behavior is unchanged.
  • Tooltip punctuation: tooltip uses - instead of the planned em-dash . Functionally identical.

Additions not in plan

  • None. All eight changed files map directly to planned phases.

Items planned but not implemented

  • The plan's uv run verify.py shell behavior checks and in-game manual verification steps are process steps, not code, so their execution is not visible in the diff.

How to verify it

Worktree setup

git fetch origin
git worktree add ../creative-mod-pr59 feat/flat-test-surface
cd ../creative-mod-pr59

Automated Tests

uv run verify.py all

Manual Testing

  • Surface → Blank surface: the floor dropdown shows Lab tiles / Concrete / Refined concrete and defaults to Lab tiles.
  • Create with Lab tiles, teleport in: surface is flat, empty (no resources/trees/water/cliffs/enemies), full daylight, lab checkerboard floor.
  • Create with Concrete (and Refined concrete): generated chunks are floored with the chosen tile and free of stray decoratives.
  • Surface Cheats: "Ignore surface conditions" on/off appears and the target picker selects which surface(s) it applies to.
  • With it on, place a Foundry and craft a Metallurgic science pack on a non-Vulcanus surface.
  • Captions/tooltips render with no missing-locale keys; tooltip mentions the no-planet-effects / lightning-rod caveat.

Description for the changelog

"Create Surface → Blank surface" now creates a genuinely flat, empty test surface with a floor dropdown (Lab tiles / Concrete / Refined concrete), plus a new "Ignore surface conditions" Surface Cheat for placing planet-gated buildings and crafting planet-gated recipes anywhere.

jodli and others added 4 commits June 29, 2026 16:37
Make blank surface creation produce a flat, empty, always-day surface
(no resources/water/cliffs/trees/decoratives/enemies) with a per-surface
floor: lab tiles (engine flag) or concrete/refined-concrete laid by the
chunk handler.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…itions cheat

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jodli jodli merged commit ed50e4e into master Jun 29, 2026
2 checks passed
@jodli jodli deleted the feat/flat-test-surface branch June 29, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant