internal static void Postfix(GearItem gi) { ModClothingComponent modClothingComponent = ModComponentUtils.ComponentUtils.GetComponent <ModClothingComponent>(gi); modClothingComponent?.OnTakeOff?.Invoke(); IntimidationBuffHelper.UpdateWolfIntimidationBuff(); }
private static void InitializeClothingComponent(ModClothingComponent modClothing, ProxyObject dict, string className = "ModClothingComponent") { InitializeBaseComponent(modClothing, dict, className); modClothing.Region = (Region)Enum.Parse(typeof(Region), dict[className]["Region"], true); modClothing.MinLayer = (Layer)Enum.Parse(typeof(Layer), dict[className]["MinLayer"], true); modClothing.MaxLayer = (Layer)Enum.Parse(typeof(Layer), dict[className]["MaxLayer"], true); modClothing.MovementSound = EnumUtils.ParseEnum <MovementSound>(dict[className]["MovementSound"]); modClothing.Footwear = EnumUtils.ParseEnum <Footwear>(dict[className]["Footwear"]); modClothing.DaysToDecayWornOutside = dict[className]["DaysToDecayWornOutside"]; modClothing.DaysToDecayWornInside = dict[className]["DaysToDecayWornInside"]; modClothing.Warmth = dict[className]["Warmth"]; modClothing.WarmthWhenWet = dict[className]["WarmthWhenWet"]; modClothing.Windproof = dict[className]["Windproof"]; modClothing.Waterproofness = dict[className]["Waterproofness"]; modClothing.Toughness = dict[className]["Toughness"]; modClothing.SprintBarReduction = dict[className]["SprintBarReduction"]; modClothing.DecreaseAttackChance = dict[className]["DecreaseAttackChance"]; modClothing.IncreaseFleeChance = dict[className]["IncreaseFleeChance"]; modClothing.HoursToDryNearFire = dict[className]["HoursToDryNearFire"]; modClothing.HoursToDryWithoutFire = dict[className]["HoursToDryWithoutFire"]; modClothing.HoursToFreeze = dict[className]["HoursToFreeze"]; modClothing.MainTexture = dict[className]["MainTexture"]; modClothing.BlendTexture = dict[className]["BlendTexture"]; modClothing.DrawLayer = dict[className]["DrawLayer"]; modClothing.ImplementationType = dict[className]["ImplementationType"]; }
private static void ConfigureClothing(ModComponent modComponent) { ModClothingComponent modClothingItem = modComponent as ModClothingComponent; if (modClothingItem == null) { return; } ClothingItem clothingItem = ModUtils.GetOrCreateComponent <ClothingItem>(modClothingItem); clothingItem.m_DailyHPDecayWhenWornInside = GetDecayPerStep(modClothingItem.DaysToDecayWornInside, modClothingItem.MaxHP); clothingItem.m_DailyHPDecayWhenWornOutside = GetDecayPerStep(modClothingItem.DaysToDecayWornOutside, modClothingItem.MaxHP); clothingItem.m_DryBonusWhenNotWorn = 1.5f; clothingItem.m_DryPercentPerHour = 100f / modClothingItem.HoursToDryNearFire; clothingItem.m_DryPercentPerHourNoFire = 100f / modClothingItem.HoursToDryWithoutFire; clothingItem.m_FreezePercentPerHour = 100f / modClothingItem.HoursToFreeze; clothingItem.m_Region = ModUtils.TranslateEnumValue <ClothingRegion, Region>(modClothingItem.Region); clothingItem.m_MaxLayer = ModUtils.TranslateEnumValue <ClothingLayer, Layer>(modClothingItem.MaxLayer); clothingItem.m_MinLayer = ModUtils.TranslateEnumValue <ClothingLayer, Layer>(modClothingItem.MinLayer); clothingItem.m_FootwearType = ModUtils.TranslateEnumValue <FootwearType, Footwear>(modClothingItem.Footwear); clothingItem.m_WornMovementSoundCategory = ModUtils.TranslateEnumValue <ClothingMovementSound, MovementSound>(modClothingItem.MovementSound); clothingItem.m_PaperDollTextureName = modClothingItem.MainTexture; clothingItem.m_PaperDollBlendmapName = modClothingItem.BlendTexture; clothingItem.m_Warmth = modClothingItem.Warmth; clothingItem.m_WarmthWhenWet = modClothingItem.WarmthWhenWet; clothingItem.m_Waterproofness = modClothingItem.Waterproofness / 100f; clothingItem.m_Windproof = modClothingItem.Windproof; clothingItem.m_SprintBarReductionPercent = modClothingItem.SprintBarReduction; clothingItem.m_Toughness = modClothingItem.Toughness; }
internal static void Postfix(GearItem gi) { ModClothingComponent modClothingComponent = ModUtils.GetComponent <ModClothingComponent>(gi); modClothingComponent?.OnPutOn?.Invoke(); Implementation.UpdateWolfIntimidationBuff(); }
private static void ConfigureWolfIntimidation(ModClothingComponent modClothingItem) { if (modClothingItem.DecreaseAttackChance == 0 && modClothingItem.IncreaseFleeChance == 0) { return; } WolfIntimidationBuff wolfIntimidationBuff = ModComponentUtils.ComponentUtils.GetOrCreateComponent <WolfIntimidationBuff>(modClothingItem); wolfIntimidationBuff.m_DecreaseAttackChancePercentagePoints = modClothingItem.DecreaseAttackChance; wolfIntimidationBuff.m_IncreaseFleePercentagePoints = modClothingItem.IncreaseFleeChance; }
public static bool Prefix(ClothingSlot __instance) { ModClothingComponent clothingComponent = ModUtils.GetComponent <ModClothingComponent>(__instance.m_GearItem); if (clothingComponent == null) { return(true); } int actualDrawLayer = Mathf.Max(40, clothingComponent.DrawLayer); ModUtils.ExecuteMethod(__instance, "UpdatePaperDollTextureLayer", actualDrawLayer); return(false); }
private static bool Prefix(ClothingSlot __instance) { ModClothingComponent clothingComponent = ModComponentUtils.ComponentUtils.GetComponent <ModClothingComponent>(__instance.m_GearItem); if (clothingComponent is null) { if (__instance.m_GearItem != null) { int defaultDrawLayer = DefaultDrawLayers.GetDefaultDrawLayer(__instance.m_ClothingRegion, __instance.m_ClothingLayer); __instance.UpdatePaperDollTextureLayer(defaultDrawLayer); } return(true); } int actualDrawLayer = clothingComponent.DrawLayer; __instance.UpdatePaperDollTextureLayer(actualDrawLayer); //Logger.Log("Set the draw layer for '{0}' to {1}", __instance.m_GearItem.name, actualDrawLayer); return(false); }
internal static void Postfix(GearItem gi) { ModClothingComponent modClothingComponent = ModUtils.GetComponent <ModClothingComponent>(gi); modClothingComponent?.OnTakeOff?.Invoke(); }
public static void InitializeComponents(ref GameObject prefab, ProxyObject dict) { if (ComponentUtils.GetModComponent(prefab) != null || dict is null) { return; } #region Mod Components if (JsonUtils.ContainsKey(dict, "ModBedComponent")) { ModBedComponent newComponent = ComponentUtils.GetOrCreateComponent <ModBedComponent>(prefab); InitializeBedComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModBodyHarvestComponent")) { ModBodyHarvestComponent newComponent = ComponentUtils.GetOrCreateComponent <ModBodyHarvestComponent>(prefab); InitializeBodyHarvestComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModCharcoalComponent")) { ModCharcoalComponent newComponent = ComponentUtils.GetOrCreateComponent <ModCharcoalComponent>(prefab); InitializeCharcoalComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModClothingComponent")) { ModClothingComponent newComponent = ComponentUtils.GetOrCreateComponent <ModClothingComponent>(prefab); InitializeClothingComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModCollectibleComponent")) { ModCollectibleComponent newComponent = ComponentUtils.GetOrCreateComponent <ModCollectibleComponent>(prefab); InitializeCollectibleComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModCookableComponent")) { ModCookableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModCookableComponent>(prefab); InitializeCookableComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModCookingPotComponent")) { ModCookingPotComponent newComponent = ComponentUtils.GetOrCreateComponent <ModCookingPotComponent>(prefab); InitializeCookingPotComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModExplosiveComponent")) { ModExplosiveComponent newComponent = ComponentUtils.GetOrCreateComponent <ModExplosiveComponent>(prefab); InitializeExplosiveComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModFirstAidComponent")) { ModFirstAidComponent newComponent = ComponentUtils.GetOrCreateComponent <ModFirstAidComponent>(prefab); InitializeFirstAidComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModFoodComponent")) { ModFoodComponent newComponent = ComponentUtils.GetOrCreateComponent <ModFoodComponent>(prefab); InitializeFoodComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModGenericComponent")) { ModGenericComponent newComponent = ComponentUtils.GetOrCreateComponent <ModGenericComponent>(prefab); InitializeGenericComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModGenericEquippableComponent")) { ModGenericEquippableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModGenericEquippableComponent>(prefab); InitializeGenericEquippableComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModLiquidComponent")) { ModLiquidComponent newComponent = ComponentUtils.GetOrCreateComponent <ModLiquidComponent>(prefab); InitializeLiquidComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModPowderComponent")) { ModPowderComponent newComponent = ComponentUtils.GetOrCreateComponent <ModPowderComponent>(prefab); InitializePowderComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModPurificationComponent")) { ModPurificationComponent newComponent = ComponentUtils.GetOrCreateComponent <ModPurificationComponent>(prefab); InitializePurificationComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModRandomItemComponent")) { ModRandomItemComponent newComponent = ComponentUtils.GetOrCreateComponent <ModRandomItemComponent>(prefab); InitializeRandomItemComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModRandomWeightedItemComponent")) { ModRandomWeightedItemComponent newComponent = ComponentUtils.GetOrCreateComponent <ModRandomWeightedItemComponent>(prefab); InitializeRandomWeightedItemComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModResearchComponent")) { ModResearchComponent newComponent = ComponentUtils.GetOrCreateComponent <ModResearchComponent>(prefab); InitializeResearchComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModRifleComponent")) { ModRifleComponent newComponent = ComponentUtils.GetOrCreateComponent <ModRifleComponent>(prefab); InitializeRifleComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModToolComponent")) { ModToolComponent newComponent = ComponentUtils.GetOrCreateComponent <ModToolComponent>(prefab); InitializeToolComponent(newComponent, dict); } #endregion #region Behaviour Components if (JsonUtils.ContainsKey(dict, "ModAccelerantComponent")) { ModAccelerantComponent newComponent = ComponentUtils.GetOrCreateComponent <ModAccelerantComponent>(prefab); InitializeAccelerantComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModBurnableComponent")) { ModBurnableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModBurnableComponent>(prefab); InitializeBurnableComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModFireStarterComponent")) { ModFireStarterComponent newComponent = ComponentUtils.GetOrCreateComponent <ModFireStarterComponent>(prefab); InitializeFireStarterComponent(newComponent, dict); } else if (JsonUtils.ContainsKey(dict, "ModTinderComponent")) { ModTinderComponent newComponent = ComponentUtils.GetOrCreateComponent <ModTinderComponent>(prefab); InitializeTinderComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModCarryingCapacityComponent")) { ModCarryingCapacityComponent newComponent = ComponentUtils.GetOrCreateComponent <ModCarryingCapacityComponent>(prefab); InitializeCarryingCapacityComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModEvolveComponent")) { ModEvolveComponent newComponent = ComponentUtils.GetOrCreateComponent <ModEvolveComponent>(prefab); InitializeEvolveComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModHarvestableComponent")) { ModHarvestableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModHarvestableComponent>(prefab); InitializeHarvestableComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModMillableComponent")) { ModMillableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModMillableComponent>(prefab); InitializeMillableComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModRepairableComponent")) { ModRepairableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModRepairableComponent>(prefab); InitializeRepairableComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModScentComponent")) { ModScentComponent newComponent = ComponentUtils.GetOrCreateComponent <ModScentComponent>(prefab); InitializeScentComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModSharpenableComponent")) { ModSharpenableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModSharpenableComponent>(prefab); InitializeSharpenableComponent(newComponent, dict); } if (JsonUtils.ContainsKey(dict, "ModStackableComponent")) { ModStackableComponent newComponent = ComponentUtils.GetOrCreateComponent <ModStackableComponent>(prefab); InitializeStackableComponent(newComponent, dict); } #endregion #region Modifications if (JsonUtils.ContainsKey(dict, "ChangeLayer")) { ChangeLayer newComponent = ComponentUtils.GetOrCreateComponent <ChangeLayer>(prefab); InitializeChangeLayer(newComponent, dict); } #endregion }