Esempio n. 1
0
        internal static void Configure(ModComponent modComponent)
        {
            ModRifleComponent modRifleComponent = modComponent?.TryCast <ModRifleComponent>();

            if (modRifleComponent is null)
            {
                return;
            }

            GunItem gunItem = ModComponentUtils.ComponentUtils.GetOrCreateComponent <GunItem>(modRifleComponent);

            gunItem.m_GunType        = GunType.Rifle;
            gunItem.m_AmmoPrefab     = Resources.Load("GEAR_RifleAmmoSingle")?.TryCast <GameObject>();
            gunItem.m_AmmoSpriteName = "ico_units_ammo";

            gunItem.m_AccuracyRange          = modRifleComponent.Range;
            gunItem.m_ClipSize               = modRifleComponent.ClipSize;
            gunItem.m_DamageHP               = modRifleComponent.DamagePerShot;
            gunItem.m_FiringRateSeconds      = modRifleComponent.FiringDelay;
            gunItem.m_MuzzleFlash_FlashDelay = modRifleComponent.MuzzleFlashDelay;
            gunItem.m_MuzzleFlash_SmokeDelay = modRifleComponent.MuzzleSmokeDelay;
            gunItem.m_ReloadCoolDownSeconds  = modRifleComponent.ReloadDelay;

            gunItem.m_DryFireAudio = "Play_RifleDryFire";
            gunItem.m_ImpactAudio  = "Play_BulletImpacts";

            gunItem.m_SwayIncreasePerSecond = modRifleComponent.SwayIncrement;
            gunItem.m_SwayValueZeroFatigue  = modRifleComponent.MinSway;
            gunItem.m_SwayValueMaxFatigue   = modRifleComponent.MaxSway;

            Cleanable cleanable = ModComponentUtils.ComponentUtils.GetOrCreateComponent <Cleanable>(modRifleComponent);

            cleanable.m_ConditionIncreaseMin = 2;
            cleanable.m_ConditionIncreaseMin = 5;
            cleanable.m_DurationMinutesMin   = 15;
            cleanable.m_DurationMinutesMax   = 5;
            cleanable.m_CleanAudio           = "Play_RifleCleaning";
            cleanable.m_RequiresToolToClean  = true;
            cleanable.m_CleanToolChoices     = new ToolsItem[] { Resources.Load <GameObject>("GEAR_RifleCleaningKit").GetComponent <ToolsItem>() };

            FirstPersonItem firstPersonItem = ConfiguredRifleFirstPersonItem(modRifleComponent);

            ModAnimationStateMachine animation = ModComponentUtils.ComponentUtils.GetOrCreateComponent <ModAnimationStateMachine>(modRifleComponent);

            animation.SetTransitions(firstPersonItem.m_PlayerStateTransitions);
        }
Esempio n. 2
0
        internal static void Configure(ModComponent modComponent)
        {
            ModBodyHarvestComponent modBodyHarvestComponent = modComponent.TryCast <ModBodyHarvestComponent>();

            if (modBodyHarvestComponent is null)
            {
                return;
            }

            BodyHarvest bodyHarvest = ModComponentUtils.ComponentUtils.GetOrCreateComponent <BodyHarvest>(modBodyHarvestComponent);

            bodyHarvest.m_AllowDecay                = false;
            bodyHarvest.m_CanCarry                  = modBodyHarvestComponent.CanCarry;
            bodyHarvest.m_CanQuarter                = modBodyHarvestComponent.CanQuarter;
            bodyHarvest.m_DamageSide                = BaseAi.DamageSide.DamageSideNone;
            bodyHarvest.m_GutAvailableUnits         = modBodyHarvestComponent.GutQuantity;
            bodyHarvest.m_GutPrefab                 = Resources.Load(modBodyHarvestComponent.GutPrefab)?.Cast <GameObject>();
            bodyHarvest.m_GutWeightKgPerUnit        = modBodyHarvestComponent.GutWeightKgPerUnit;
            bodyHarvest.m_HarvestAudio              = modBodyHarvestComponent.HarvestAudio;
            bodyHarvest.m_HideAvailableUnits        = modBodyHarvestComponent.HideQuantity;
            bodyHarvest.m_HidePrefab                = Resources.Load(modBodyHarvestComponent.HidePrefab)?.Cast <GameObject>();
            bodyHarvest.m_HideWeightKgPerUnit       = modBodyHarvestComponent.HideWeightKgPerUnit;
            bodyHarvest.m_IsBigCarry                = false;
            bodyHarvest.m_LocalizedDisplayName      = ModComponentUtils.NameUtils.CreateLocalizedString(modBodyHarvestComponent.DisplayNameLocalizationId);
            bodyHarvest.m_MeatAvailableMaxKG        = modBodyHarvestComponent.MeatAvailableMaxKG;
            bodyHarvest.m_MeatAvailableMinKG        = modBodyHarvestComponent.MeatAvailableMinKG;
            bodyHarvest.m_MeatPrefab                = Resources.Load(modBodyHarvestComponent.MeatPrefab)?.Cast <GameObject>();
            bodyHarvest.m_PercentFrozen             = 0f;
            bodyHarvest.m_QuarterAudio              = modBodyHarvestComponent.QuarterAudio;
            bodyHarvest.m_QuarterBagMeatCapacityKG  = modBodyHarvestComponent.QuarterBagMeatCapacityKG;
            bodyHarvest.m_QuarterBagWasteMultiplier = modBodyHarvestComponent.QuarterBagWasteMultiplier;
            bodyHarvest.m_QuarterDurationMinutes    = modBodyHarvestComponent.QuarterDurationMinutes;
            bodyHarvest.m_QuarterObjectPrefab       = Resources.Load(modBodyHarvestComponent.QuarterObjectPrefab)?.Cast <GameObject>();
            bodyHarvest.m_QuarterPrefabSpawnAngle   = modBodyHarvestComponent.QuarterPrefabSpawnAngle;
            bodyHarvest.m_QuarterPrefabSpawnRadius  = modBodyHarvestComponent.QuarterPrefabSpawnRadius;
            bodyHarvest.m_Ravaged           = false;
            bodyHarvest.m_StartFrozen       = false;
            bodyHarvest.m_StartRavaged      = false;
            bodyHarvest.m_StartConditionMax = 100f;
            bodyHarvest.m_StartConditionMin = 95f;
        }
Esempio n. 3
0
        internal static void Configure(ModComponent modComponent)
        {
            ModCollectibleComponent modCollectible = modComponent.TryCast <ModCollectibleComponent>();

            if (modCollectible is null)
            {
                return;
            }

            NarrativeCollectibleItem narrativeCollectible = ModComponentUtils.ComponentUtils.GetOrCreateComponent <NarrativeCollectibleItem>(modCollectible);

            narrativeCollectible.m_HudMessageOnPickup = new LocalizedString()
            {
                m_LocalizationID = modCollectible.HudMessageLocalizationId
            };
            narrativeCollectible.m_JournalEntryNumber = 0;
            narrativeCollectible.m_NarrativeTextLocID = modCollectible.NarrativeTextLocalizationId;
            narrativeCollectible.m_ShowDuringInspect  = true;
            narrativeCollectible.m_TextAlignment      = ModComponentUtils.EnumUtils.TranslateEnumValue <NGUIText.Alignment, ModCollectibleComponent.Alignment>(modCollectible.TextAlignment);
            narrativeCollectible.m_Type = NarrativeCollectibleItem.CollectibleType.Note;
        }
Esempio n. 4
0
        internal static void Configure(ModComponent modComponent)
        {
            ModFirstAidComponent modFirstAidComponent = modComponent.TryCast <ModFirstAidComponent>();

            if (modFirstAidComponent is null)
            {
                return;
            }

            FirstAidItem firstAidItem = ModComponentUtils.ComponentUtils.GetOrCreateComponent <FirstAidItem>(modFirstAidComponent);

            // not used
            firstAidItem.m_AppliesSutures    = false;
            firstAidItem.m_StabalizesSprains = false;

            switch (modFirstAidComponent.FirstAidType)
            {
            case FirstAidType.Antibiotics:
                firstAidItem.m_ProvidesAntibiotics = true;
                break;

            case FirstAidType.Bandage:
                firstAidItem.m_AppliesBandage = true;
                break;

            case FirstAidType.Disinfectant:
                firstAidItem.m_CleansWounds = true;
                break;

            case FirstAidType.PainKiller:
                firstAidItem.m_KillsPain = true;
                break;
            }

            firstAidItem.m_HPIncrease       = modFirstAidComponent.InstantHealing;
            firstAidItem.m_TimeToUseSeconds = modFirstAidComponent.TimeToUseSeconds;
            firstAidItem.m_UnitsPerUse      = modFirstAidComponent.UnitsPerUse;
            firstAidItem.m_UseAudio         = modFirstAidComponent.UseAudio;
        }
Esempio n. 5
0
        internal static void Configure(ModComponent modComponent)
        {
            ModBedComponent modBedComponent = modComponent.TryCast <ModBedComponent>();

            if (modBedComponent is null)
            {
                return;
            }

            Bed bed = ModComponentUtils.ComponentUtils.GetOrCreateComponent <Bed>(modBedComponent);

            bed.m_LocalizedDisplayName               = ModComponentUtils.NameUtils.CreateLocalizedString(modComponent.DisplayNameLocalizationId);
            bed.m_ConditionPercentGainPerHour        = modBedComponent.ConditionGainPerHour;
            bed.m_UinterruptedRestPercentGainPerHour = modBedComponent.AdditionalConditionGainPerHour;
            bed.m_WarmthBonusCelsius = modBedComponent.WarmthBonusCelsius;

            bed.m_PercentChanceReduceBearAttackWhenSleeping = modBedComponent.BearAttackModifier;
            bed.m_PercentChanceReduceWolfAttackWhenSleeping = modBedComponent.WolfAttackModifier;

            bed.m_OpenAudio  = ModComponentUtils.ModUtils.DefaultIfEmpty(modBedComponent.OpenAudio, "PLAY_SNDGENSLEEPINGBAGCLOSE");
            bed.m_CloseAudio = ModComponentUtils.ModUtils.DefaultIfEmpty(modBedComponent.CloseAudio, "PLAY_SNDGENSLEEPINGBAGOPEN");

            bed.m_BedRollMesh             = modBedComponent.PackedMesh ?? modBedComponent.gameObject;
            bed.m_BedRollMesh.layer       = vp_Layer.Gear;
            bed.m_BedRollPlacedMesh       = modBedComponent.UsableMesh ?? modBedComponent.gameObject;
            bed.m_BedRollPlacedMesh.layer = vp_Layer.Gear;
            bed.SetState(BedRollState.Rolled);

            DegradeOnUse degradeOnUse = ModComponentUtils.ComponentUtils.GetOrCreateComponent <DegradeOnUse>(modBedComponent);

            degradeOnUse.m_DegradeHP = Mathf.Max(degradeOnUse.m_DegradeHP, modBedComponent.DegradePerHour);

            //PlaceableItem placeableItem = ModComponentUtils.ComponentUtils.GetOrCreateComponent<PlaceableItem>(modBedComponent);
            ModComponentUtils.ComponentUtils.GetOrCreateComponent <PlaceableItem>(modBedComponent);
            //placeableItem.m_Range = 4;
            //m_prefab_name ???
        }
Esempio n. 6
0
        internal static void Configure(ModComponent modComponent)
        {
            ModClothingComponent modClothingItem = modComponent.TryCast <ModClothingComponent>();

            if (modClothingItem is null)
            {
                return;
            }

            ClothingItem clothingItem = ModComponentUtils.ComponentUtils.GetOrCreateComponent <ClothingItem>(modClothingItem);

            clothingItem.m_DailyHPDecayWhenWornInside  = Mapper.GetDecayPerStep(modClothingItem.DaysToDecayWornInside, modClothingItem.MaxHP);
            clothingItem.m_DailyHPDecayWhenWornOutside = Mapper.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       = ModComponentUtils.EnumUtils.TranslateEnumValue <ClothingRegion, Region>(modClothingItem.Region);
            clothingItem.m_MaxLayer     = ModComponentUtils.EnumUtils.TranslateEnumValue <ClothingLayer, Layer>(modClothingItem.MaxLayer);
            clothingItem.m_MinLayer     = ModComponentUtils.EnumUtils.TranslateEnumValue <ClothingLayer, Layer>(modClothingItem.MinLayer);
            clothingItem.m_FootwearType = ModComponentUtils.EnumUtils.TranslateEnumValue <FootwearType, Footwear>(modClothingItem.Footwear);
            clothingItem.m_WornMovementSoundCategory = ModComponentUtils.EnumUtils.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;

            ConfigureWolfIntimidation(modClothingItem);
        }
Esempio n. 7
0
        internal static void Configure(ModComponent modComponent)
        {
            ModFoodComponent modFoodComponent = modComponent.TryCast <ModFoodComponent>();

            if (modFoodComponent is null)
            {
                return;
            }

            FoodItem foodItem = ModComponentUtils.ComponentUtils.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_ChanceFoodPoisoningRuined       = Mathf.Clamp01(modFoodComponent.FoodPoisoningLowCondition / 100f);
            foodItem.m_DailyHPDecayInside  = Mapper.GetDecayPerStep(modFoodComponent.DaysToDecayIndoors, modFoodComponent.MaxHP);
            foodItem.m_DailyHPDecayOutside = Mapper.GetDecayPerStep(modFoodComponent.DaysToDecayOutdoors, modFoodComponent.MaxHP);

            foodItem.m_TimeToEatSeconds        = Mathf.Clamp(1, modFoodComponent.EatingTime, 10);
            foodItem.m_TimeToOpenAndEatSeconds = Mathf.Clamp(1, modFoodComponent.EatingTime, 10) + 5;
            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_MustConsumeAll = false;
            foodItem.m_ParasiteRiskPercentIncrease = ModComponentUtils.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 = ModComponentUtils.ComponentUtils.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 = ModComponentUtils.ComponentUtils.GetOrCreateComponent <FatigueBuff>(modFoodComponent);
                fatigueBuff.m_InitialPercentDecrease = modFoodComponent.InstantRestChange;
                fatigueBuff.m_RateOfIncreaseScale    = modFoodComponent.RestFactor;
                fatigueBuff.m_DurationHours          = modFoodComponent.RestFactorMinutes / 60f;
            }

            if (modFoodComponent.AffectCold)
            {
                FreezingBuff freezingBuff = ModComponentUtils.ComponentUtils.GetOrCreateComponent <FreezingBuff>(modFoodComponent);
                freezingBuff.m_InitialPercentDecrease = modFoodComponent.InstantColdChange;
                freezingBuff.m_RateOfIncreaseScale    = modFoodComponent.ColdFactor;
                freezingBuff.m_DurationHours          = modFoodComponent.ColdFactorMinutes / 60f;
            }

            if (modFoodComponent.AffectCondition)
            {
                ConditionRestBuff conditionRestBuff = ModComponentUtils.ComponentUtils.GetOrCreateComponent <ConditionRestBuff>(modFoodComponent);
                conditionRestBuff.m_ConditionRestBonus   = modFoodComponent.ConditionRestBonus;
                conditionRestBuff.m_NumHoursRestAffected = modFoodComponent.ConditionRestMinutes / 60f;
            }

            if (modFoodComponent.ContainsAlcohol)
            {
                AlcoholComponent alcohol = ModComponentUtils.ComponentUtils.GetOrCreateComponent <AlcoholComponent>(modFoodComponent);
                alcohol.AmountTotal     = modFoodComponent.WeightKG * modFoodComponent.AlcoholPercentage * 0.01f;
                alcohol.AmountRemaining = alcohol.AmountTotal;
                alcohol.UptakeSeconds   = modFoodComponent.AlcoholUptakeMinutes * 60;
            }

            HoverIconsToShow hoverIconsToShow = ModComponentUtils.ComponentUtils.GetOrCreateComponent <HoverIconsToShow>(modFoodComponent);

            hoverIconsToShow.m_HoverIcons = new HoverIconsToShow.HoverIcons[] { HoverIconsToShow.HoverIcons.Food };
        }