Example #1
0
        internal static string GetWeatherStageName(WeatherStage stage)
        {
            string weatherName = "default";

            switch (stage)
            {
            case WeatherStage.ClearAurora:
                weatherName = "aurora";
                break;

            case WeatherStage.Clear:
                weatherName = "clear";
                break;

            case WeatherStage.PartlyCloudy:
                weatherName = "partlycloudy";
                break;

            case WeatherStage.Cloudy:
                weatherName = "cloudy";
                break;

            case WeatherStage.LightFog:
                weatherName = "lightfog";
                break;

            case WeatherStage.DenseFog:
                weatherName = "densefog";
                break;

            case WeatherStage.LightSnow:
                weatherName = "lightsnow";
                break;

            case WeatherStage.HeavySnow:
                weatherName = "heavysnow";
                break;

            case WeatherStage.Blizzard:
                weatherName = "blizzard";
                break;

            default:
                weatherName = "default";
                break;
            }

            return(weatherName);
        }
        private static bool Prefix(Weather __instance, ref float ___m_CurrentTemperature, float ___m_CurrentBlizzardDegreesDrop, float ___m_ArtificalTempIncrease, ref float ___m_CurrentTemperatureWithoutHeatSources, float ___m_LockedAirTemperature)
        {
            if (Solstice_RV.scene_loading)
            {
                return(false);
            }
            if (Solstice_RV.lastTemperatureUpdate == -100f)
            {
                Solstice_RV.lastTemperatureUpdate = -90f;
                return(false);
            }
            if (Solstice_RV.lastTemperatureUpdate == -90f)
            {
                Solstice_RV.lastTemperatureUpdate = Solstice_RV.unitime();
                return(false);
            }
            WeatherStage curWeather = GameManager.GetWeatherComponent().GetWeatherStage();

            float ins  = Solstice_RV.InsulationFactor(curWeather);
            float mins = (Solstice_RV.unitime() - Solstice_RV.lastTemperatureUpdate) * 24 * 60;

            Solstice_RV.lastTemperatureUpdate = Solstice_RV.unitime();


            Solstice_RV.airmassChangePerMin = ___m_CurrentBlizzardDegreesDrop * -0.01f;//yeah lets not hit this inside as temporary 10 deg drop -> -.2 deg/min or 12 deg/hour
            if (___m_CurrentBlizzardDegreesDrop > Solstice_RV.lastBlizDrop)
            {
                Solstice_RV.airmassChangePerMin *= 15;
            }
            Solstice_RV.lastBlizDrop = ___m_CurrentBlizzardDegreesDrop;

            if (curWeather == WeatherStage.DenseFog)
            {
                Solstice_RV.airmassChangePerMin = 10f * 0.015f;
            }
            if (curWeather == WeatherStage.LightFog)
            {
                Solstice_RV.airmassChangePerMin = 10f * 0.001f;
            }
            if (curWeather == WeatherStage.LightSnow)
            {
                Solstice_RV.airmassChangePerMin = 10f * 0.008f;
            }

            //   Debug.Log("Before Update:" + Solstice_RV.groundTemp + ":" + Solstice_RV.outsideTemp+" mins:"+mins+" unitime"+ Solstice_RV.unitime());
            Solstice_RV.updateTemps(Solstice_RV.unitime(), mins, Solstice_RV.airmassChangePerMin, ins, ref Solstice_RV.groundTemp, ref Solstice_RV.outsideTemp);
            //   Debug.Log("After Update:" + Solstice_RV.groundTemp + ":" + Solstice_RV.outsideTemp + " mins:" + mins);

            float alt_correction        = (GameManager.GetPlayerTransform().position.y + Solstice_RV.GetBaseHeight(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name)) / -100f;
            float ramp_correction       = Solstice_RV.TemperatureOffset;
            float adjusted_outside_temp = Solstice_RV.outsideTemp + alt_correction + ramp_correction;

            //Here is where we apportion indoor temp so all outdoor adjustments should be made before this
            bool flag = false;

            if (__instance.IsIndoorEnvironment())
            {
                flag = (!GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger || !GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger.m_UseOutdoorTemperature);
            }
            if (flag)
            {
                //indoor space
                adjusted_outside_temp  += Solstice_RV.lastoutsideAltitudeAdjustment;
                ___m_CurrentTemperature = (Solstice_RV.groundTemp + adjusted_outside_temp + __instance.m_IndoorTemperatureCelsius) / 3;

                if (ThreeDaysOfNight.IsActive() && ThreeDaysOfNight.GetCurrentDayNumber() == 4)
                {
                    ___m_CurrentTemperature = ThreeDaysOfNight.GetBaselineAirTempIndoors();
                }
            }
            else if (GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger)
            {
                //back of cave
                ___m_CurrentTemperature = (Solstice_RV.groundTemp * 2 + adjusted_outside_temp) / 3;// + GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger.m_TemperatureDeltaCelsius/4;
            }
            else
            {
                //We are outside outside
                ___m_CurrentTemperature = adjusted_outside_temp;
                Solstice_RV.lastoutsideAltitudeAdjustment = alt_correction;
                //altitude correction
            }


            if (GameManager.GetSnowShelterManager().PlayerInNonRuinedShelter())
            {
                ___m_CurrentTemperature += GameManager.GetSnowShelterManager().GetTemperatureIncreaseCelsius();
            }

            if (GameManager.GetPlayerInVehicle().IsInside())
            {
                ___m_CurrentTemperature += GameManager.GetPlayerInVehicle().GetTempIncrease();
            }

            if (!__instance.IsIndoorEnvironment())
            {
                float numDays = GameManager.GetTimeOfDayComponent().GetHoursPlayedNotPaused() / 24f;
                ___m_CurrentTemperature -= GameManager.GetExperienceModeManagerComponent().GetOutdoorTempDropCelcius(numDays);
            }

            ___m_CurrentTemperature += ___m_ArtificalTempIncrease;
            ___m_CurrentTemperature += Solstice_RV.playerSunBuff();
            ___m_CurrentTemperature += (float)GameManager.GetFeatColdFusion().GetTemperatureCelsiusBonus();

            ___m_CurrentTemperatureWithoutHeatSources = ___m_CurrentTemperature;
            ___m_CurrentTemperature += GameManager.GetHeatSourceManagerComponent().GetTemperatureIncrease();



            if (___m_LockedAirTemperature > -1000f)
            {
                ___m_CurrentTemperature = ___m_LockedAirTemperature;
            }
            return(false);
        }