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

NPCs: support faction tagged zones #30150

Merged
merged 5 commits into from
May 12, 2019

Conversation

mlangsdorf
Copy link
Contributor

@mlangsdorf mlangsdorf commented May 1, 2019

Summary

SUMMARY: Features "NPCs: support faction tagged zones"

Purpose of change

Fixes #29333
Fixes #30047
#29867 added player defined zones to tell allied NPCs where to retreat to and where to avoid investigating noises. Expand that functionality to include non-alliedNPCs to prevent NPCs from doing stupid stuff like investigating a zombie infested back room.

Describe the solution

Change the map of zone_type_ids to zone_data to a map of a hashed string made of up of the zone_type_id and the faction_id to zone_data. Retrieve zones by that hash, defaulting the faction_id to "your_followers".

Add a new jmapgen object to handle zones, and a zone_manager function to rotate zones on a map.

Change npcmove and npctalk so that sound investigation happens using absolute positions instead of map local positions, and slightly change the investigate only zones so that NPCs only heed them if the NPC started in the zone.

Make the beggars in the lobby of the Evac Center into their own faction. Limit the investigation of most factions in the Evac Center to the area within the sidewalks, ignoring the back bay entirely, but limit the beggars to the lobby itself.

Additional context

@mlangsdorf mlangsdorf added <Enhancement / Feature> New features, or enhancements on existing [C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones Map / Mapgen Overmap, Mapgen, Map extras, Map display NPC / Factions NPCs, AI, Speech, Factions, Ownership Sound Events Sound events handling in the game labels May 1, 2019
@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch 2 times, most recently from 78106cd to 85c82db Compare May 4, 2019 13:48
@mlangsdorf mlangsdorf marked this pull request as ready for review May 4, 2019 13:51
@mlangsdorf
Copy link
Contributor Author

jenkins rebuild

@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch 4 times, most recently from ab1dc0e to 151438a Compare May 6, 2019 20:35
@mlangsdorf mlangsdorf changed the title NPCs: support faction tagged zones [WIP] NPCs: support faction tagged zones May 7, 2019
@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch from 151438a to abe9a09 Compare May 7, 2019 21:33
@mlangsdorf mlangsdorf changed the title [WIP] NPCs: support faction tagged zones NPCs: support faction tagged zones May 8, 2019
The lobby beggars need to have different behavior than other people in the
Evac Center, and should be in their own faction.
Zones can be tagged by faction ID (defaulting to your_followers) and
different factions cannot retrieve each other's zones.
@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch from abe9a09 to 6935faf Compare May 11, 2019 16:28
Now that zones are tagged by faction, let all NPCs, not just the player's
allies, use no investigate, investigate limits, and retreat zones.

NPCs will also stop investigating a sound if they spend 10 turns
trying to reach it without moving.
NPC zones can be added by faction id and zone type.
@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch from 6935faf to 5507a63 Compare May 11, 2019 20:49
@mlangsdorf
Copy link
Contributor Author

Okay, another pass through it and I'm pretty sure everything is working.

Add investigate limit and no investigate zones to the Evac Center:
- Most NPCs won't investigate noises coming from beyond the center's
sidewalks
- No NPC will investigate noises coming from the zombie infested back
bay.
- The beggars in the lobby won't investigate noises coming from outside
the lobby.
@mlangsdorf mlangsdorf force-pushed the faction_zones_take_2 branch from 5507a63 to add93c3 Compare May 11, 2019 22:30
@ZhilkinSerg ZhilkinSerg self-assigned this May 12, 2019
@kevingranade kevingranade merged commit 3c24c53 into CleverRaven:master May 12, 2019
@ZhilkinSerg ZhilkinSerg mentioned this pull request May 12, 2019
11 tasks
@ZhilkinSerg ZhilkinSerg removed their assignment May 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` <Enhancement / Feature> New features, or enhancements on existing Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones Map / Mapgen Overmap, Mapgen, Map extras, Map display NPC / Factions NPCs, AI, Speech, Factions, Ownership Sound Events Sound events handling in the game
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC head exploded from infinite loop NPC activity control
5 participants