Open LyranRenegade opened 2 years ago
upon further study i am to conclude that the rotation: [0, 3] probably doesn't work and always returns 0
when adding chunks like so
"nested": {
"!": { "chunks": [
[ "roof_5x5_coop", 75 ],
[ "roof_4x4_utility", 25 ]
]
}
}
chunk-code 1
{
"type": "mapgen",
"method": "json",
"nested_mapgen_id": "roof_5x5_coop",
"object": {
"mapgensize": [ 5, 5 ],
"rotation": [ 0, 3 ],
"rows": [
"xxxxx",
"x__tx",
"+__tx",
"xtttx",
"xxxxx"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"terrain": { "_": "t_floor_primitive", "+": "t_chickenwire_gate_c", "x": "t_chickenwire_fence", "t": "t_dirtfloor" },
"furniture": { "t": "f_table" },
"place_loot": [
{ "item": "straw_pile", "x": [ 1, 3 ], "y": 3, "chance": 75, "repeat": [ 1, 3 ] },
{ "item": "straw_pile", "x": 3, "y": [ 1, 3 ], "chance": 75, "repeat": [ 1, 3 ] }
],
"place_monster": [
{ "monster": "mon_pigeon", "x": [ 1, 3 ], "y": [ 1, 3 ], "chance": 60, "pack_size": [ 2, 4 ] },
{ "monster": "mon_chicken", "x": [ 1, 3 ], "y": [ 1, 3 ], "chance": 20, "pack_size": [ 1, 2 ] }
]
}
},
chunk-code 2
{
"type": "mapgen",
"method": "json",
"nested_mapgen_id": "roof_4x4_utility",
"object": {
"mapgensize": [ 4, 4 ],
"rotation": [ 0, 3 ],
"rows": [
"_xxx",
"__ax",
"_xxx",
"__ox"
],
"flags": [ "ERASE_ALL_BEFORE_PLACING_TERRAIN" ],
"terrain": { "_": "t_concrete", "x": "t_sewage_pipe" },
"furniture": { "o": "f_water_heater", "a": "f_air_conditioner" },
"liquids": { "o": { "liquid": "water_clean", "amount": [ 0, 100 ] } }
}
},
I always get this:
= no rotation at all
I don't understand the c++ code enough, what I see is this in mapgen.cpp:
bool mapgen_function_json_nested::setup_internal( const JsonObject &jo )
setting a rotation value from the json in this line
rotation = jmapgen_int( jo, "rotation" );
but not doing anything with that variable so I assume this is some kind of global or a class-variable which seems strange to me but hey, as said i don't fully understand c++ [you'd say this 'rotation' value should be very local]
but I think the problem is with the jmapgen_int function perhaps, which is a heavily overloaded method [which I also don't fully understand] I just found the fitting one for the arguments:
jmapgen_int::jmapgen_int( const JsonObject &jo, const std::string &tag )
which does a check if the array consists of 2 parameters and if so sets a (class-wide?) variable val and valmax and then some other variant of this method spits out a
int jmapgen_int::get() const
{
return val == valmax ? val : rng( val, valmax );
}
But yeah, hope you guys can figure it out, Does that work? DOes it know it should be discrete integers? Does it know it are steps of 90 degrees? In any case, it don't work right
I thought it rotated to match the maps rotation. Só in a house that rotates from facing north to facing East the chunk will also face East now?
yes, they align with the house so to say. I might be getting it wrong, but I assumed rotationL [ 0, 3 ] meant a random orientation [in steps of 90 degrees, something like that is said in the docs]
https://github.com/CleverRaven/Cataclysm-DDA/blob/master/doc/MAPGEN.md#rotate-the-map-with-rotation
Maybe there's a flag or something I'm missing that should be set, but I doubt it because I studied other examples carefully, so it should just be a matter of adding chunks and having them have a rotation array with upper/lower-bounds.
It would be great if that actually worked but it doesnt
@jbytheway I wanted to check with you if the rotation documentation is unclear, incorrect or not working in regards to nested chunk rotation?
Nest rotation was simply never implemented. I agree it is a feature we should have. One complication is that the sanity checking code that verifies nests don't spawn out of bounds will have to account for this.
Nest rotation was simply never implemented. I agree it is a feature we should have. One complication is that the sanity checking code that verifies nests don't spawn out of bounds will have to account for this.
Great! Well, nested chunks must always be square so that shouldnt be a problem right?
Well, nested chunks must always be square so that shouldnt be a problem right?
They do have to be square, but the bounds checking doesn't check the entire square, only those tiles where something is actually placed. So that will change for rotated ones.
Describe the bug
When you place multiple of the same mapgens in one overmap tile, the random rotation will only be determined once and all subsequent nests [with the same id] will have the same rotation.
EDIT: it seems they don't rotate ever.
Steps to reproduce
Make an om map with multiple same mapgen-chunks, with rotation [0, 3]. Watch they always will all face the same direction. See; below example
Expected behavior
You'd expect the rotation to be random for each chunk. [or do anything at all]
Screenshots
No response
Versions and configuration
win 7 exp from 2022-07-24-1210 (a week ago) c2b61d6 (tiles)
Additional context
No response