Exemplo n.º 1
0
        private void ToggleAndStoreTime()
        {
            timeIsStopped = !timeIsStopped;

            PrepperMod.Log("Time is: " + (timeIsStopped ? "STOPPED" : "STARTED"));

            storedTime = TimeControler.realTime;
        }
        internal void Load()
        {
            PrepperMod.Log("Loading settings.");

            try
            {
                using (UMFConfig config = new UMFConfig())
                {
                    string configVersion = config.Read("ConfigVersion", new UMFConfigString());
                    if (configVersion != string.Empty && configVersion != PrepperModConfig.configVersion)
                    {
                        config.DeleteConfig(false);
                        PrepperMod.Log("The config file was outdated and has been deleted. A new config will be generated.");
                    }

                    //cfg.Write("SupportsHotLoading", new UMFConfigBool(false)); //Uncomment if your mod can't be loaded once the game has started.
                    config.Write("ModDependencies", new UMFConfigStringArray(new string[] { "" })); //A comma separated list of mod/library names that this mod requires to function. Format: SomeMod:1.50,SomeLibrary:0.60
                    config.Read("LoadPriority", new UMFConfigString("Normal"));
                    config.Write("MinVersion", new UMFConfigString("0.53.0"));
                    config.Write("MaxVersion", new UMFConfigString("0.54.99999.99999")); //This will prevent the mod from being loaded after the next major UMF release
                    config.Write("UpdateURL", new UMFConfigString(""));
                    config.Write("ConfigVersion", new UMFConfigString(PrepperModConfig.configVersion));

                    PrepperMod.Log("Finished UMF Settings.");

                    KeysIncTime  = config.Read("Skip Time Forwards", new UMFConfigStringArray(new string[0], true), "The key(s) used to skip forwards in time.");
                    KeysDecTime  = config.Read("Skip Time Backwards", new UMFConfigStringArray(new string[0], true), "The key(s) used to skip backwards in time.");
                    KeysStopTime = config.Read("Toggle Time-Stop", new UMFConfigStringArray(new string[0], true), "The key(s) used to toggle stopped time.");

                    UpdateBinds();

                    SkipDelta = config.Read("Time skip delta", new UMFConfigInt(15, 5, 60), "How far to skip each time.");
                    PrepperModController.Instance.SkipDelta(SkipDelta);

                    PrepperMod.Log("Finished loading settings.");
                }
            }
            catch (Exception e)
            {
                PrepperMod.Log("Error loading mod settings: " + e.Message + "(" + e.InnerException?.Message + ")");
            }
        }
Exemplo n.º 3
0
        private void SkipTimeInMinutes(int deltaTime)
        {
            TimeControler.DayTime newTime = TimeControler.realTime;

            newTime.minutes = TimeControler.realTime.minutes + deltaTime;
            if (newTime.minutes < 0)
            {
                newTime.hours--;
                newTime.minutes += 60;
            }
            else if (newTime.minutes >= 60)
            {
                newTime.hours   += newTime.minutes / 60;
                newTime.minutes %= 60;
            }

            if (newTime.hours < 0)
            {
                newTime.days--;
                newTime.hours += 24;
            }
            else if (newTime.hours >= 24)
            {
                newTime.days  += newTime.hours / 24;
                newTime.hours %= 24;
            }

            // Do not skip between days for now...
            if (newTime.days < TimeControler.realTime.days || newTime.days > TimeControler.realTime.days)
            {
                return;
            }

            PrepperMod.Log("Skipping to time: " + newTime.ToLongString());

            storedTime = newTime;

            TimeControler.realTime = newTime;
        }
Exemplo n.º 4
0
 private void SkipBackwards()
 {
     PrepperMod.Log("Skip Backwards.");
     SkipTimeInMinutes(-skipDelta);
 }