Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upNPCs: fix NPC fleeing and allow NPCs to stop fleeing the player #29084
Conversation
mlangsdorf
added
NPC / Factions
[C++]
<Bugfix>
labels
Mar 28, 2019
mlangsdorf
added some commits
Mar 28, 2019
mlangsdorf
force-pushed the
mlangsdorf:npc_flee_fix
branch
from
701e784
to
4482a38
Mar 28, 2019
mlangsdorf
added this to In progress
in NPC dialog overhaul
via automation
Mar 28, 2019
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: https://discourse.cataclysmdda.org/t/npcs-shooting-punches/19426/7 |
kevingranade
merged commit 62adf89
into
CleverRaven:master
Mar 29, 2019
NPC dialog overhaul
automation
moved this from In progress
to Done
Mar 29, 2019
mlangsdorf
deleted the
mlangsdorf:npc_flee_fix
branch
Apr 9, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
mlangsdorf commentedMar 28, 2019
Summary
SUMMARY: Bugfixes "NPCs: fix NPC fleeing and allow NPCs to stop fleeing the player"Purpose of change
Fix an issue where NPCs fleeing from the player could melee attack the player at a great distance.
Fix an issue where an NPC, once they became scared of the player, became scared of the player forever.
Fix a warning message regarding the snippet and warning messages when setting NPC attitudes in the debug menu.
Describe the solution
Due to a bug in the NPC flight code, NPCs that were fleeing from the player could punch him at a distance. Change the logic for calling good_escape_direction from npc_has_effect( effect_npc_run_away) to npc_action == npc_flee. Now NPCs that are fleeing move_to a tile away from the NPC, instead of trying to move to the PC and being unable and punching him instead.
NPCs get a new attitude, NPCATT_FLEE_TEMP, whenever they would get NPCATT_FLEE. When an NPC's attitude is set to NPCATT_FLEE_TEMP, they also get a 24 hour effect "npc_flee_player." When the NPC AI starts its routine each turn, NPCATT_FLEE is turned to NPCATT_FLEE_TEMP and then if the NPC has NPCATT_FLEE_TEMP but not "npc_flee_player" they revert to NPCATT_NULL.
Change the color of fleeing NPCs to light_red to distinguish them from actual hostiles.
isn't a valid snippet, so replace it in talk_tags.json.
Give descriptions to the legacy NPC attitudes so that the new debug menu option to set an NPC attitude stops spewing error messages.
Describe alternatives you've considered
This could technically be 3 PRs but only the second commit is large enough to break out on its own.