private static bool Prefix(Fire __instance, ref float ___m_BurningTimeTODHours, Campfire ___m_Campfire, bool ___m_IsPerpetual, float ___m_MaxOnTODSeconds, ref float ___m_ElapsedOnTODSeconds, ref float ___m_ElapsedOnTODSecondsUnmodified, FireState ___m_FireState, EffectsControllerFire ___m_FX, ref float ___m_FuelHeatIncrease, ref float ___m_EmberDurationSecondsTOD, ref bool ___m_UseEmbers) { var setting = Fire_RVSettings.Instance; if (Fire_RV.scene_loading || GameManager.m_IsPaused) { return(false); } if (___m_FireState == FireState.Off) { HeatReservoir reservoir = Fire_RV.GetHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject)); //we have to update if (reservoir != null) { if (__instance.m_HeatSource == null) { __instance.m_HeatSource = new HeatSource(); GameManager.GetHeatSourceManagerComponent().AddHeatSource(__instance.m_HeatSource); } if (!GameManager.GetHeatSourceManagerComponent().m_HeatSources.Contains(__instance.m_HeatSource)) { GameManager.GetHeatSourceManagerComponent().AddHeatSource(__instance.m_HeatSource); } reservoir.Update(__instance); AccessTools.Field(typeof(HeatSource), "m_MaxTempIncrease").SetValue(__instance.m_HeatSource, (object)(reservoir.temp)); AccessTools.Field(typeof(HeatSource), "m_TempIncrease").SetValue(__instance.m_HeatSource, (object)(reservoir.temp)); if (reservoir.temp < 0.05f) { Fire_RV.RemoveReservoir(reservoir.GUID); } __instance.m_HeatSource.m_MaskTempIncrease = false; } Utils.SetActive(___m_FX.lighting.gameObject, false); ___m_FX.DeactivateAllFX(); // this.m_TimeOffSeconds = float.NegativeInfinity; //} return(false); } AccessTools.Method(typeof(Fire), "UpdateFireStage").Invoke(__instance, null); if (!___m_IsPerpetual) { AccessTools.Method(typeof(Fire), "MaybeBlowOutFromWind").Invoke(__instance, null); float deltaTime = GameManager.GetTimeOfDayComponent().GetTODSeconds(Time.deltaTime); float f = 1; if ((bool)___m_Campfire) { Vector3 position = __instance.transform.position; position.y += 1f; if (!GameManager.GetWindComponent().IsPositionOccludedFromWind(position) && setting.WindReworked) { float relativwind = GameManager.GetWindComponent().GetSpeedMPH() / GameManager.GetFireManagerComponent().m_WindSpeedThatBlowsOutFires; float temp = (float)AccessTools.Field(typeof(HeatSource), "m_TempIncrease").GetValue(__instance.m_HeatSource); f *= (1 + relativwind); temp /= (1 + relativwind * deltaTime / 60f); AccessTools.Field(typeof(HeatSource), "m_TempIncrease").SetValue(__instance.m_HeatSource, temp); } } ___m_ElapsedOnTODSecondsUnmodified += deltaTime; ___m_ElapsedOnTODSeconds += deltaTime * f; } AccessTools.Method(typeof(Fire), "UpdateFireAudio").Invoke(__instance, null); bool fireOn = __instance.m_HeatSource.IsTurnedOn(); //if (!fireOn || __instance.IsEmbers()) { ___m_FuelHeatIncrease = 0; } HeatReservoir myreservoir = Fire_RV.GetHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject)); if (myreservoir == null && fireOn) { //shucks create new one... Fire_RV.CreateHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject)); myreservoir = Fire_RV.GetHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject)); } float myreservoirtemp = 0; if (myreservoir != null) { myreservoirtemp = myreservoir.temp; //update the reservoir myreservoir.Update(__instance); if (!GameManager.GetWeatherComponent().IsIndoorEnvironment()) { myreservoir.heatingsize = Mathf.Clamp(myreservoir.heatingsize, 5f, 25f); } else { myreservoir.heatingsize = Mathf.Clamp(myreservoir.heatingsize, 5f, 1000f); } //myreservoir.heatingsize = fuel.m_FuelSourceItem.m_HeatOuterRadius * fire_outer + reservoir.heatingsize; __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius = myreservoir.heatingsize; if (!fireOn && Mathf.Abs(myreservoirtemp) < 0.05) { Fire_RV.RemoveReservoir(myreservoir.GUID); } } if (___m_ElapsedOnTODSeconds <= ___m_MaxOnTODSeconds) { //fire is not in ember stage ___m_UseEmbers = false; AccessTools.Field(typeof(HeatSource), "m_MaxTempIncrease").SetValue(__instance.m_HeatSource, (object)(___m_FuelHeatIncrease + myreservoirtemp)); // do some weird score keeping float num = ___m_ElapsedOnTODSecondsUnmodified / 60f / 60f; System.Object[] temp = { num }; AccessTools.Method(typeof(Fire), "MaybeUpdateLongestBurningFireStat").Invoke(__instance, temp); ___m_BurningTimeTODHours = num; } else { //fire is past its natural lifetime, ember stage or out... //fire is past its natural lifetime, ember stage or out... // Debug.Log("HeatReservoir " + myreservoir.embercmins.ToString()); float fireRivieSkill = 1; switch (GameManager.GetSkillFireStarting().GetCurrentTierNumber()) { case 0: fireRivieSkill = 10f; break; case 1: fireRivieSkill = 1f; break; case 2: fireRivieSkill = 0.1f; break; case 3: fireRivieSkill = 0.01f; break; case 4: fireRivieSkill = 0.001f; break; } if (myreservoir != null && (myreservoir.embercmins > fireRivieSkill || ___m_FuelHeatIncrease > 0.05) && (___m_FuelHeatIncrease + myreservoir.temp) > 1) { ___m_UseEmbers = true; ___m_FX.TriggerStage(FireState.Starting_TinderSmolder, ___m_UseEmbers, false); AccessTools.Field(typeof(HeatSource), "m_MaxTempIncrease").SetValue(__instance.m_HeatSource, (object)(___m_FuelHeatIncrease + myreservoir.temp)); } else { //fire out ___m_UseEmbers = false; ___m_FX.TriggerStage(FireState.Starting_TinderSmolder, ___m_UseEmbers, false); //if(myreservoir.temp<0.01) __instance.m_HeatSource.TurnOff(); __instance.TurnOff(); // AccessTools.Field(typeof(HeatSource), "m_TempIncrease").SetValue(__instance.m_HeatSource, (object)(myreservoir.temp)); if (___m_Campfire) { ___m_Campfire.SetState(CampfireState.BurntOut); } } } return(false); }