Пример #1
0
        public static DetourEvent Pre10MinuteClockUpdateCallback()
        {
            var @event = new Pre10MinuteClockUpdateEvent();

            FireEvent(@event);
            return(@event);
        }
Пример #2
0
        public void Pre10MinuteClockUpdateCallback(Pre10MinuteClockUpdateEvent @event)
        {
            Console.WriteLine("Firing Pre10MinuteClockUpdateEvent");
            var location = @event.Root.CurrentLocation;

            if (location != null)
            {
                Console.WriteLine("Location name is: " + location.Name);
                Console.WriteLine("Location is outdoors is: " + location.IsOutdoors.ToString());
            }
            int time = @event.Root.TimeOfDay;

            Console.WriteLine("time is " + time.ToString("G"));
            if (location != null && !location.IsOutdoors && ((!location.Name.Equals("UndergroundMine") && !location.Name.Equals("FarmCave")) || FreezeInsideConfig.FreezeTimeInMines) && (time - lasttime <= 10 || (time % 100 == 0 && time - lasttime == 50) || firsttick))
            {
                //if location is not null
                //if location is not outdoors
                //if location name is not UndergroundMine or FarmCave or alternatively, if FreezeTimeInMines is true
                //if time is not jumping by more than 10 minutes (some festivals do this and I don't want to break them)
                //first tick seems wonky, added bool
                firsttick = false;
                Console.WriteLine("location requirements met, resetting time");
                if (FreezeInsideConfig.LetMachinesRunWhileTimeFrozen)
                {
                    if (time == 600)
                    {
                        if ((time % 100) == 0)
                        {
                            @event.Root.TimeOfDay = lasttime - 50;
                        }
                        else
                        {
                            @event.Root.TimeOfDay = lasttime;
                        }
                    }
                    else
                    {
                        @event.Root.TimeOfDay = lasttime;
                    }

                    Console.WriteLine("resetting time to: " + lasttime.ToString("G"));
                }
                else
                {
                    @event.ReturnEarly           = true;
                    @event.Root.GameTimeInterval = 0;
                }
            }
            else
            {
                lasttime = time;
                Console.WriteLine("location requirements not met, time advancing normally");
            }
        }
Пример #3
0
 public void PerformClockUpdateCallback(Pre10MinuteClockUpdateEvent @event)
 {
     Logging.DebugLog("Stopping clock..");
     @event.ReturnEarly = true;
 }