DFHack / dfhack

Memory hacking library for Dwarf Fortress and a set of tools that use it
Other
1.87k stars 471 forks source link

Box select (automaterial?) allows placing constructions at map edge #1819

Open Bumber64 opened 3 years ago

Bumber64 commented 3 years ago

When designating constructed walls with the "Box select" option (which seems to be associated with the automaterial/buildingplan plugin,) it will allow placement of walls at the edge of the map if some of the walls are in valid locations. If the first corner selected is in the invalid map edge area, only that tile will be designated against placement rules. If the second corner selected is in the invalid map edge area, all tiles will be designated against placement rules.

There's also an indicator for "Ignore Building Restrictions". It's not clear what that indicates, or if it can be toggled somehow.

myk002 commented 3 years ago

"Ignore Building Restrictions" means that in box select mode, normal rules on where you can place buildings are ignored:

The first two are good things (they're conveniences, not cheats), but I'm not sure what the correct behavior should be here with regards to the map edge. Should we always ignore or always enforce? How many "Building Restrictions" do we want to ignore?

I'm leaning towards "always enforce". Box select isn't intended as a cheat mode. We could make this change in checkBuildingTiles() in library/modules/Building.cpp: https://github.com/DFHack/dfhack/blob/develop/library/modules/Buildings.cpp#L673-L682.

Is there any easy way to look up programatically how far a building of a particular type needs to be from a map edge, or do we need to write a big switch statement?

lethosor commented 3 years ago

Is there any easy way to look up programatically how far a building of a particular type needs to be from a map edge, or do we need to write a big switch statement?

Is there much variation? I thought most of them needed to be built either 5 or 10 tiles from the map edge.

myk002 commented 3 years ago

no, not a lot of variation, but all building types would need to be covered (at least in groups). what about custom/modded building types, though?