Nitrox icon indicating copy to clipboard operation
Nitrox copied to clipboard

Compound Goals aren't saved

Open tornac1234 opened this issue 3 years ago • 1 comments

As of 1.6.0.0, Compound Goals aren't saved (look for Story.CompoundGoalTracker). Quick explanation of what compound goals are:

  • A CompoundGoal is a StoryGoal that will be triggered only after a precise list of other story goals are completed.
  • This list is known as preconditions
  • When the CompoundGoal is triggered, it is removed from the CompoundGoalTracker list of "available" compound goals, therefore it won't be triggered once again.

Therefore, each time you restart the server, your client has its list of compound goals full once again (it's filled by default and then little by little the goals are triggered and removed from the list), so they will be triggerede once again, which we don't want.

A quick fix for this issue would be to modify the current patch StoryGoal_Execute_Patch to do the following:

  • check if the triggered goal class is an instance of CompoundGoal in which case we want to notify the server
  • thus add a parameter to the StoryEventSend to tell if it's a compound goal or not
  • Then save the list on server-side and do the client restitution during initial sync

tornac1234 avatar Apr 30 '22 20:04 tornac1234

Can probably set this to "easy"

tornac1234 avatar Apr 30 '22 20:04 tornac1234

If we save the list on the server and during initial sync do the client restitution. Why do we need to check if triggered goals are instances of CompundGoal? Is this part of the initial sync?

Ironwally avatar Dec 12 '22 13:12 Ironwally

If we save the list on the server and during initial sync do the client restitution. Why do we need to check if triggered goals are instances of CompundGoal? Is this part of the initial sync?

Looked at the code once again and what we're actually missing is inside of StoryGoalInitialSyncProcessor. Just as we're triggering this inside of SetGoalUnlocks :

StoryGoalManager.main.onGoalUnlockTracker.NotifyGoalComplete(...);

we should be adding the following line to SetCompletedStoryGoals :

StoryGoalManager.main.compoundGoalTracker.NotifyGoalComplete(StoryGoalManager.main.completedGoals);

But it might change with next subnautica version so we should wait for it to make the changes.

tornac1234 avatar Dec 12 '22 17:12 tornac1234

PS: I think that the current state of StoryGoalManager syncing is really bad and should be overhauled sooner or later. (for example, nothing about ItemGoalTracker in initialsync. I shall myself give it a look while reworking aurora and sunbeam sync.

tornac1234 avatar Dec 12 '22 17:12 tornac1234

Will be fixed by #1967

dartasen avatar Feb 10 '23 15:02 dartasen