Skip to content

map.terrain: a "block" object changes only the keys it gives, keeping the rest of the block #2447

Closed

Description

@elpidioassinaturas

Today: map.terrain's "block" object sets the whole block (#1914). A key left out goes back to its default, not to what the block had. So {"block": {"walls": "#E0D0B0"}} on a block with "extent": [...] and "depth": 300 also puts the extent back to the DEM's and the depth back to half the relief. The same holds for "walls": {"layer": …} and, since #2377, "water": taking the water out of the walls with {"block": {"water": false}} drops the box the user drew. The rest of map.terrain works the other way: a key left out of the call ("exaggeration", "water", "block" itself) stays as it was. In an agent's or a script's session, a block is usually tuned one key at a time (box, then depth, then the walls' layer, then the water), and each step undoes the last.

Proposal

A "block" object changes only the keys it gives; the others stay as the block had them.

  • null for a key puts it back to its default ("extent": null → the DEM's extent, "depth": null → half the relief, "walls": null → #C8B89A with no layer, "water": null or false → no water in the walls).
  • Without a block yet, the keys left out take their defaults, as today.
  • "block": true keeps today's meaning (a block with every default) when there is none. When there is one, it keeps the block as it is.
  • "block": false / null still takes the block off.
  • Inside "walls", the same rule: {"walls": {"layer": "Geologia"}} keeps the walls' colour.
  • The command's output already returns the whole block, so a caller sees what was kept.
  • The map.terrain description and docs/user-guide/maps.md say so: "keys left out stay as they were; null puts one back to its default".

Tests

  • A block with an extent, a depth of 300 and a walls layer, then {"block": {"water": {"depth": 5}}}: extent, depth and walls layer unchanged, water set.
  • Then {"block": {"depth": null}}: depth back to its default, the rest unchanged.
  • No block, then {"block": {"depth": 200}}: the DEM's extent, default walls, depth 200.
  • {"block": {"walls": {"layer": "Geologia"}}} on walls coloured #E0D0B0: the colour is kept.
  • {"block": false}: no block.

Choices in this proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions