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

Prevent monster npc collisions #27769

Merged

Conversation

kevingranade
Copy link
Member

Summary

SUMMARY: Bugfixes "Prevent NPC duplications when climbing stairs and colliding with a monster."

Purpose of change

Fixes #24466
It turns out you could end up occupying the same square as a monster if zlevels were enabled and you climbed stairs with a monster standing on the destination.
Additionally, when occupying the same square as a monster and attempting to swap places with a NPC, the swap would apparently succeed, but the NPC would exhibit a number of errors.

Describe the solution

This fixes both issues. First the swap fails if either target is occupying the same square as a different creature. Second the stair code now detects when destination squares are occupied and avoids them.

@ZhilkinSerg ZhilkinSerg added NPC / Factions NPCs, AI, Speech, Factions, Ownership [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) labels Jan 22, 2019
@ZhilkinSerg ZhilkinSerg self-assigned this Jan 22, 2019
@Night-Pryanik
Copy link
Contributor

Night-Pryanik commented Jan 22, 2019

Maybe replace the debug message for the stairs case with a more user-friendly message like "You cannot go upwards/downwards as there is other creature on the way"?

@kevingranade kevingranade force-pushed the prevent-monster-npc-collisions branch from d40e61d to adf5233 Compare January 22, 2019 18:03
@kevingranade
Copy link
Member Author

There isn't a debug message for failing to climb stairs, just for the "should never happen" position swap when one of the swapees is on the same square as another creature.

There's a much more involved overhaul to this function that would be capable of giving that feedback, but right now I'm turning data structure corruption (a NPC occupying the same square as a monster) into a failed action.

@Night-Pryanik
Copy link
Contributor

Then what happens now if player is trying to climb stairs with creature occupying the same tile? Silent fail?

@kevingranade
Copy link
Member Author

Of course not, it does something much more sensible...
There is a sheer drop halfway down. Jump? (Y/N)
... Ok that's not particularly sensible.

@kevingranade kevingranade force-pushed the prevent-monster-npc-collisions branch from adf5233 to 316694e Compare January 22, 2019 19:08
@ZhilkinSerg ZhilkinSerg merged commit 947e30c into CleverRaven:master Jan 22, 2019
@ZhilkinSerg ZhilkinSerg removed their assignment Jan 22, 2019
@kevingranade kevingranade deleted the prevent-monster-npc-collisions branch February 17, 2019 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC Duplicates When Swapped into Inappropriate Player Tile
3 participants