Add /region, fix bounds & improve union perf #1491
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Region viewing command
Adds
/region <region-id>
command, which will display a regions' bounds and blocks.This is useful for mapmakers creating maps, or mapdevs double-checking maps.
Block-bounded off-by-one region fix
Fixes a very old bug with block iterating in regions, where some blocks were excluded. This can affect only contexts where the region is used for block-bounded things, like fill actions, structures, or core, monument or hill definitions; things where pgm wants to "list the blocks" in the region.
Fix impact
Looking thru 2000 maps none of them seem to be affected negatively by this, most will end up with larger iterating area but pgm discards the blocks when checking contains. Only a few (20 maps) had a modified block count included, where the blocks in the region increased count. However we did not find it affecting gameplay (eg: a core definition region being 1 block bigger means nothing if there's no obsidian there, it ends up being exactly the same). Also note this only affects regions defined in non-full-block coordinates, so a cuboid with max=-10.0 is unaffected, one with max=-10.5 will be moved over by one.
Optimization to block-traversing of unions
Additionally optimizes union iterating, where instead of going thru the whole bounds we can take some smarter approaches by iterating the children instead. This is purely a technical change with no gameplay implications.