Modding the in-game clock.

Discussion in 'Mods' started by Brianna_Boo, Jul 13, 2017.

Tags:
  1. Brianna_Boo

    Brianna_Boo Yeah, You!

    Hey!

    I'm wondering if someone could help me locate the area of the game files that I need to look to fiddle with the clock in the game? I simply want to make a small modification where I make the clock timer tick in individual 1-minute increments rather than ticks of 10.

    Does anyone have any advice on how I can do this?

    Any help would be greatly appreciated. Thank you. <3
     
    • Voltaic123

      Voltaic123 Pangalactic Porcupine

      I'm no SMAPI modder but, I'm pretty sure this would be a massively complicated mod to build, if it's even possible, which i'm not sure of. Its certainly not as easy as fiddling with game files.
       
      • Brianna_Boo

        Brianna_Boo Yeah, You!

        Aww, no. :( What makes you think it would be massively complicated? It would only really be an aesthetic thing, so instead of the clock skipping in tens, it would only SHOW as one minute ticks, but the actual rate of time wouldn't change.
         
        • Voltaic123

          Voltaic123 Pangalactic Porcupine

          I don't think its something you can achieve with a simple XNB edit. Even if there is a file somewhere that contains images of all the times, you're going to have to add a new image for every minute, and then get the game to accept and display those new times. There are plenty of mods that let you change the speed of the 10 minute tick, but I'm pretty sure the 10 minute tick itself is an integral part of the base game. Again though, not
          really my expertise I just do art and map modding :catsad:
           
          • irecinius

            irecinius Scruffy Nerf-Herder

            I just started on SMAPI modding, so I was looking to do something else, I stumbled in the exact function you are asking..
            There's a third function Game1.player.performTenMinuteUpdate();
            Might look into that one too..
            GOOD LUCK!


            Code:
                public static void UpdateGameClock(GameTime time)
                {
                  if (Game1.shouldTimePass())
                    Game1.gameTimeInterval += Game1.IsClient ? 0 : time.ElapsedGameTime.Milliseconds;
                  if (Game1.timeOfDay >= Game1.getTrulyDarkTime())
                  {
                    float num = Math.Min(0.93f, (float) (0.75 + ((double) ((int) ((double) (Game1.timeOfDay - Game1.timeOfDay % 100) + (double) (Game1.timeOfDay % 100 / 10) * 16.6599998474121) - Game1.getTrulyDarkTime()) + (double) Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.000624999986030161));
                    Game1.outdoorLight = (Game1.isRaining ? Game1.ambientLight : Game1.eveningColor) * num;
                  }
                  else if (Game1.timeOfDay >= Game1.getStartingToGetDarkTime())
                  {
                    float num = Math.Min(0.93f, (float) (0.300000011920929 + ((double) ((int) ((double) (Game1.timeOfDay - Game1.timeOfDay % 100) + (double) (Game1.timeOfDay % 100 / 10) * 16.6599998474121) - Game1.getStartingToGetDarkTime()) + (double) Game1.gameTimeInterval / 7000.0 * 16.6000003814697) * 0.00224999990314245));
                    Game1.outdoorLight = (Game1.isRaining ? Game1.ambientLight : Game1.eveningColor) * num;
                  }
                  else if (Game1.bloom != null && Game1.timeOfDay >= Game1.getStartingToGetDarkTime() - 100 && Game1.bloom.Visible)
                    Game1.bloom.Settings.BloomThreshold = Math.Min(1f, Game1.bloom.Settings.BloomThreshold + 0.0004f);
                  else if (Game1.isRaining)
                    Game1.outdoorLight = Game1.ambientLight * 0.3f;
                  if (Game1.gameTimeInterval <= 7000 + Game1.currentLocation.getExtraMillisecondsPerInGameMinuteForThisLocation())
                    return;
                  if (Game1.panMode)
                    Game1.gameTimeInterval = 0;
                  else
                    Game1.performTenMinuteClockUpdate();
                }
            
            Code:
                public static void performTenMinuteClockUpdate()
                {
                  if (Game1.IsServer)
                    MultiplayerUtility.broadcastGameClock();
                  int trulyDarkTime = Game1.getTrulyDarkTime();
                  Game1.gameTimeInterval = 0;
                  Game1.timeOfDay += 10;
                  if (Game1.timeOfDay % 100 >= 60)
                    Game1.timeOfDay = Game1.timeOfDay - Game1.timeOfDay % 100 + 100;
                  if (Game1.isLightning && Game1.timeOfDay < 2400)
                    Utility.performLightningUpdate();
                  if (Game1.timeOfDay == trulyDarkTime)
                    Game1.currentLocation.switchOutNightTiles();
                  else if (Game1.timeOfDay == Game1.getModeratelyDarkTime())
                  {
                    if (Game1.currentLocation.IsOutdoors && !Game1.isRaining)
                      Game1.ambientLight = Color.White;
                    if (!Game1.isRaining && !(Game1.currentLocation is MineShaft) && (Game1.currentSong != null && !Game1.currentSong.Name.Contains("ambient")) && Game1.currentLocation is Town)
                      Game1.changeMusicTrack("none");
                  }
                  if (Game1.currentLocation.isOutdoors && !Game1.isRaining && (!Game1.eventUp && Game1.currentSong != null) && (Game1.currentSong.Name.Contains("day") && Game1.isDarkOut()))
                    Game1.changeMusicTrack("none");
                  if (Game1.weatherIcon == 1)
                  {
                    int int32 = Convert.ToInt32(Game1.temporaryContent.Load<Dictionary<string, string>>("Data\\Festivals\\" + Game1.currentSeason + (object) Game1.dayOfMonth)["conditions"].Split('/')[1].Split(' ')[0]);
                    if (Game1.whereIsTodaysFest == null)
                      Game1.whereIsTodaysFest = Game1.temporaryContent.Load<Dictionary<string, string>>("Data\\Festivals\\" + Game1.currentSeason + (object) Game1.dayOfMonth)["conditions"].Split('/')[0];
                    if (Game1.timeOfDay == int32)
                    {
                      string str = Game1.temporaryContent.Load<Dictionary<string, string>>("Data\\Festivals\\" + Game1.currentSeason + (object) Game1.dayOfMonth)["conditions"].Split('/')[0];
                      if (!(str == "Forest"))
                      {
                        if (!(str == "Town"))
                        {
                          if (str == "Beach")
                            str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2639");
                        }
                        else
                          str = Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2637");
                      }
                      else
                        str = Game1.currentSeason.Equals("winter") ? Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2634") : Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2635");
                      Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2640", (object) Game1.temporaryContent.Load<Dictionary<string, string>>("Data\\Festivals\\" + Game1.currentSeason + (object) Game1.dayOfMonth)["name"]) + str);
                    }
                  }
                  Game1.player.performTenMinuteUpdate();
                  switch (Game1.timeOfDay)
                  {
                    case 2500:
                      Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                      Game1.player.doEmote(24);
                      break;
                    case 2600:
                      Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                      Game1.farmerShouldPassOut = true;
                      if (Game1.player.getMount() != null)
                      {
                        Game1.player.getMount().dismount();
                        break;
                      }
                      break;
                    case 2800:
                      Game1.exitActiveMenu();
                      Game1.player.faceDirection(2);
                      Game1.player.completelyStopAnimatingOrDoingAction();
                      Game1.player.animateOnce(293);
                      if (Game1.player.getMount() != null)
                      {
                        Game1.player.getMount().dismount();
                        break;
                      }
                      break;
                    case 1200:
                      if (Game1.currentLocation.isOutdoors && !Game1.isRaining && (Game1.currentSong == null || Game1.currentSong.IsStopped || Game1.currentSong.Name.ToLower().Contains("ambient")))
                      {
                        Game1.playMorningSong();
                        break;
                      }
                      break;
                    case 2000:
                      if (!Game1.isRaining && Game1.currentLocation is Town)
                      {
                        Game1.changeMusicTrack("none");
                        break;
                      }
                      break;
                    case 2400:
                      Game1.dayTimeMoneyBox.timeShakeTimer = 2000;
                      Game1.player.doEmote(24);
                      Game1.showGlobalMessage(Game1.content.LoadString("Strings\\StringsFromCSFiles:Game1.cs.2652"));
                      break;
                  }
                  if (Game1.timeOfDay >= 2600)
                    Game1.farmerShouldPassOut = true;
                  foreach (GameLocation location in Game1.locations)
                  {
                    location.performTenMinuteUpdate(Game1.timeOfDay);
                    if (location.GetType() == typeof (Farm))
                      ((BuildableGameLocation) location).timeUpdate(10);
                  }
                  if (Game1.mine == null)
                    return;
                  Game1.mine.performTenMinuteUpdate(Game1.timeOfDay);
                }
            
            
             
              Last edited: Jul 15, 2017

            Share This Page