Skip to content

Improve builder lava safety and pathfinding on 1.21#11652

Open
GeneraBlack wants to merge 1 commit into
ldtteam:version/1.21from
GeneraBlack:feature/1.21-builder-lava-safety
Open

Improve builder lava safety and pathfinding on 1.21#11652
GeneraBlack wants to merge 1 commit into
ldtteam:version/1.21from
GeneraBlack:feature/1.21-builder-lava-safety

Conversation

@GeneraBlack
Copy link
Copy Markdown

Summary

This PR ports and stabilizes our builder and pathing lava-safety changes for the 1.21 branch.

Changes

  • add worker and structure AI debug output for in-game inspection
  • improve builder retreat and safe-stand handling around lava hazards
  • avoid repeated retries on the same blocked hazardous target
  • fix central pathfinding so flowing lava is treated as unsafe
  • add a one-block lava safety margin in central pathfinding

Validation

  • 1.21 build passes
  • 1.21 test task passes
  • in-game behavior verified around flowing lava and builder work positions

Review note

The main intended behavior change is stricter rejection of paths directly adjacent to lava.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

In order for this pull request to be merged, make sure you test whether your changes work.

If the changes are working as intended, remove the https://github.com/ldtteam/minecolonies/labels/undefined label from the pull request.
As long as this label is on the pull request, it will not be merged.
If your pull request made no changes to the source code, the label will not be automatically added to the pull request.

Contributors, please review this pull request!

@GeneraBlack
Copy link
Copy Markdown
Author

This PR also adds builder-side safeguards for unsafe mining positions. Builders now avoid mining setups that could trigger falling blocks above the target, and they will not mine the block beneath their own position when doing so would create an unsafe fall. When possible, they first try to reposition to a safer adjacent stand.

@someaddons
Copy link
Copy Markdown
Contributor

I dont think we should be doing this as the lava scanning during pathfinding adds additional performance overhead and we do not want citizens to be always fully safe. They're less intended like robots and more like humans who do make mistakes, a builder running into a fire from lava occasionally is calculated in, which is why we also have AI specifically for environmental damage, where they walk away from the danger

@Raycoms
Copy link
Copy Markdown
Contributor

Raycoms commented May 19, 2026

I think some of the debug things are nice, and if there is any bug where the builder could mine a block and fall that should not happen (there should be checks in place for this, if not we have to fix this).

For the general pathing it is a large overhead for the lava edge case at the moment. If anything I think we could mark on detecting lava in the pathfinder the nearby nodes (if exist) as "lava nearby" and give them a higher cost.

@GeneraBlack
Copy link
Copy Markdown
Author

I think some of the debug things are nice, and if there is any bug where the builder could mine a block and fall that should not happen (there should be checks in place for this, if not we have to fix this).

For the general pathing it is a large overhead for the lava edge case at the moment. If anything I think we could mark on detecting lava in the pathfinder the nearby nodes (if exist) as "lava nearby" and give them a higher cost.

yea the builder doesnt check if he would fall if he removes a block seen it multiple times today XD quiet funny to watch how he runs up the stairs just to fall again XD

@Raycoms
Copy link
Copy Markdown
Contributor

Raycoms commented May 20, 2026

I think some of the debug things are nice, and if there is any bug where the builder could mine a block and fall that should not happen (there should be checks in place for this, if not we have to fix this).
For the general pathing it is a large overhead for the lava edge case at the moment. If anything I think we could mark on detecting lava in the pathfinder the nearby nodes (if exist) as "lava nearby" and give them a higher cost.

yea the builder doesnt check if he would fall if he removes a block seen it multiple times today XD quiet funny to watch how he runs up the stairs just to fall again XD

then we definitely need to make the mining steps more sensible. Do you mean mining during the clearing step, or do you mean during deco? (Placing air in the deco step)

@Thodor12 Thodor12 removed the Untested label May 22, 2026
@GeneraBlack
Copy link
Copy Markdown
Author

I think some of the debug things are nice, and if there is any bug where the builder could mine a block and fall that should not happen (there should be checks in place for this, if not we have to fix this).
For the general pathing it is a large overhead for the lava edge case at the moment. If anything I think we could mark on detecting lava in the pathfinder the nearby nodes (if exist) as "lava nearby" and give them a higher cost.

yea the builder doesnt check if he would fall if he removes a block seen it multiple times today XD quiet funny to watch how he runs up the stairs just to fall again XD

then we definitely need to make the mining steps more sensible. Do you mean mining during the clearing step, or do you mean during deco? (Placing air in the deco step)

during the clearing step the miner doesnt check if he is standing on the block he is mining, that can be prevented by checking his current position and the next block position to clear if x and z of the block match with the x z positioon of the miner you can simply return invalid working position.

That basicly would prevent the miner from dropping or getting burried by gravel. My solution was a bit "overenginered"
(Forbids standing on top or under a block to mine)

the Y cordinate is basicly irrelevant in that calculation.

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.

4 participants