Exemple #1
0
            private void Update()
            {
                if (GameManager.m_IsPaused)
                {
                    return;
                }

                int currentDay = ThreeDaysOfNight.GetCurrentDayNumber();

                if (ThreeDaysOfNight.m_CurrentDay != currentDay && !IsMainMenu() && Is4DoNSave())
                {
                    ThreeDaysOfNight.m_CurrentDay = currentDay;
                    MainMissionManager mainMissionManager = GameManager.GetSandboxManager().m_MainMissionManager;
                    mainMissionManager.SendMissionEvent("4DON_DayChange");
                    string key = "NOTIFICATION_4DONDay" + ThreeDaysOfNight.m_CurrentDay + "Title";
                    FullScreenMessage.AddMessage(Localization.Get(key), 10f, false, true);
                    GameManager.GetWeatherTransitionComponent().ChooseNextWeatherSet(null, false);
                    if (ThreeDaysOfNight.m_CurrentDay == 4)
                    {
                        GameManager.GetWeatherTransitionComponent().OverrideDurationOfStageInCurrentWeatherSet(WeatherStage.Blizzard, 999999f);
                    }
                }
            }
        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);
        }
        private static bool Prefix(ActionsToBlock actionBeingChecked, ref bool __result)
        {
            if (!GameManager.GetPlayerManagerComponent().m_ActionsToBlockInDarkness.Contains(actionBeingChecked))
            {
                __result = false;
                return(false);
            }
            float num = 10f;

            for (int i = 0; i < GearManager.m_Gear.Count; i++)
            {
                if (!(GearManager.m_Gear[i] == null))
                {
                    if (Vector3.Distance(GearManager.m_Gear[i].transform.position, GameManager.GetVpFPSCamera().transform.position) <= num)
                    {
                        if (GearManager.m_Gear[i].IsLitFlare() || GearManager.m_Gear[i].IsLitLamp() || GearManager.m_Gear[i].IsLitMatch() || GearManager.m_Gear[i].IsLitTorch() || GearManager.m_Gear[i].IsLitFlashlight())
                        {
                            __result = false;
                            return(false);
                        }
                    }
                }
            }
            for (int j = 0; j < FireManager.m_Fires.Count; j++)
            {
                if (!(FireManager.m_Fires[j] == null))
                {
                    if (Vector3.Distance(FireManager.m_Fires[j].transform.position, GameManager.GetVpFPSCamera().transform.position) <= num)
                    {
                        if (FireManager.m_Fires[j].IsBurning())
                        {
                            __result = false;
                            return(false);
                        }
                    }
                }
            }
            for (int k = 0; k < AuroraManager.GetAuroraElectrolizerList().Count; k++)
            {
                if (!(AuroraManager.GetAuroraElectrolizerList()[k] == null))
                {
                    if (Vector3.Distance(AuroraManager.GetAuroraElectrolizerList()[k].transform.position, GameManager.GetVpFPSCamera().transform.position) <= num)
                    {
                        if (AuroraManager.GetAuroraElectrolizerList()[k].IsElectrolized())
                        {
                            __result = false;
                            return(false);
                        }
                    }
                }
            }
            if (MissionIlluminationArea.IsInIlluminationArea(GameManager.GetVpFPSCamera().transform.position))
            {
                __result = false;
                return(false);
            }
            if (GameManager.GetWeatherComponent().IsIndoorScene() && GameManager.GetUniStorm().IsNightOrNightBlend() && !ThreeDaysOfNight.IsActive())
            {
                __result = true;
                return(false);
            }
            bool flag = GameManager.GetWeatherComponent().IsDenseFog() || GameManager.GetWeatherComponent().IsBlizzard();

            __result = !GameManager.GetWeatherComponent().IsIndoorScene() && GameManager.GetUniStorm().IsNightOrNightBlend() && flag;
            return(false);
        }
Exemple #4
0
 private static void Postfix(ThreeDaysOfNight __instance)
 {
     // Work around not being able to patch the empty ThreeDaysOfNight#Update method as this doesn't work on MacOS
     // Instead, add another MonoBehavior and use that object's Update method
     __instance.gameObject.AddComponent <MacWorkaround>();
 }