/// <summary> /// Handles the ten minute update tick /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Parameters</param> private void TenMinuteUpdate(object sender, EventArgsIntChanged e) { if (!Game1.hasLoadedGame) { return; } Conditions.TenMinuteUpdate(); if (IsEclipse) { Game1.globalOutdoorLighting = .5f; Game1.ambientLight = nightColor; Game1.currentLocation.switchOutNightTiles(); ResetTicker = 1; if (!Game1.currentLocation.isOutdoors && Game1.currentLocation is DecoratableLocation) { var loc = Game1.currentLocation as DecoratableLocation; foreach (Furniture f in loc.furniture) { if (f.furniture_type == Furniture.window) { Helper.Reflection.GetMethod(f, "addLights").Invoke(new object[] { Game1.currentLocation }); } } } if ((Game1.farmEvent == null && Game1.random.NextDouble() < (0.25 - Game1.dailyLuck / 2.0)) && ((WeatherOpt.SpawnMonsters && Game1.spawnMonstersAtNight) || (WeatherOpt.SpawnMonstersAllFarms))) { Monitor.Log("Spawning a monster, or attempting to.", LogLevel.Debug); if (Game1.random.NextDouble() < 0.25) { if (this.Equals(Game1.currentLocation)) { Game1.getFarm().spawnFlyingMonstersOffScreen(); return; } } else { Game1.getFarm().spawnGroundMonsterOffScreen(); } } } if (Conditions.HasWeather(CurrentWeather.Fog)) { if (!Game1.currentLocation.isOutdoors && Game1.currentLocation is DecoratableLocation) { var loc = Game1.currentLocation as DecoratableLocation; foreach (Furniture f in loc.furniture) { //Yes, *add* lights removes them. No, don't ask me why. if (f.furniture_type == Furniture.window) { //if (WeatherOpt.Verbose) Monitor.Log($"Attempting to remove the light for {f.name}"); Helper.Reflection.GetMethod(f, "addLights").Invoke(new object[] { Game1.currentLocation }); } } } } if (Game1.currentLocation.isOutdoors && Conditions.HasWeather(CurrentWeather.Lightning) && Game1.timeOfDay < 2400) { Utility.performLightningUpdate(); } //queued messages clear if (Game1.timeOfDay == 610 && queuedMsg != null) { Game1.hudMessages.Add(queuedMsg); queuedMsg = null; } //frost works at night, heatwave works during the day if (Game1.timeOfDay == 1700) { if (Conditions.HasWeather(CurrentWeather.Heatwave)) { ExpireTime = 2000; Farm f = Game1.getFarm(); int count = 0, maxCrops = (int)Math.Floor(SDVUtilities.CropCountInFarm(f) * WeatherOpt.DeadCropPercentage); foreach (KeyValuePair <Vector2, TerrainFeature> tf in f.terrainFeatures) { if (count >= maxCrops) { break; } if (tf.Value is HoeDirt curr && curr.crop != null) { if (Dice.NextDouble() <= WeatherOpt.CropResistance) { CropList.Add(tf.Key); curr.state = HoeDirt.dry; count++; } } } if (CropList.Count > 0) { if (WeatherOpt.AllowCropDeath) { SDVUtilities.ShowMessage(Helper.Translation.Get("hud-text.desc_heatwave_kill")); } else { SDVUtilities.ShowMessage(Helper.Translation.Get("hud-text.desc_heatwave_dry")); } } } } if (Game1.timeOfDay == ExpireTime && WeatherOpt.AllowCropDeath) { //if it's still de watered - kill it. Farm f = Game1.getFarm(); bool cDead = false; foreach (Vector2 v in CropList) { HoeDirt hd = (HoeDirt)f.terrainFeatures[v]; if (hd.state == HoeDirt.dry) { hd.crop.dead = true; cDead = true; } } if (cDead) { SDVUtilities.ShowMessage(Helper.Translation.Get("hud-text.desc_heatwave_cropdeath")); } } float oldStamina = Game1.player.stamina; Game1.player.stamina += StaminaMngr.TenMinuteTick(Conditions, TicksOutside, TicksTotal, Dice); if (Game1.player.stamina <= 0) { SDVUtilities.FaintPlayer(); } TicksTotal = 0; TicksOutside = 0; }