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

"PET_WONT_FOLLOW" is bugged #50532

Closed
LyleSY opened this issue Aug 6, 2021 · 8 comments · Fixed by #50890
Closed

"PET_WONT_FOLLOW" is bugged #50532

LyleSY opened this issue Aug 6, 2021 · 8 comments · Fixed by #50890
Labels
<Bug> This needs to be fixed [C++] Changes (can be) made in C++. Previously named `Code` Monsters Monsters both friendly and unfriendly. (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@LyleSY
Copy link
Contributor

LyleSY commented Aug 6, 2021

Describe the bug

Monsters with PET_WONT_FOLLOW flag follow exactly like they don't

Steps To Reproduce

  1. spawn a cow
  2. spawn cattlefodder, activate it and give it to the cow
  3. move and watch it follow you

Expected behavior

cow does not follow

Screenshots

happy cow
Screen Shot 2021-08-06 at 2 12 53 PM

cow follows
Screen Shot 2021-08-06 at 2 13 29 PM

Versions and configuration

  • OS: Mac
  • Game Version: ab9621d
  • Graphics version: Tiles
  • Ingame language: English
  • Mods loaded: None

Additional context

Thanks to @actual-nh for letting me know I'm not crazy. Refreshing!

@actual-nh actual-nh added <Bug> This needs to be fixed Monsters Monsters both friendly and unfriendly. labels Aug 6, 2021
@actual-nh
Copy link
Contributor

actual-nh commented Aug 6, 2021

The only place that PET_WONT_FOLLOW is checked is in monmove.cpp in monster::plan():

    // If we can see the player, move toward them or flee, simpleminded animals are too dumb to follow the player.
    if( friendly == 0 && seen_levels.test( player_character.pos().z + OVERMAP_DEPTH ) &&
        sees( player_character ) && !has_flag( MF_PET_WONT_FOLLOW ) ) {

Note that, in this instance, the check for friendly == 0 will exclude actual pets... This is actually only affecting these critters when they aren't friendly, namely causing them to never target the player (at least via this mechanism).

@actual-nh actual-nh added (S2 - Confirmed) Bug that's been confirmed to exist [C++] Changes (can be) made in C++. Previously named `Code` labels Aug 6, 2021
@PatrikLundell
Copy link
Contributor

Cows, horses, and sheep sometimes follow and sometimes won't, in my experience (both 0.E2 stable and 0.F stable). They seem to sometimes hit some kind of invisible lines they won't cross, for whatever reason.

@anothersimulacrum
Copy link
Member

Probably when they see other monsters.

@PatrikLundell
Copy link
Contributor

No, unless those monsters are non hostile ones (such as squirrels, although I've gotten a safe mode warning about a squirrel once...). I know they won't follow when predators or hostile creatures are seen.

@anothersimulacrum
Copy link
Member

They won't follow when non-tamed cows are seen - go to a dairy farm, and you'll see none of the cows follow you until all the cows are tame.

@actual-nh
Copy link
Contributor

That correlates. Since they can't target the player directly while friendly, if there's something else, they'll target that instead.

@eltank
Copy link
Contributor

eltank commented Aug 18, 2021

I have a simple fix for this, which is moving the PET_WONT_FOLLOW check in monmove.cpp to the correct place (L636 at the time of writing). But fixing that would make it impossible to move cows around (which should definitely be possible) except via an extremely tedious sequence of swap-place operations.

So the plan is to fix this while adding a new feature to the game: leashing animals. Examine a friendly animal with a short rope in inventory, select option to leash (animal gains effect "leashed"), replacing the option to tie down. Examine a friendly leashed animal and you can:

  • tie them down (as before)
  • unleash
  • lead

The last option gives them a new effect ("led" or "led_by_leash") which makes them follow the player regardless of PET_WONT_FOLLOW, even if they can't see you. If you go too far they lose the effect. Or you can interact with them again to stop leading them. You can leave the leash on when done or if you're short on ropes you can unleash them.
I'll work on this, but it'll take some time.

@PatrikLundell
Copy link
Contributor

I really like eltank's approach.

I assume "go too far" means too far away from the animal, such as when running or passing over obstacles the animal can't navigate, as opposed to traveling further than some arbitrary distance.
It can be noted that this would make ponies useful, as you'd be able to use them as (rather weak) pack mules, since you can't ride them unless basically naked (or being rather small).

I don't really think it's needed, but just in case I'll point out that the functionality needs to be tested up and down stairs (regardless of whether if the animals are supposed to follow or fail to navigate stairs), including the unaligned weirdo ones in e.g. subway stations, and ramps, as well as when the leading character climbs obstacles the animals can't pass over/on top of.

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` Monsters Monsters both friendly and unfriendly. (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants