internal static void MaybeRepositionFireButtonPrompt(EquipItemPopup equipItemPopup, String otherAction) { ModUtils.ExecuteMethod(equipItemPopup, "MaybeRepositionFireButtonPrompt", new object[] { otherAction, }); }
internal static void ShowItemIcons(EquipItemPopup equipItemPopup, String primaryAction, String secondaryAction, bool showAmmo, bool showDuration) { ModUtils.ExecuteMethod(equipItemPopup, "ShowItemIcons", new object[] { primaryAction, secondaryAction, showAmmo, showDuration }); }
public static void Postfix(GearItem gi, ref bool __result) { // guns can always be examined __result |= ModUtils.GetComponent <GunItem>(gi) != null; }
private static GearTypeEnum GetGearType(ModComponent modComponent) { if (modComponent.InventoryCategory != InventoryCategory.Auto) { return(ModUtils.TranslateEnumValue <GearTypeEnum, InventoryCategory>(modComponent.InventoryCategory)); } if (modComponent is ModToolComponent) { return(GearTypeEnum.Tool); } if (modComponent is ModFoodComponent || modComponent is ModCookableComponent || (modComponent as ModLiquidItemComponent)?.LiquidType == LiquidType.Water) { return(GearTypeEnum.Food); } if (modComponent is ModClothingComponent) { return(GearTypeEnum.Clothing); } if (ModUtils.GetComponent <ModFireStartingComponent>(modComponent) != null || ModUtils.GetComponent <ModBurnableComponent>(modComponent) != null) { return(GearTypeEnum.Firestarting); } return(GearTypeEnum.Other); }
private static void ConfigureFood(ModComponent modComponent) { ModFoodComponent modFoodComponent = modComponent as ModFoodComponent; if (modFoodComponent == null) { return; } FoodItem foodItem = ModUtils.GetOrCreateComponent <FoodItem>(modFoodComponent); foodItem.m_CaloriesTotal = modFoodComponent.Calories; foodItem.m_CaloriesRemaining = modFoodComponent.Calories; foodItem.m_ReduceThirst = modFoodComponent.ThirstEffect; foodItem.m_ChanceFoodPoisoning = Mathf.Clamp01(modFoodComponent.FoodPoisoning / 100f); foodItem.m_ChanceFoodPoisoningLowCondition = Mathf.Clamp01(modFoodComponent.FoodPoisoningLowCondition / 100f); foodItem.m_DailyHPDecayInside = GetDecayPerStep(modFoodComponent.DaysToDecayIndoors, modFoodComponent.MaxHP); foodItem.m_DailyHPDecayOutside = GetDecayPerStep(modFoodComponent.DaysToDecayOutdoors, modFoodComponent.MaxHP); foodItem.m_TimeToEatSeconds = Mathf.Clamp(1, modFoodComponent.EatingTime, 10); foodItem.m_EatingAudio = modFoodComponent.EatingAudio; foodItem.m_OpenAndEatingAudio = modFoodComponent.EatingPackagedAudio; foodItem.m_Packaged = !string.IsNullOrEmpty(foodItem.m_OpenAndEatingAudio); foodItem.m_IsDrink = modFoodComponent.Drink; foodItem.m_IsFish = modFoodComponent.Fish; foodItem.m_IsMeat = modFoodComponent.Meat; foodItem.m_IsRawMeat = modFoodComponent.Raw; foodItem.m_IsNatural = modFoodComponent.Natural; foodItem.m_ParasiteRiskPercentIncrease = ModUtils.NotNull(modFoodComponent.ParasiteRiskIncrements); foodItem.m_PercentHeatLossPerMinuteIndoors = 1; foodItem.m_PercentHeatLossPerMinuteOutdoors = 2; if (modFoodComponent.Opening) { foodItem.m_GearRequiredToOpen = true; foodItem.m_OpenedWithCanOpener = modFoodComponent.OpeningWithCanOpener; foodItem.m_OpenedWithHatchet = modFoodComponent.OpeningWithHatchet; foodItem.m_OpenedWithKnife = modFoodComponent.OpeningWithKnife; if (modFoodComponent.OpeningWithSmashing) { SmashableItem smashableItem = ModUtils.GetOrCreateComponent <SmashableItem>(modFoodComponent); smashableItem.m_MinPercentLoss = 10; smashableItem.m_MaxPercentLoss = 30; smashableItem.m_TimeToSmash = 6; smashableItem.m_SmashAudio = "Play_EatingSmashCan"; } if (modFoodComponent.Canned) { foodItem.m_GearPrefabHarvestAfterFinishEatingNormal = Resources.Load <GameObject>("GEAR_RecycledCan"); } } if (modFoodComponent.AffectRest) { FatigueBuff fatigueBuff = ModUtils.GetOrCreateComponent <FatigueBuff>(modFoodComponent); fatigueBuff.m_InitialPercentDecrease = modFoodComponent.InstantRestChange; fatigueBuff.m_RateOfIncreaseScale = modFoodComponent.RestFactor; fatigueBuff.m_DurationHours = modFoodComponent.RestFactorMinutes / 60f; } if (modFoodComponent.AffectCold) { FreezingBuff freezingBuff = ModUtils.GetOrCreateComponent <FreezingBuff>(modFoodComponent); freezingBuff.m_InitialPercentDecrease = modFoodComponent.InstantColdChange; freezingBuff.m_RateOfIncreaseScale = modFoodComponent.ColdFactor; freezingBuff.m_DurationHours = modFoodComponent.ColdFactorMinutes / 60f; } if (modFoodComponent.AffectCondition) { ConditionRestBuff conditionRestBuff = ModUtils.GetOrCreateComponent <ConditionRestBuff>(modFoodComponent); conditionRestBuff.m_ConditionRestBonus = modFoodComponent.ConditionRestBonus; conditionRestBuff.m_NumHoursRestAffected = modFoodComponent.ConditionRestMinutes / 60f; } if (modFoodComponent.ContainsAlcohol) { AlcoholComponent alcohol = ModUtils.GetOrCreateComponent <AlcoholComponent>(modFoodComponent); alcohol.AmountTotal = modFoodComponent.WeightKG * modFoodComponent.AlcoholPercentage * 0.01f; alcohol.AmountRemaining = alcohol.AmountTotal; alcohol.UptakeSeconds = modFoodComponent.AlcoholUptakeMinutes * 60; } HoverIconsToShow hoverIconsToShow = ModUtils.GetOrCreateComponent <HoverIconsToShow>(modFoodComponent); hoverIconsToShow.m_HoverIcons = new HoverIconsToShow.HoverIcons[] { HoverIconsToShow.HoverIcons.Food }; }
public MappedItem RegisterInConsole(string displayName) { ModUtils.RegisterConsoleGearName(displayName, gameObject.name); return(this); }
internal static void Prefix(PlayerManager __instance) { GearEquipper.OnUnequipped(ModUtils.GetEquippableModComponent(__instance.m_ItemInHands)); }