Пример #1
0
        private static bool Prefix(Fire __instance, ref bool __result)
        {
            if (__instance.m_IsPerpetual)
            {
                __result = false;
                return(false);
            }
            float fire_temp         = (float)AccessTools.Field(typeof(Fire), "m_FuelHeatIncrease").GetValue(__instance);
            float fire_time         = __instance.GetRemainingLifeTimeSeconds();
            float remaining_fire_cs = fire_time * fire_temp;

            __result = remaining_fire_cs > (Fire_RV.torch_cost(__instance));
            return(false);
        }
Пример #2
0
        private static bool Prefix(Panel_FeedFire __instance, Fire ___m_Fire)

        {
            if ((bool)AccessTools.Method(typeof(Panel_FeedFire), "ProgressBarIsActive").Invoke(__instance, null) || !___m_Fire)
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            if (!___m_Fire.CanTakeTorch())//then we can't take torch
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            GearItem gearItem = GameManager.GetPlayerManagerComponent().InstantiateItemInPlayerInventory("GEAR_Torch");

            if (gearItem == null || gearItem.m_TorchItem == null)
            {
                return(false);
            }
            gearItem.OverrideGearCondition(GearStartCondition.Low);
            gearItem.m_TorchItem.m_ElapsedBurnMinutes = Mathf.Clamp01(1f - gearItem.m_CurrentHP / gearItem.m_MaxHP) * gearItem.m_TorchItem.GetModifiedBurnLifetimeMinutes();
            GameManager.GetPlayerAnimationComponent().MaybeDropAndResetCurrentWeapon();
            gearItem.m_TorchItem.Ignite();
            GameManager.GetPlayerManagerComponent().EquipItem(gearItem, false);
            GameManager.GetPlayerManagerComponent().ClearRestoreItemInHandsAfterInteraction();
            if (!___m_Fire.m_IsPerpetual)
            {
                float torchcost_cs      = Fire_RV.torch_cost(___m_Fire);
                float fire_temp         = (float)AccessTools.Field(typeof(Fire), "m_FuelHeatIncrease").GetValue(___m_Fire);
                float fire_time         = ___m_Fire.GetRemainingLifeTimeSeconds();
                float remaining_fire_cs = fire_time * fire_temp;
                float new_fire_cs       = (remaining_fire_cs - torchcost_cs);
                float myfactor          = Mathf.Pow(new_fire_cs / remaining_fire_cs, 0.5f);
                float time_reduction    = fire_time - (fire_time * myfactor);
                float heat_reduction    = fire_temp - (fire_temp * myfactor);
                Debug.Log("new_cs:" + new_fire_cs + " ratio::" + (new_fire_cs / remaining_fire_cs) + " myfactor::" + myfactor + " timered::" + time_reduction + " heat_red:" + heat_reduction);
                ___m_Fire.ReduceDurationByTODSeconds(time_reduction);
                ___m_Fire.ReduceHeatByDegrees(heat_reduction);

                fire_temp = (float)AccessTools.Field(typeof(Fire), "m_FuelHeatIncrease").GetValue(___m_Fire);
                fire_time = ___m_Fire.GetRemainingLifeTimeSeconds();
                Debug.Log("Reducing Fire: Old cs:" + remaining_fire_cs + " New cs:" + fire_temp * fire_time);
            }
            __instance.ExitFeedFireInterface();
            return(false);
        }