Ejemplo n.º 1
0
        public override void Process(StoryEventSend packet)
        {
            switch (packet.Type)
            {
            case StoryEventSend.EventType.PDA:
            case StoryEventSend.EventType.RADIO:
            case StoryEventSend.EventType.ENCYCLOPEDIA:
            case StoryEventSend.EventType.STORY:
                using (packetSender.Suppress <StoryEventSend>())
                    using (packetSender.Suppress <PDALogEntryAdd>())
                    {
                        StoryGoal.Execute(packet.Key, packet.Type.ToUnity());
                    }
                break;

            case StoryEventSend.EventType.EXTRA:
                ExecuteExtraEvent(packet.Key);
                break;

            case StoryEventSend.EventType.PDA_EXTRA:
                PDALog.entries.Remove(packet.Key);
                StoryGoal.Execute(packet.Key, Story.GoalType.PDA);
                break;
            }
        }
Ejemplo n.º 2
0
 public static bool Prefix(JukeboxInstance __instance)
 {
     if (string.IsNullOrEmpty(__instance.file) || !Jukebox.HasFile(__instance._file))
     {
         __instance.SwitchTrack(true);
     }
     if (__instance.isControlling && Jukebox.isStartingOrPlaying)
     {
         MainPatch.isPaused = !Jukebox.paused;
         Jukebox.paused     = !Jukebox.paused;
     }
     else if (__instance.ConsumePower())
     {
         Jukebox.Play(__instance);
         Jukebox.TrackInfo info = Jukebox.GetInfo(__instance.file);
         __instance.SetLabel(info.label);
         __instance.SetLength(info.length);
         MainPatch.isPlaying = true;
         MainPatch.isPaused  = false;
     }
     else
     {
         __instance.SetLabel(Language.main.Get("JukeboxNoPower"));
     }
     if (StoryGoalManager.main.IsAlanOnboard())
     {
         StoryGoal.Execute("Log_Alan_Aside_JukeboxMusic", Story.GoalType.PDA, true, false);
     }
     return(false);
 }
        // __state is a bool made to prevent duplicated entries, if it's false, then it should be skipped
        public static bool Prefix(StoryGoal goal, out bool __state)
        {
            __state = StoryGoalScheduler.main.schedule.Any(scheduledGoal => scheduledGoal.goalKey == goal.key) ||
                      goal.goalType == Story.GoalType.Radio && StoryGoalManager.main.pendingRadioMessages.Contains(goal.key) ||
                      PDALog.entries.ContainsKey(goal.key);

            return(!__state);
        }
        public static void Postfix(StoryGoal goal, bool __state)
        {
            if (__state || goal.key == "PlayerDiving" || goal.delay == 0f)
            {
                return;
            }

            float timeExecute = StoryGoalScheduler.main.schedule.GetLast().timeExecute;

            packetSender.Send(new Schedule(timeExecute, goal.key, goal.goalType.ToString()));
        }
            static void onAddGoal(StoryGoal goal)
            {
                if (goal == null || goal.delay > shortGoalDelay || isGoalCompleted(goal.key))
                {
                    return;
                }

                forcedNormalSpeed = true;

                instance.goals.Add(goal.key);                                                                                   $"StoryGoalsListener: goal added '{goal.key}'".logDbg();
            }
Ejemplo n.º 6
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);
 }
Ejemplo n.º 7
0
        public override void Process(StoryEventSend packet)
        {
            switch (packet.StoryEventType)
            {
            case StoryEventType.PDA:
            case StoryEventType.Radio:
            case StoryEventType.Encyclopedia:
            case StoryEventType.Story:
                StoryGoal.Execute(packet.Key, (Story.GoalType)packet.StoryEventType);
                break;

            case StoryEventType.Extra:
                ExecuteExtraEvent(packet.Key);
                break;
            }
        }
Ejemplo n.º 8
0
        public override void Process(StoryEventSend packet)
        {
            switch (packet.StoryEventType)
            {
            case StoryEventType.PDA:
            case StoryEventType.RADIO:
            case StoryEventType.ENCYCLOPEDIA:
            case StoryEventType.STORY:
                using (NitroxServiceLocator.LocateService <IPacketSender>().Suppress <StoryEventSend>())
                {
                    StoryGoal.Execute(packet.Key, (Story.GoalType)packet.StoryEventType);
                }
                break;

            case StoryEventType.EXTRA:
                ExecuteExtraEvent(packet.Key);
                break;
            }
        }
Ejemplo n.º 9
0
        public override void Process(StoryEventSend packet)
        {
            switch (packet.StoryEventType)
            {
            case StoryEventType.PDA:
            case StoryEventType.Radio:
            case StoryEventType.Encyclopedia:
            case StoryEventType.Story:
                using (NitroxServiceLocator.LocateService <IPacketSender>().Suppress <StoryEventSend>())
                {
                    StoryGoal.Execute(packet.Key, (Story.GoalType)packet.StoryEventType);
                }
                break;

            case StoryEventType.Extra:
                ExecuteExtraEvent(packet.Key);
                break;
            }
        }