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

fix(port): Do not move into monsters that we cannot displace #4325

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

ekaratzas
Copy link
Contributor

@ekaratzas ekaratzas commented Mar 9, 2024

Purpose of change

Porting fix from cdda, original PR: CleverRaven/Cataclysm-DDA#47717

Issue is when player tries to move into a spot where a pet is and displace it but the originating position is not a position that the pet can move to. e.g. if you move from chicken fence to tile in the coop containing a pet chicken.

Describe the solution

check result of critter.move_to() before actually moving player and making them disappear under the same tile as chicken. In that case we return the original position of player back so they dont move.

Describe alternatives you've considered

Testing

character climbs chicken fence. tries to move to tile with friendly chicken. with this patch, that should fail and you get proper error message. without the patch, character disappears under chicken which can then lead to crashes if there's another chicken in the next tile you try to to move to etc.

displace-chicken

Additional context

Checklist

@github-actions github-actions bot added the src changes related to source code. label Mar 9, 2024
@scarf005 scarf005 merged commit f3e8542 into cataclysmbnteam:main Mar 9, 2024
13 checks passed
@ekaratzas ekaratzas deleted the port-fix-displace-pet branch March 10, 2024 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants