-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parametric mapgen part 3: Support mapgen parameters in nests #50681
Parametric mapgen part 3: Support mapgen parameters in nests #50681
Conversation
As expected, CI fails with |
#50678 should fix it. |
Allow dumping a weighted list to a string for debug purposes.
Previously when placing an overmap special on top of an existing overmap special (e.g. via the debug menu) the parameters for the old one would persist and the new one would lack its parameters. Instead, overwrite the old with the new.
We want mapgen parameters to work inside nested mapgen, at all scopes. To make this work we lift all parameters from nests to overmap terrains before lifting again from overmap terrains to overmap specials. At mapgen time, the arguments chosen for these parameters cascade down in the opposite direction.
A simple bugfix. Previously we were generating these arguments but not passing them.
State the two distributions so that it is easier to figure out where each is coming from and why they are conflicting.
Use the new functionality of mapgen parameters in nests to choose a random colour of carpet for each carpet used in a nested mapgen using house_w_nest_palette. Previously there was a separate symbol for each carpet colour but only 6 (red carpet) was ever used. Remove the unused symbols and repurpose 6 to mean "random carpet". Make the parameter of nest scope so each nest can choose a carpet colour independently.
ec89f03
to
87ae6fa
Compare
Rebased to pull in that fix. |
Looks like another similar issue has been detected in the mods. I will investigate. |
Was caused by this chunk of json referring to an invalid nested id |
Ok, everything passed now (except the LGTM failure which I think is unrelated). |
Summary
Infrastructure "Support mapgen parameters in nests"
Purpose of change
We want mapgen parameters to be usable within nested mapgen.
Allow nests to be a scope for mapgen parameters.
Have more colours of carpets in houses.
Describe the solution
The parameters needed by a particular nest must be lifted from that nest to the
overmap_terrain
s using the nest and thence to theovermap_special
s using thoseovermap_terrain
s. Do that at data finalization time.Then, the nest's parameters are automatically chosen at mapgen time just like other mapgen parameters are.
Note that we need to extract the parameters for all possible nests, which can be quite a few within a particular overmap special.
Also, some incidental changes made along the way:
nest
-scope parameters.nest
-scope parameters to choose carpet colours in carpets placed in houses via nests usinghouse_w_nest_palette
.On the last point, these changes discovered that fbmw_room2_metal_northeast uses an invalid id
fbmw_room2_metal
. An error message about this may appear in the CI for this PR, but it's not a new problem, just a newly detected one. @curstwist has kindly offered to look into the proper fix. We might want to wait for that fix before merging this PR.Describe alternatives you've considered
I previously tried just trying to find all the parameters at mapgen time, by recursively searching through nests, but that was less practical, and it would also be slower.
Testing
I picked one particular nest which places a bedroom with a carpet and used it for testing. I forced it to always spawn on the top floor of
garden_house_1
.Here are some screenshots of two different carpet colours being chosen for that nest:
I tested the above with the carpet type parameter being of
nest
scope and ofovermap_special
scope, both worked. Currently I don't have a good example on an existing map where it makes sense to have anovermap_special
-scoped parameter . @curstwist has an idea for one in the new modular labs, but it will have to wait until mapgen parameters support furniture (currently they only support terrain).Additional context
Continuing the work from #48529 and #49980.