Exemple #1
0
        private void SetScheduledGoals(List <NitroxScheduledGoal> scheduledGoals)
        {
            Dictionary <string, PDALog.Entry> entries = PDALog.entries;

            // Need to clear some duplicated goals that might have appeared during loading and before sync
            for (int i = StoryGoalScheduler.main.schedule.Count - 1; i >= 0; i--)
            {
                ScheduledGoal scheduledGoal = StoryGoalScheduler.main.schedule[i];
                if (entries.ContainsKey(scheduledGoal.goalKey))
                {
                    StoryGoalScheduler.main.schedule.Remove(scheduledGoal);
                }
            }

            foreach (NitroxScheduledGoal scheduledGoal in scheduledGoals)
            {
                ScheduledGoal goal = new ScheduledGoal();
                goal.goalKey     = scheduledGoal.GoalKey;
                goal.goalType    = (Story.GoalType)System.Enum.Parse(typeof(Story.GoalType), scheduledGoal.GoalType);
                goal.timeExecute = scheduledGoal.TimeExecute;
                if (goal.timeExecute >= DayNightCycle.main.timePassedAsDouble &&
                    !StoryGoalScheduler.main.schedule.Any(alreadyInGoal => alreadyInGoal.goalKey == goal.goalKey) &&
                    !entries.TryGetValue(goal.goalKey, out PDALog.Entry value) &&
                    !StoryGoalManager.main.completedGoals.Contains(goal.goalKey))
                {
                    StoryGoalScheduler.main.schedule.Add(goal);
                }
            }
        }
Exemple #2
0
 static bool Prefix(StoryGoalScheduler __instance)
 {
     StoryGoalManager.main.PulsePendingMessages();
     for (int i = __instance.schedule.Count - 1; i >= 0; i--)
     {
         ScheduledGoal scheduledGoal = __instance.schedule[i];
         if (scheduledGoal.goalType == Story.GoalType.Radio)
         {
             __instance.schedule[i] = __instance.schedule[__instance.schedule.Count - 1];
             __instance.schedule.RemoveAt(__instance.schedule.Count - 1);
             StoryGoal.Execute(scheduledGoal.goalKey, scheduledGoal.goalType);
         }
     }
     return(true);
 }