The primary reason for https://github.com/CleverRaven/Cataclysm-DDA/pull/21900 was that I wanted to make json labs possible.
That PR isn’t enough, as it does not account for lab piece connections: two lab pieces need to have doors between them, while lab adjacent to rock should not have doors to nowhere.
I see two ways of connecting lab pieces:
[ul][li]Crude: change lab tile type from “lab”/“ice_lab”, to one that explicitly mentions connections, then enumerate all possibilities. For example, “lab_NSE” means “lab tile that connects to north, south, and east”[/li]
[li]Conditional mapgen nesting: add a nested mapgen piece on a condition[/li][/ul]
The first option is easy, but tedious, menial, can’t be easily verified without going through all options.
The latter option, while very flexible, could be a bit complex to use: you’d have to define the condition somehow, then apply it to something. That something would most likely be a nested mapgen entry.
This means that I’d probably need to write a “mapgen condition structure”, which would look roughly like one of those (not sure which is the best):
Option 1:
"place_nested": [
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 0, "conditions": [ { "condition_type": "neighbor_type", "dir": "north", "allowed_ids": [ "lab", "lab_ice" ] } ] }
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 23, "conditions": [ { "condition_type": "neighbor_type", "dir": "south", "allowed_ids": [ "lab", "lab_ice" ] } ] }
...
]
Option 2:
"place_nested": [
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 0, "neighbors": [ [ "lab", "lab_ice" ], "any", "any", "any" ] },
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 23, "neighbors": [ "any", [ "lab", "lab_ice" ], "any", "any" ] },
...
]
Option 3:
"conditionals": [
{
"conditions": [ { "condition_type": "neighbor_type", "dir": "north", "allowed_ids": [ "lab", "lab_ice" ] } ]
"place_nested": [
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 0 }
]
},
{
"conditions": [ { "condition_type": "neighbor_type", "dir": "south", "allowed_ids": [ "lab", "lab_ice" ] } ]
"place_nested": [
{ "entries": [ [ "lab_door_horiz", 100 ] ], "x": 12, "y": 23 }
]
},
...
]
Option 4:
"conditionals": [
{
"conditions": [ { "condition_type": "neighbor_type", "dir": "north", "allowed_ids": [ "lab", "lab_ice" ] } ]
"place_terrain": [
{ "ter": "t_metal_door", "x": 12, "y": 0 },
{ "ter": "t_metal_door", "x": 13, "y": 0 }
]
},
{
"conditions": [ { "condition_type": "neighbor_type", "dir": "south", "allowed_ids": [ "lab", "lab_ice" ] } ]
"place_terrain": [
{ "ter": "t_metal_door", "x": 12, "y": 23 },
{ "ter": "t_metal_door", "x": 13, "y": 23 }
]
},
...
]
Option 3/4 (those are basically one thing, just expressed differently) is interesting because it would allow defining entire conditional mapgen entries without nesting. That is, you could use this syntax to overwrite a palette based on conditions.
Option 2 is the least flexible, only useful for nesting based on neighbors. But it is also the simplest and least likely to lead to problems when some modder implements a complex mapgen entity on hacks and errors in implementation.
Option 1 is a compromise: only useful for nesting, but probably much easier to implement than 3/4.
Any other options? Is this good enough to be useful for anything other than lab mapgen?