Пример #1
0
        private static void InitializeBodyHarvestComponent(ModBodyHarvestComponent modBodyHarvest, ProxyObject dict, string className = "ModBodyHarvestComponent")
        {
            InitializeBaseComponent(modBodyHarvest, dict, className);
            modBodyHarvest.CanCarry     = dict[className]["CanCarry"];
            modBodyHarvest.HarvestAudio = dict[className]["HarvestAudio"];

            modBodyHarvest.GutPrefab          = dict[className]["GutPrefab"];
            modBodyHarvest.GutQuantity        = dict[className]["GutQuantity"];
            modBodyHarvest.GutWeightKgPerUnit = dict[className]["GutWeightKgPerUnit"];

            modBodyHarvest.HidePrefab          = dict[className]["HidePrefab"];
            modBodyHarvest.HideQuantity        = dict[className]["HideQuantity"];
            modBodyHarvest.HideWeightKgPerUnit = dict[className]["HideWeightKgPerUnit"];

            modBodyHarvest.MeatPrefab         = dict[className]["MeatPrefab"];
            modBodyHarvest.MeatAvailableMinKG = dict[className]["MeatAvailableMinKG"];
            modBodyHarvest.MeatAvailableMaxKG = dict[className]["MeatAvailableMaxKG"];

            modBodyHarvest.CanQuarter                = false;
            modBodyHarvest.QuarterAudio              = "";
            modBodyHarvest.QuarterBagMeatCapacityKG  = 0f;
            modBodyHarvest.QuarterBagWasteMultiplier = 0f;
            modBodyHarvest.QuarterDurationMinutes    = 1f;
            modBodyHarvest.QuarterObjectPrefab       = "";
            modBodyHarvest.QuarterPrefabSpawnAngle   = 0f;
            modBodyHarvest.QuarterPrefabSpawnRadius  = 1f;
        }
Пример #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;
        }
Пример #3
0
        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
        }