Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several navigation fix #10406

Conversation

HexatomicRing
Copy link

  • Path-finding can now identify the direction of stairs, avoiding jumping up stairs from the side.
  • Path-finding can now identify doors. Citizens and intruders now prefer paths with fewer doors to open.
  • Modified the drop cost in path-finding. 1 falling damage cost 25 in addition. Swimming enter cost is lowered so that citizens will drop in water to avoid falling damage. (In practical situations, it may fail because citizens sometimes move too fast to drop into the water)
  • I am also preparing another PR to enable citizens to use lever to toggle rails at a T-cross railway.

Testing

  • [√] Yes I tested this before submitting it.
  • [×] I also did a multiplayer test.

Review please

Validated the facing of stairs while computing jumping cost.
Modified some path-finding cost to be closer to its real time cost.
Added path-finding cost for opening a door.
Simplified the stair validation logic
@Talyda
Copy link
Contributor

Talyda commented Nov 5, 2024

Don't make intruders prefer a path with fewer doors! That was such a good trap in the raid stream LOL!
(not a dev - just someone who watched the stream, and thought that was really clever!)

@Thodor12
Copy link
Contributor

Thodor12 commented Nov 5, 2024

Don't make intruders prefer a path with fewer doors! That was such a good trap in the raid stream LOL! (not a dev - just someone who watched the stream, and thought that was really clever!)

You have to see path finding cost as "the path of least resistance", if there's no other option than doors, they'll use the doors anyway.

@Talyda
Copy link
Contributor

Talyda commented Nov 5, 2024

You have to see path finding cost as "the path of least resistance", if there's no other option than doors, they'll use the doors anyway.

Ah, fair point! =D

@@ -917,15 +920,32 @@ protected double computeCost(

if (!isDiving)
{
if (dY != 0 && !(ladder && parent.isLadder()) && !(Math.abs(dY) == 1 && below.is(BlockTags.STAIRS)))
boolean correctlyOnStairs = false;
if(Math.abs(dY) == 1 && below.getBlock() instanceof StairBlock && below.getValue(StairBlock.HALF) == Half.BOTTOM)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat your code to ensure it's up to the defined code style (in this case, space between if and (

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reformat your code to ensure it's up to the defined code style (in this case, space between if and (

Done.

@HexatomicRing
Copy link
Author

Don't make intruders prefer a path with fewer doors! That was such a good trap in the raid stream LOL! (not a dev - just someone who watched the stream, and thought that was really clever!)

While testing, citizens can open a door instantly. But they always take many seconds to open a door while playing, and they only need to walk two extra blocks to get around. I've really had enough. 😭

Just set the open door cost of intruders to 0 to trap them. 👿

@HexatomicRing HexatomicRing closed this by deleting the head repository Nov 6, 2024
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.

3 participants