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

Auto-planting gratuitously paths into dangerous terrain #37928

Closed
jkraybill opened this issue Feb 11, 2020 · 1 comment · Fixed by #37964
Closed

Auto-planting gratuitously paths into dangerous terrain #37928

jkraybill opened this issue Feb 11, 2020 · 1 comment · Fixed by #37964
Labels
<Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor

Comments

@jkraybill
Copy link
Contributor

jkraybill commented Feb 11, 2020

Describe the bug

When using (O) to Far(m) plots, the pathing for the player can be taken into dangerous territory when completely unnecessary. This can generate the "Really step into barbed wire fence?" type of message a LOT, especially if the farm plot is bordered by dangerous territory like a barbed wire fence.

Steps To Reproduce

Two basic use cases that feel like they should be dealt with:

  • Create a farm plot tightly bordered by barbed wire (e.g. a 3x3 plot, bordered by a 5x5 barbed wire fence).
  • Zone it as a plot, then (O) and (m) to "Farm plots" while inside the plot and holding the given seeds.
  • Very often, you will get interrupted with the "Really step into barbed wire fence?" message when attempting to plant the barbed-wire-bordered tiles because the algorithm is trying to place you on the fence tiles to plant.

As a real-world example, in this screenshot, the player has two isolated squares to the west that are plantable. They are zoned as farm plot. In many cases, doing O-m will immediately generate the "Really...?" message. (Probability seems roughly equal to the distribution of adjacent tiles that are fence -- e.g. 3/8 for edge-facing squares, 5/8 for corner squares)

image

OR

  • Create a farm plot with a barbed wire fence on one border (e.g. a 3x3 plot, with a 3-long barbed wire fence to the direct east).
  • Zone it as a plot for a given seed. Stand directly east of the fence with the seeds in hand.
  • Do (O) and (m) to "Farm plots".
  • The character will not do a simple path around the fence, you will get the "Really step into barbed wire fence?" message.

Same happens if the needed tool (a digging tool, if the earth is untilled) is on the other side of the fence.

Another real-world screenshot of the above: in this screenshot, the digging tool is to my east-southeast outside of the fence, the plot is to my west. There is a safe gap in the fence, but (m) does not path through that, it gives the "Really...?" message 100% of the time.

image

Expected behavior

In case 1 above, it seems pretty simple that if there is a destination planting square, the game should not attempt to place me on the most dangerous adjacent tile to plant that square. It should select the safest adjacent tile to do the planting. This would prevent the "Really...?" message when the border-level tiles get planted in most cases.

Case 2 is obviously a LOT more complex, and less critical, but ideally I should select a path that is safe if it's not massively out of the way of the most direct route. This will take some cost-based pathing but this same issue has come up in other issues like auto-move so maybe will be re-usable logic?

Screenshots

See above.

Versions and configuration

  • OS: Windows
    • OS Version: 10.0 1903
  • Game Version: 0.D-11809-g78e6e40 [64-bit]
  • Graphics Version: Tiles
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Beta National Guard Camp [national_guard_camp],
    More Locations [more_locations],
    Fuji's More Buildings [FujiStruct],
    More City Locations [cityside],
    Urban Development [Urban_Development],
    No Fungal Monsters [No_Fungi]
    ]
@kevingranade kevingranade added <Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor labels Feb 11, 2020
@kevingranade
Copy link
Member

It should probably just never path into dangerous terrain period.

jkraybill added a commit to jkraybill/Cataclysm-DDA that referenced this issue Feb 12, 2020
jkraybill added a commit to jkraybill/Cataclysm-DDA that referenced this issue Feb 12, 2020
jkraybill added a commit to jkraybill/Cataclysm-DDA that referenced this issue Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Good First Issue This is a good first issue for a new contributor
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants