RELEASED [Storm] and [SMAPI] TimeSpeed Mod--Configurable Day Lengths

Discussion in 'Gameplay Mechanics' started by cantorsdust, Mar 4, 2016.

  1. cantorsdust

    cantorsdust Existential Complex

    No, should work for all festival days. I'm double-checking the line in my source that screens them out:

    if (!@event.Root.IsFestivalDay(@event.Root.DayOfMonth, @event.Root.CurrentSeason) || TimeSpeedConfig.ChangeTimeSpeedOnFestivalDays)

    and it sure looks like it's correct. Perhaps the problem lies with Storm's IsFestivalDay method?

    I don't have an answer for you right now. Frankly, I'm not convinced this mod causes any problems with festivals as is, so I wouldn't worry too much. I'll look into it for the next version some more.
     
    • lukkajong

      lukkajong Intergalactic Tourist

      I have Timespeed mod installed and when I'm playing the game via StormLoader, I've noticed that when I upgraded the house, didn't get the "Moving Up" achievement when open the game back on Steam:( I don't know if that will happen to other achievements but I'll start playing through Steam from now on.
       
      • cantorsdust

        cantorsdust Existential Complex

        Mention it in the Storm thread. That's a limitation with Storm, one that I thought was fixed, not related to this mod specifically.
         
        • Zebracakes4me

          Zebracakes4me Tentacle Wrangler

          Did you recently start using mods? I believe if you're using Storm you must make Steam "point" to Storm so you can play it using steam. If you just launch Storm, I think I launch the game without using Steam. I didn't realize this myself and missed one achievement (whatevs) until I used the %command% prompt to launch Steam and when play Stardew Valley, it will actually launch Storm and keep the overlay and all Steam goodness (I hope...got like 3 achievements ever since I did the %command% prompt)
           
          • cantorsdust

            cantorsdust Existential Complex

            I have pushed out a very heavy update, 1.6. Fellow modder Syndlig is responsible for the majority of the new code--I have added him as a co-author. This update combines and improves on FreezeInside functionality--you do not need to run FreezeInside with this mod anymore. I have broken up time speed and freeze time into 3 areas, outside, inside, and the mines. You may change the speed or freeze time in any or all of them. I have also added a FreezeTimeAt1230AM option for those who have trouble making it back to your house before you pass out ;)

            For Storm only. Get it at
            https://github.com/cantorsdust/TimeSpeed/releases
             
            • Fourleafclov

              Fourleafclov Void-Bound Voyager

              Glad to see modders pushing out one Mod Loader and focusing only on one of them. Go Storm !! :D
               
              • N1nj4R4bb1D

                N1nj4R4bb1D Aquatic Astronaut

                Now your mod has all the features i was looking for when i made my own modified version of your mod (for personal use) after i asked about a possibility to add those features in your mod! :confirm: :nuruhappy:
                Code:
                using System;
                using Storm;
                using Storm.ExternalEvent;
                using Storm.StardewValley.Event;
                
                namespace TimeFlow
                {
                  [Mod]
                  public class TimeFlow : DiskResource
                  {
                    public static ModConfig TimeFlowConfig { get; private set; }
                    public double timeCounter = 0;
                    public double lastGameTimeInterval = 0;
                    public string lastLocationName = "";
                    public int TenMinuteTickInterval = 7;
                
                    [Subscribe]
                    public void InitializeCallback(InitializeEvent @event)
                    {
                      TimeFlowConfig = new ModConfig();
                      TimeFlowConfig = (ModConfig)Config.InitializeConfig(PathOnDisk + "\\Config.json", TimeFlowConfig);
                      /*
                      Console.WriteLine("The config file for TimeFlow has been loaded."+
                      "\n\tTickIntervalOutside: {0}"+
                      "\n\tTickIntervalInside: {1}"+
                      "\n\tTickIntervalInMines: {2}"+
                      "\n\tFreezeTimeInMines: {3}",
                      TimeFlowConfig.TickIntervalOutside, TimeFlowConfig.TickIntervalInside, TimeFlowConfig.TickIntervalInMines, TimeFlowConfig.FreezeTimeInMines);
                      Console.WriteLine("TimeFlow Initialization Completed");
                      */
                      TenMinuteTickInterval = TimeFlowConfig.TickIntervalInside;
                    }
                
                    [Subscribe]
                    public void Pre10MinuteClockUpdateCallback(Pre10MinuteClockUpdateEvent @event)
                    {
                      //Console.WriteLine("TimeFlow : 10MinuteClockUpdate : " + DateTime.Now.ToString("HH:mm:ss.ffff"));
                      var location = @event.Root.CurrentLocation;
                      if (location != null && !location.IsOutdoors && ((location.Name.Equals("UndergroundMine") || location.Name.Equals("FarmCave")) && TimeFlowConfig.FreezeTimeInMines))
                      {
                        @event.ReturnEarly = true;
                      }
                      timeCounter = 0;
                      lastGameTimeInterval = 0;
                    }
                
                    [Subscribe]
                    public void UpdateGameClockCallback(UpdateGameClockEvent @event)
                    {
                      if (@event.Root.DayOfMonth != null && @event.Root.CurrentSeason != null)
                      {
                        timeCounter += Math.Abs((@event.Root.GameTimeInterval - lastGameTimeInterval));
                        double fraction = Math.Abs(timeCounter / TenMinuteTickInterval);
                        if (LocationChangeCheck(@event.Root.CurrentLocation.Name, @event.Root.CurrentLocation.IsOutdoors))
                        {
                          timeCounter = Math.Abs(TenMinuteTickInterval * fraction);
                          /*
                          Console.WriteLine("TimeFlow : LocationChange : " + @event.Root.CurrentLocation.Name+
                          " : TickInterval = " + TenMinuteTickInterval.ToString()+
                          " : " + DateTime.Now.ToString("HH:mm:ss.ffff"));
                          */
                        }
                        double proportion = Math.Abs(7 * timeCounter / TenMinuteTickInterval);
                        @event.Root.GameTimeInterval = Convert.ToInt32(proportion);
                        lastGameTimeInterval = @event.Root.GameTimeInterval;
                      }
                    }
                
                    public bool LocationChangeCheck(string sName, bool bOutside)
                    {
                      if (!sName.Equals(lastLocationName))
                      {
                        if (!bOutside)
                        {
                          switch (sName)
                          {
                            case "UndergroundMine":
                            case "FarmCave":
                              TenMinuteTickInterval = TimeFlowConfig.TickIntervalInMines;
                              //Console.WriteLine("LocationChangeCheck : TickIntervalInMines");
                              break;
                            default:
                              TenMinuteTickInterval = TimeFlowConfig.TickIntervalInside;
                              //Console.WriteLine("LocationChangeCheck : TickIntervalInside");
                              break;
                          }
                        }
                        else
                        {
                          TenMinuteTickInterval = TimeFlowConfig.TickIntervalOutside;
                          //Console.WriteLine("LocationChangeCheck : TickIntervalOutside");
                        }
                        lastLocationName = sName;
                        return true;
                      }
                      else
                      {
                        return false;
                      }
                    }
                  }
                
                  public class ModConfig : Config
                  {
                    public int TickIntervalOutside { get; set; }
                    public int TickIntervalInside { get; set; }
                    public int TickIntervalInMines { get; set; }
                    public bool FreezeTimeInMines { get; set; }
                
                    public override Config GenerateBaseConfig(Config baseConfig)
                    {
                      TickIntervalOutside = 14;
                      TickIntervalInside = 21;
                      TickIntervalInMines = 28;
                      FreezeTimeInMines = false;
                
                      return this;
                    }
                  }
                }
                
                https://github.com/N1nj4R4bb1D/TimeFlow


                P.S. Small note... it seems your mod doesn't have any timeCounter adjustments for TickInterval change (it can lead to some sudden 10MinuteTicks when switching from longer interval to a shorter one).
                 
                  Last edited: Mar 16, 2016
                • ZombieArron

                  ZombieArron Scruffy Nerf-Herder

                  I really appreciate the work you put into your mods but Storm is still highly unstable, Handsome Matt has stessed the fact on Storm's page. I think a lot of people including myself would enjoy updates for SMAPI. I am waiting for Storm to be more user friendly before switching to it.

                  This is all done on your whim, so you can disregard my comment if you disagree in anyway.
                   
                    Last edited: Mar 15, 2016
                  • Doomninja

                    Doomninja Void-Bound Voyager

                    Well given that SMAPI is not going to be supported in the long run, I think just working with storm and making it better and better is the best idea. I get that random crashes are no fun, at least you only lose a day at most (to the best of my knowledge, as I've only ever lost 1 day). Now what would be great is if someone was able to develop a mod that allowed us to save whenever we wanted.
                     
                    • cantorsdust

                      cantorsdust Existential Complex

                      This would require rewriting the save function in its entirety, as it does not save NPC data, schedules, etc right now. That said, the idea's been thrown around in chat, particularly switching the save system to a JSON parser, but it has not yet been done.

                      As for SMAPI support, I make no promises. I may backport for my own benefit alone if it would let me play with CJB's mod. I haven't actually played the game yet, and if CJB's mod isn't ported over to Storm when I do, I might backport. But for real, don't wait or plan for that.
                       
                      • Axotl

                        Axotl Space Hobo

                        Could you detail the actual process to have Storm launch through Steam, or whatever it is that you're saying to do?
                         
                        • Jigain

                          Jigain Phantasmal Quasar

                          Find Stardew Valley in your games library.
                          Right click and select Properties.
                          Under the General tab, click the button Set launch options...
                          Paste in the following line, changing drive letter and path where necessary:
                          "Q:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\StormLoader.exe" %command%
                          Press OK, then close the Properties window.
                          You're good to go.

                          Default Steam installation path is the same as the one I put up, except the Q: part is C: by default. Mine is Q: only because I installed Steam to a second harddrive.
                           
                          • ZakG

                            ZakG Lucky Number 13

                            @cantorsdust,

                            I have a specific request i hope you could help me out with. I can't run either Storm or SMAPI, but i really need to slow down the day/night cycle a bit. I'm pretty comfortable modding and have XNBNode to allow me to access the files.

                            Here is my problem, i've read the guides but not been able to find where in the files you can make the change like you have in this mod. So would you be able to advise me, or point me to a thread that might already exist that would enable me to roll my own timespeed adjustments without using either Storm or SMAPI. I understand that for simple single code changes you can do that via XNBNode?

                            So pretty please what lines of code and from which files would i need to change to achieve the basic part of what your mod has (double the length of day)?

                            Thank you in advance for any help, i just can't quite get into this lovely game without this change :(
                             
                            • cantorsdust

                              cantorsdust Existential Complex

                              There is no way to accomplish what this mod does with XNB editing, sorry.
                               
                              • Graem

                                Graem Void-Bound Voyager

                                @cantorsdust
                                Hi there. I've been a fan of your mods for a while now. I really want to use your mods, but you said you're switching all development to STORM and I just am too afraid of jumping from your reliable SMAPI release to an unreliable STORM one. Reading the messages in this thread, I see a lot of other people feel the same way. I know you're doing everything you can. It's just that it feels like we either have to use your old mods or pretend your mods don't exist until somebody blows a whistle about things being stable. I hope things get resolved soon. It's just weird right now, I guess. Good luck. :V
                                 
                                • cantorsdust

                                  cantorsdust Existential Complex

                                   
                                  • cantorsdust

                                    cantorsdust Existential Complex


                                    I gave in. I have backported all features in 1.6.0.0.STORM to 1.6.0.0.SMAPI. They have feature parity, although the Storm version is slightly more elegant--smooth time arrow with no ticks thanks to Storm's event handling. I no longer recommend a version.

                                    Get it at https://github.com/cantorsdust/TimeSpeed/releases
                                     
                                    • ZombieArron

                                      ZombieArron Scruffy Nerf-Herder

                                      You, sir, are a true scholar and gentalman. Thank you.
                                      The rate at which Storm is moving along, i don't think ill be waiting long to switch over. Your mod is definitely one i have to add. Really appreciate all the work and time you put into this.
                                       
                                        Zebracakes4me likes this.
                                      • Zebracakes4me

                                        Zebracakes4me Tentacle Wrangler

                                        +1 one to this. The work you and the other modders are doing so that other people can enjoy they game they want is truly outstanding. Thanks so much! :DD
                                         
                                        • Graem

                                          Graem Void-Bound Voyager

                                          Oh, bless you! :D You didn't have to do that, but thank you so much anyway. I'm looking forward to STORM working out for all of us, and I'm excited about its potential very much, but this is a great thing you did to tide us over. Bless you. :notworthy::notworthy::notworthy:
                                           

                                          Share This Page