Пример #1
0
        private static bool Prefix(Fire __instance, FuelSourceItem fuel, bool maskTempIncrease, ref float ___m_FuelHeatIncrease, ref float ___m_ElapsedOnTODSeconds, ref float ___m_ElapsedOnTODSecondsUnmodified, ref float ___m_MaxOnTODSeconds, FireState ___m_FireState)
        {
            GearItem component = fuel.GetComponent <GearItem>();

            if (!component)
            {
                return(false);
            }
            //Fire_RV.PrintHierarchy(__instance.gameObject);



            __instance.m_HeatSource.TurnOn();
            __instance.m_HeatSource.m_MaskTempIncrease           = maskTempIncrease;
            __instance.m_HeatSource.m_MaxTempIncrease           += Fire_RV.getModifiedHeatIncrease(component);
            __instance.m_HeatSource.m_MaxTempIncreaseInnerRadius = fuel.m_HeatInnerRadius;

            float         outradscale = (float)AccessTools.Method(typeof(Fire), "GetFireOuterRadiusScale").Invoke(__instance, null);
            HeatReservoir reservoir   = Fire_RV.GetHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject));

            if (reservoir == null)
            {
                __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius = fuel.m_HeatOuterRadius * outradscale;
            }
            else
            {
                __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius = fuel.m_HeatOuterRadius * outradscale + reservoir.heatingsize;
            }
            if (__instance.m_FX)
            {
                __instance.m_FX.TriggerStage(___m_FireState, true, true);
            }
            ___m_FuelHeatIncrease              = __instance.m_HeatSource.m_MaxTempIncrease;
            ___m_ElapsedOnTODSeconds           = 0f;
            ___m_ElapsedOnTODSecondsUnmodified = 0f;
            ___m_MaxOnTODSeconds = Fire_RV.getStoveDurationModifier(__instance.gameObject) * Fire_RV.getModifiedDuration(component) * 60f * 60f;
            return(false);
        }
Пример #2
0
        private static bool Prefix(Fire __instance, GearItem fuel, bool inForge, ref float ___m_MaxOnTODSeconds, ref float ___m_ElapsedOnTODSeconds, ref float ___m_FuelHeatIncrease)
        {
            //   Debug.Log("Fire:" + __instance.name);
            //Fire_RV.PrintHierarchy(__instance.gameObject);
            __instance.OnFuelBurnt(fuel);
            if (__instance.IsEmbers())
            {
                __instance.m_FX.TriggerStage(FireState.FullBurn, true, false);
                __instance.m_HeatSource.TurnOn();
            }
            if (___m_MaxOnTODSeconds < ___m_ElapsedOnTODSeconds)
            {
                ___m_MaxOnTODSeconds = ___m_ElapsedOnTODSeconds;
            }


            float old_time_remaining = __instance.GetRemainingLifeTimeSeconds();
            float old_max_tod        = ___m_MaxOnTODSeconds;
            float num = Fire_RV.getStoveDurationModifier(__instance.gameObject) * fuel.m_FuelSourceItem.GetModifiedBurnDurationHours(fuel.GetNormalizedCondition()) * 60f * 60f;

            if (!__instance.m_IsPerpetual)
            {
                ___m_MaxOnTODSeconds += num;
                float num2 = ___m_MaxOnTODSeconds - GameManager.GetFireManagerComponent().m_MaxDurationHoursOfFire * 60f * 60f;
                if (num2 > 0f)
                {
                    ___m_ElapsedOnTODSeconds -= num2;
                    ___m_ElapsedOnTODSeconds  = Mathf.Clamp(___m_ElapsedOnTODSeconds, 0f, float.PositiveInfinity);
                }
                ___m_MaxOnTODSeconds = Mathf.Clamp(___m_MaxOnTODSeconds, 0f, GameManager.GetFireManagerComponent().m_MaxDurationHoursOfFire * 60f * 60f);
            }
            float num3;

            if (inForge && fuel.m_FuelSourceItem.m_FireAgeMinutesBeforeAdding > 0f)
            {
                num3 = GameManager.GetFireManagerComponent().m_MaxHeatIncreaseOfFireInForge - ___m_FuelHeatIncrease;
            }
            else
            {
                num3 = GameManager.GetFireManagerComponent().m_MaxHeatIncreaseOfFire - ___m_FuelHeatIncrease;
            }
            num3 = Mathf.Clamp(num3, 0f, float.PositiveInfinity);

            float fuel_heat_increase     = Mathf.Min(num3, Fire_RV.getModifiedHeatIncrease(fuel));
            float fuel_duration_increase = __instance.GetRemainingLifeTimeSeconds() - old_time_remaining;

            ___m_MaxOnTODSeconds = old_max_tod;


            float degmins_old   = old_time_remaining * ___m_FuelHeatIncrease;
            float degmins_fuel  = fuel_duration_increase * fuel_heat_increase;
            float degmins_total = degmins_fuel + degmins_old;

            float shape_heat     = ___m_FuelHeatIncrease + fuel_heat_increase;
            float shape_duration = old_time_remaining + fuel_duration_increase;


            float correction = Mathf.Sqrt(degmins_total / (shape_heat * shape_duration));

            Debug.Log("Old Fire Duration:" + old_time_remaining / 60f + " Fire temp:" + ___m_FuelHeatIncrease);
            Debug.Log("Fuel Item:" + fuel.name + " Heat:" + fuel_heat_increase + " Duration:" + fuel_duration_increase / 60f);
            Debug.Log("degmins total:" + degmins_total + " reshaped degmins:" + (shape_heat * correction * shape_duration * correction));

            ___m_FuelHeatIncrease = shape_heat * correction;
            ___m_MaxOnTODSeconds  = ___m_ElapsedOnTODSeconds + shape_duration * correction;

            __instance.m_HeatSource.m_MaxTempIncrease            = ___m_FuelHeatIncrease;
            __instance.m_HeatSource.m_MaxTempIncreaseInnerRadius = Mathf.Max(fuel.m_FuelSourceItem.m_HeatInnerRadius, __instance.m_HeatSource.m_MaxTempIncreaseInnerRadius);

            float fire_outer = (float)AccessTools.Method(typeof(Fire), "GetFireOuterRadiusScale").Invoke(__instance, null);

            HeatReservoir reservoir = Fire_RV.GetHeatReservoir(Utils.GetGuidFromGameObject(__instance.gameObject));

            float extrasize = 0;

            if (reservoir != null)
            {
                reservoir.heatingsize += fuel.m_FuelSourceItem.m_HeatOuterRadius * fire_outer;
                extrasize              = reservoir.heatingsize;
            }
            //if (!GameManager.GetWeatherComponent().IsIndoorEnvironment()) __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius = Mathf.Clamp(reservoir.heatingsize, 5f, 25f);

            __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius = extrasize;  //Mathf.Max(fuel.m_FuelSourceItem.m_HeatOuterRadius * fire_outer, __instance.m_HeatSource.m_MaxTempIncreaseOuterRadius);



            __instance.m_FX.TriggerFlareupLarge();

            return(false);
        }