Skip to content

Fix placement validation and eliminate orphan bridge plans#37

Open
derekShaheen wants to merge 5 commits into
Pointifix:masterfrom
derekShaheen:master
Open

Fix placement validation and eliminate orphan bridge plans#37
derekShaheen wants to merge 5 commits into
Pointifix:masterfrom
derekShaheen:master

Conversation

@derekShaheen
Copy link
Copy Markdown

Problem found where bridges and sometimes extractors would be placed on invalid tiles.

PR centralizes all placement checks into a single validation layer in Util.java and add a dry-run phase so plans are only submitted to the build queue after the full set is validated.

Changes:

  • Util.java — Added canPlaceBlock, canPlacePlan, canPlaceWithoutPlanCollision, footprintOverlapsPlanned, isWithinWorld, and commitPlans. All callers now funnel through these instead of ad-hoc checks.
  • OptimizationDrill.java — Pre-filter candidates with full footprint validation. Dry-run all drill + water extractor + power node plans before committing. Fixed incorrect settings key mapping (mechanicalDrill was reading "laser-drill-max-tiles").
  • BridgeDrill.java — Bridges are only placed if they connect to another planned bridge or an existing bridge on the map. A pruning loop removes plans whose targets were rejected, iterating until stable. Existing map bridges are recognized as valid connection partners.
  • WallDrill.java — All bore, duct, beam node, and connection plans go into a shared dry-run list validated via canPlaceWithoutPlanCollision before a single commitPlans call. Fixed potential infinite loop in connecting-tile traversal.

Debug support: Util.DEBUG flag logs rejection reasons (out of bounds, overlap, Build.validPlace failure) to the Mindustry console.

Testing:

  • Find a resource near uneven walls (looking for stairstepped sort of walls) and use autodrill. Find an instance where invalid bridges occur. Save game
  • Update to this version, undo that building plan, place again. Bridges/extractors should place as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant