Exemple #1
0
        static void litFire(Fire fire)
        {
            var fuel = Resources.Load <GameObject>("gear_coal");

            if (fire.GetFireState() == FireState.Off)
            {
                fire.m_FuelPrefabIfLit = fuel.GetComponent <FuelSourceItem>();
                fire.StartFireLit();
            }

            fire.AddFuel(fuel.GetComponent <GearItem>(), false);
        }
Exemple #2
0
        private static bool Prefix(Panel_FeedFire __instance, Fire ___m_Fire, GameObject ___m_FireContainer, GearItem ___m_ResearchItemToBurn)
        {
            if ((bool)AccessTools.Method(typeof(Panel_FeedFire), "ProgressBarIsActive").Invoke(__instance, null))
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            GearItem selectedFuelSource = (GearItem)AccessTools.Method(typeof(Panel_FeedFire), "GetSelectedFuelSource").Invoke(__instance, null);

            if (selectedFuelSource == null)
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            FuelSourceItem fuelSourceItem = selectedFuelSource.m_FuelSourceItem;

            if (fuelSourceItem == null)
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            if (!___m_FireContainer)
            {
                GameAudioManager.PlayGUIError();
                return(false);
            }
            if (!___m_Fire)
            {
                return(false);
            }
            if (___m_Fire.FireShouldBlowOutFromWind())
            {
                HUDMessage.AddMessage(Localization.Get("GAMEPLAY_TooWindyToAddFuel"), false);
                GameAudioManager.PlayGUIError();
                return(false);
            }
            bool flag = true;

            if ((bool)AccessTools.Method(typeof(Panel_FeedFire), "FireInForge").Invoke(__instance, null) && fuelSourceItem.m_FireAgeMinutesBeforeAdding > 0f)
            {
                flag = false;
            }
            flag = false; //allow any duration of fire
            if (flag)
            {
                float num  = fuelSourceItem.GetModifiedBurnDurationHours(selectedFuelSource.GetNormalizedCondition()) * 60f;
                float num2 = ___m_Fire.GetRemainingLifeTimeSeconds() / 60f;
                float num3 = (num + num2) / 60f;
                if (num3 > GameManager.GetFireManagerComponent().m_MaxDurationHoursOfFire)
                {
                    GameAudioManager.PlayGUIError();
                    HUDMessage.AddMessage(Localization.Get("GAMEPLAY_CannotAddMoreFuel"), false);
                    return(false);
                }
            }
            int num4 = Mathf.RoundToInt(fuelSourceItem.m_FireAgeMinutesBeforeAdding - ___m_Fire.GetUnmodifiedMinutesBurning() - 10);

            if (num4 >= 1)
            {
                string text = Localization.Get("GAMEPLAY_BurnTimeNeededForCoal");
                text = text.Replace("{minutes}", num4.ToString());
                HUDMessage.AddMessage(text, false);
                GameAudioManager.PlayGUIError();
                return(false);
            }
            if (selectedFuelSource.m_ResearchItem && !selectedFuelSource.m_ResearchItem.IsResearchComplete())
            {
                ___m_ResearchItemToBurn = selectedFuelSource;
                InterfaceManager.m_Panel_Confirmation.ShowBurnResearchNotification(() => { AccessTools.Method(typeof(Panel_FeedFire), "ForceBurnResearchItem", null, null).Invoke(__instance, null); });
                return(false);
            }
            if (selectedFuelSource == GameManager.GetPlayerManagerComponent().m_ItemInHands)
            {
                GameManager.GetPlayerManagerComponent().UnequipItemInHandsSkipAnimation();
            }
            if (selectedFuelSource == GameManager.GetPlayerManagerComponent().m_PickupGearItem)
            {
                GameManager.GetPlayerManagerComponent().ResetPickup();
            }
            GameAudioManager.PlaySound(__instance.m_FeedFireAudio, InterfaceManager.GetSoundEmitter());
            ___m_Fire.AddFuel(selectedFuelSource, (bool)AccessTools.Method(typeof(Panel_FeedFire), "FireInForge").Invoke(__instance, null));
            GameManager.GetPlayerManagerComponent().ConsumeUnitFromInventory(fuelSourceItem.gameObject);
            return(false);
        }