-
Notifications
You must be signed in to change notification settings - Fork 1
feat: move culled NPCs to their routine waypoint on schedule change #376
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
base: main
Are you sure you want to change the base?
Changes from all commits
1e18996
7918f90
16d3a7c
a1fa6c8
f6d2a1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,5 +44,10 @@ public List<NpcContainer> GetVisibleNpcs() | |
| { | ||
| return _npcDomain.GetVisibleNpcs(); | ||
| } | ||
|
|
||
| public IEnumerable<NpcContainer> GetAllNpcContainers() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is never called. Remove if unused (Especially as it can be a performance bottleneck). |
||
| { | ||
| return _npcDomain.GetAllNpcContainers(); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,7 +140,25 @@ public bool CalculateCurrentRoutine(NpcInstance npc) | |
| } | ||
| npcProps.RoutineCurrent = newRoutine; | ||
|
|
||
| if (changed) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing line of code. Good finding. :-) |
||
| _npcMeshCullingService.NotifyNpcRoutineChanged(npc.GetUserData()); | ||
|
|
||
| return changed; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Re-evaluates the time-based routine for all NPCs. Culled NPCs whose routine changed | ||
| /// will have their culling sphere moved to the new waypoint via NotifyNpcRoutineChanged. | ||
| /// Call this after a time skip so off-screen NPCs appear at their correct schedule position. | ||
| /// </summary> | ||
| public void RecalculateAllNpcRoutines() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function is never called. Remove if unused (Especially as it can be a performance bottleneck). |
||
| { | ||
| foreach (var container in _npcMeshCullingService.GetAllNpcContainers()) | ||
| { | ||
| if (container?.Props?.Routines == null || container.Props.Routines.Count == 0) | ||
| continue; | ||
| CalculateCurrentRoutine(container.Instance); | ||
| } | ||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is never called. Remove if unused (Especially as it can be a performance bottleneck).