public FerngillBlizzard(MersenneTwister Dice, WeatherConfig config) { ExpirTime = new SDVTime(2600); BeginTime = new SDVTime(0600); this.Dice = Dice; this.ModConfig = config; }
/// <summary> Default constructor. </summary> internal FerngillSandstorm() { BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(0600); BloodMoon = false; SandstormElapsed = new Stopwatch(); }
public void CreateWeather() { //Blizzards opt to mostly being all day. BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(2800); if (ClimatesOfFerngill.Dice.NextDouble() >= .5 && ClimatesOfFerngill.Dice.NextDouble() < .8) { Console.WriteLine($"Truly Dark: {Game1.getTrulyDarkTime()} Moderately: {Game1.getModeratelyDarkTime()} Starting: {Game1.getStartingToGetDarkTime()}"); ExpirTime = new SDVTime(Game1.getModeratelyDarkTime()); } if (ClimatesOfFerngill.Dice.NextDouble() >= .8 && ClimatesOfFerngill.Dice.NextDouble() < .95) { ExpirTime = new SDVTime((BeginTime.ReturnIntTime() + 1000)); } if (ClimatesOfFerngill.Dice.NextDouble() >= .95) { ExpirTime = new SDVTime((BeginTime.ReturnIntTime() + 500)); } if (SDVTime.CurrentTime >= BeginTime) { IsBlizzard = true; UpdateStatus(WeatherType, true); } }
protected internal static SDVTime GetTimeAtHourAngle(double angle, bool morning = true) { var date = SDate.Now(); int dayOfYear = date.DaysSinceStart % 112; double lat = GeneralFunctions.DegreeToRadians(NightConfig.Latitude); double solarDeclination = .40927971 * Math.Sin((2 * Math.PI / 112) * (dayOfYear - 1)); double noon = 720 - 10 * Math.Sin(4 * (Math.PI / 112) * (dayOfYear - 1)) + 8 * Math.Sin(2 * (Math.PI / 112) * dayOfYear); double astroHA = Math.Acos((Math.Sin(angle) - Math.Sin(lat) * Math.Sin(solarDeclination)) / (Math.Cos(lat) * Math.Cos(solarDeclination))); double minHA = (astroHA / (2 * Math.PI)) * 1440; int astroTwN = 0; if (!morning) { astroTwN = (int)Math.Floor(noon + minHA); } else { astroTwN = (int)Math.Floor(noon - minHA); } //Conv to an SDV compat time, then clamp it. int hr = (int)Math.Floor(astroTwN / 60.0); int min = astroTwN - (hr * 60); SDVTime calcTime = new SDVTime(hr, min); calcTime.ClampToTenMinutes(); return(calcTime); }
public void ForceWeatherEnd() { ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); FadeOutSandstorm = true; SandstormElapsed.Start(); UpdateStatus(WeatherType, false); }
protected internal static SDVTime GetTimeAtHourAngle(SDate day, double angle, bool morning = true) { int astroTwN; int dayOfYear = day.DaysSinceStart % 112; //handle lat changes float baseLat = NightConfig.Latitude; if (Game1.currentLocation != null && Game1.currentLocation is IslandLocation && NightConfig.IslandLatDifference != 0f) { baseLat = (NightConfig.Latitude > 0 ? NightConfig.Latitude - NightConfig.IslandLatDifference : NightConfig.Latitude + NightConfig.IslandLatDifference); //sanity check it. if ((NightConfig.Latitude > 0 && baseLat < 0) || (NightConfig.Latitude < 0 && baseLat > 0)) { baseLat = 0; } } double lat = MathHelper.ToRadians(baseLat); //23.45 deg * sin(2pi / 112 * (dayOfYear - 1)) double solarDeclination = .40927971 * Math.Sin((2 * Math.PI / 112) * (dayOfYear - 1)); double noon = 720 - 10 * Math.Sin(4 * (Math.PI / 112) * (dayOfYear - 1)) + 8 * Math.Sin(2 * (Math.PI / 112) * dayOfYear); double astroHA = Math.Acos((Math.Sin(angle) - Math.Sin(lat) * Math.Sin(solarDeclination)) / (Math.Cos(lat) * Math.Cos(solarDeclination))); double minHA = (astroHA / (2 * Math.PI)) * 1440; if (double.IsNaN(minHA)) { minHA = noon; } if (!morning) { astroTwN = (int)Math.Floor(noon + minHA); } else { astroTwN = (int)Math.Floor(noon - minHA); } if (astroTwN < 0) { astroTwN = 0; } if (astroTwN > 1560) { astroTwN = 1560; } //Conv to an SDV compat time, then clamp it. int hr = (int)Math.Floor(astroTwN / 60.0); int min = astroTwN - (hr * 60); SDVTime calcTime = new SDVTime(hr, min); calcTime.ClampToTenMinutes(); return(calcTime); }
public void EndWeather() { if (IsWeatherVisible) { ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); UpdateStatus(WeatherType, false); } }
public void CreateWeather() { WeatherBeginTime = new SDVTime(0600); WeatherExpirationTime = new SDVTime(2600); UpdateStatus("customrain", true); IsWeatherVisible = true; }
public void ForceWeatherEnd() { WeatherBeginTime = new SDVTime(0600); WeatherExpirationTime = new SDVTime(0600); UpdateStatus("customrain", false); IsWeatherVisible = false; }
public static void Postfix(ref int __result) { SDVTime calcTime = DynamicNightTime.GetSunset(); calcTime.ClampToTenMinutes(); __result = calcTime.ReturnIntTime(); }
public void ForceWeatherEnd() { ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); CurrentFogType = FogType.None; FogElapsed.Start(); FadeOutFog = true; UpdateStatus(WeatherType, false); }
public int GetMoonZenith() { int moonDuration = SDVTime.MinutesBetweenTwoIntTimes(GetMoonSetTime(), GetMoonRiseTime()); SDVTime mr = new SDVTime(GetMoonRiseTime()); mr.AddTime(moonDuration / 2); return(mr.ReturnIntTime()); }
/// <summary> Default constructor. </summary> internal FerngillFog(SDVTimePeriods FogPeriod) { CurrentFogType = FogType.None; BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(0600); BloodMoon = false; FogTimeSpan = FogPeriod; FogElapsed = new Stopwatch(); }
public int GetBathHouseDuration() { if (timeInBathHouse == 0) { return(0); } Monitor.Log($"Time Of Day: {Game1.timeOfDay}, Time In Bath House: {timeInBathHouse}"); return(SDVTime.MinutesBetweenTwoIntTimes(this.timeInBathHouse, Game1.timeOfDay)); }
public void EndWeather() { if (IsWeatherVisible) { ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); FadeOutSandstorm = true; SandstormElapsed.Start(); UpdateStatus(WeatherType, false); } }
public void Reset() { BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(0600); BloodMoon = false; SandstormAlpha = 0f; FadeOutSandstorm = false; FadeInSandstorm = false; SandstormElapsed.Reset(); }
public static SDVTime GetSunset() { SDVTime s = GetTimeAtHourAngle(0.01163611, false); if (NightConfig.SunsetTimesAreMinusThirty) { s.AddTime(-30); } return(s); }
public void EndWeather() { if (IsWeatherVisible) { ExpirTime = new SDVTime(SDVTime.CurrentTime - 10); CurrentFogType = FogType.None; FogElapsed.Start(); FadeOutFog = true; UpdateStatus(WeatherType, false); } }
/// <summary> This function resets the fog. </summary> public void Reset() { CurrentFogType = FogType.None; BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(0600); BloodMoon = false; FogAlpha = 0f; FadeOutFog = false; FadeInFog = false; FogElapsed.Reset(); }
public float GetTrackPosition() { int moonDuration = SDVTime.MinutesBetweenTwoIntTimes(GetMoonSetTime(), GetMoonRiseTime()); int timeSinceRise = SDVTime.MinutesBetweenTwoIntTimes(Game1.timeOfDay, GetMoonRiseTime()); if (Game1.timeOfDay < GetMoonRiseTime() || Game1.timeOfDay > GetMoonSetTime()) { return(0f); } return(timeSinceRise / moonDuration); }
public void CreateWeather() { //set the begin and end time SDVTime stormStart = new SDVTime(1150 + (Dice.Next(0, 230))); stormStart.ClampToTenMinutes(); BeginTime = new SDVTime(stormStart); stormStart.AddTime(Dice.Next(30, 190)); stormStart.ClampToTenMinutes(); ExpirTime = new SDVTime(stormStart); }
public void ForceWeatherStart() { SandstormAlpha = 1f; BeginTime = new SDVTime(0600); ExpirTime = new SDVTime(0600); if (ClimatesOfFerngill.WeatherOpt.ShowLighterFog) { SandstormAlpha = .3f; } UpdateStatus(WeatherType, true); }
internal void SetEveningFog() { SDVTime STime, ETime; STime = new SDVTime(Game1.getStartingToGetDarkTime()); STime.AddTime(Dice.Next(-25, 80)); ETime = new SDVTime(STime); ETime.AddTime(Dice.Next(120, 310)); STime.ClampToTenMinutes(); ETime.ClampToTenMinutes(); this.SetWeatherTime(STime, ETime); }
protected internal static SDVTime GetSolarNoon() { var date = SDate.Now(); int dayOfYear = date.DaysSinceStart % 112; double noon = 720 - 10 * Math.Sin(2 * (Math.PI / 112) * (dayOfYear)) + 8 * Math.Sin((Math.PI / 112) * dayOfYear); int noonTime = (int)Math.Floor(noon); int hr = (int)Math.Floor(noonTime / 60.0); SDVTime calcTime = new SDVTime(hr, noonTime - (hr * 60)); calcTime.ClampToTenMinutes(); return(calcTime); }
internal void SetEveningFog() { var sTime = new SDVTime(Game1.getStartingToGetDarkTime()); sTime.AddTime(ClimatesOfFerngill.Dice.Next(-25, 80)); var eTime = new SDVTime(sTime); eTime.AddTime(ClimatesOfFerngill.Dice.Next(120, 310)); sTime.ClampToTenMinutes(); eTime.ClampToTenMinutes(); SetWeatherTime(sTime, eTime); }
protected internal static SDVTime GetBeginningOfLateAfternoon() { SDVTime Noon = GetSolarNoon(); SDVTime Sunset = GetSunset(); int numMinutes = Sunset.GetNumberOfMinutesFromMidnight() - Noon.GetNumberOfMinutesFromMidnight(); int lateAfternoon = (int)Math.Floor(numMinutes * .62); SDVTime LateAfternoon = new SDVTime(Noon); LateAfternoon.AddTime(lateAfternoon); LateAfternoon.ClampToTenMinutes(); return(LateAfternoon); }
protected internal static SDVTime GetEndOfEarlyMorning() { SDVTime Noon = GetSolarNoon(); SDVTime Sunrise = GetSunrise(); int numMinutes = Noon.GetNumberOfMinutesFromMidnight() - Sunrise.GetNumberOfMinutesFromMidnight(); int endOfEarlyMorning = (int)Math.Floor(numMinutes * .38); SDVTime EndOfEarlyMorning = new SDVTime(Sunrise); EndOfEarlyMorning.AddTime(endOfEarlyMorning); EndOfEarlyMorning.ClampToTenMinutes(); return(EndOfEarlyMorning); }
protected internal static SDVTime GetSolarNoon() { var date = SDate.Now(); int dayOfYear = date.DaysSinceStart % 112; double lat = GeneralFunctions.DegreeToRadians(NightConfig.Latitude); double solarDeclination = .40927971 * Math.Sin((2 * Math.PI / 112) * (dayOfYear - 1)); double noon = 720 - 10 * Math.Sin(4 * (Math.PI / 112) * (dayOfYear - 1)) + 8 * Math.Sin(2 * (Math.PI / 112) * dayOfYear); int noonTime = (int)Math.Floor(noon); int hr = (int)Math.Floor(noonTime / 60.0); SDVTime calcTime = new SDVTime(hr, noonTime - (hr * 60)); calcTime.ClampToTenMinutes(); return(calcTime); }
internal void ForceEveningFog() { //Get fog instance List<ISDVWeather> fogWeather = this.GetWeatherMatchingType("Fog"); foreach (ISDVWeather weat in fogWeather) { SDVTime BeginTime, ExpirTime; BeginTime = new SDVTime(Game1.getStartingToGetDarkTime()); BeginTime.AddTime(Dice.Next(-15, 90)); ExpirTime = new SDVTime(BeginTime); ExpirTime.AddTime(Dice.Next(120, 310)); BeginTime.ClampToTenMinutes(); ExpirTime.ClampToTenMinutes(); weat.SetWeatherTime(BeginTime, ExpirTime); } }
protected internal static SDVTime GetTimeAtHourAngle(double angle, bool morning = true) { int astroTwN; int dayOfYear = SDate.Now().DaysSinceStart % 112; double lat = MathHelper.ToRadians((float)NightConfig.Latitude); //23.45 deg * sin(2pi / 112 * (dayOfYear - 1)) double solarDeclination = .40927971 * Math.Sin((2 * Math.PI / 112) * (dayOfYear - 1)); double noon = 720 - 10 * Math.Sin(4 * (Math.PI / 112) * (dayOfYear - 1)) + 8 * Math.Sin(2 * (Math.PI / 112) * dayOfYear); double astroHA = Math.Acos((Math.Sin(angle) - Math.Sin(lat) * Math.Sin(solarDeclination)) / (Math.Cos(lat) * Math.Cos(solarDeclination))); double minHA = (astroHA / (2 * Math.PI)) * 1440; if (double.IsNaN(minHA)) { minHA = noon; } if (!morning) { astroTwN = (int)Math.Floor(noon + minHA); } else { astroTwN = (int)Math.Floor(noon - minHA); } if (astroTwN < 0) { astroTwN = 0; } if (astroTwN > 1560) { astroTwN = 1560; } //Conv to an SDV compat time, then clamp it. int hr = (int)Math.Floor(astroTwN / 60.0); int min = astroTwN - (hr * 60); SDVTime calcTime = new SDVTime(hr, min); calcTime.ClampToTenMinutes(); return(calcTime); }