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

npctalk: fix remove_npc #57570

Merged
merged 1 commit into from
May 11, 2022
Merged

npctalk: fix remove_npc #57570

merged 1 commit into from
May 11, 2022

Conversation

andrei8l
Copy link
Contributor

@andrei8l andrei8l commented May 9, 2022

Summary

None

Purpose of change

remove_npc effect doesn't work because:

  1. it's not even used
  2. it only checks loaded NPCs
  3. it filters them by a temp variable that isn't de/serialized

the result is that the random encounter NPCs from #56629 and #56940 never despawn

Fixes #57549

Describe the solution

  1. Actually use this function...
  2. Check all NPCs on the overmap
  3. Filter them by at least one of: class, talk topic, or unique_id
  4. Change the add eoc type to OM_MOVE so it doesn't spawn spurious NPCs if there's no evac_center on the overmap

Describe alternatives you've considered

De/serializing npc.idz instead of 3: this would work, but not fix the issue in existing saves obsolete

Testing

  1. Load this pruned save Kenansville.tar.gz (EDIT: this save is missing the unique_id for John Bailey and github isn't letting me upload an update atm)
  2. Observe squatting visitors
  3. Teleport outside of reality bubble and wait 6 hours
  4. Teleport back and see all the (existing) visitors have despawned
  5. Confirm that visitors still spawn by waiting and moving near the evac_center (crank up "one_in_chance" to 1 for this)

Try the repro steps from #57549 too

Additional context

N/A

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON NPC / Factions NPCs, AI, Speech, Factions, Ownership astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels May 9, 2022
@andrei8l andrei8l marked this pull request as draft May 11, 2022 08:46
@andrei8l andrei8l marked this pull request as ready for review May 11, 2022 09:50
@andrei8l
Copy link
Contributor Author

Updated to use unique_id for John Bailey and also fixed visitors spawning near the player if there's no evac center around.

@dseguin dseguin merged commit 21f9a4a into CleverRaven:master May 11, 2022
@andrei8l andrei8l deleted the remove_npcs-fr branch May 11, 2022 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Evac Center fills up with visitors
2 participants