Пример #1
0
    public GameObject CreatePrefab()
    {
        string         id          = "BeanPlant";
        string         name        = STRINGS.CREATURES.SPECIES.BEAN_PLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.BEAN_PLANT.DESC;
        float          mass        = 2f;
        KAnimFile      anim        = Assets.GetAnim("beanplant_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 258.15f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 198.15f, 248.15f, 273.15f, 323.15f, null, true, 0f, 0.15f, "BeanPlantSeed", true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Ethanol.CreateTag(),
                massConsumptionRate = 0.0333333351f
            }
        });
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Dirt.CreateTag(),
                massConsumptionRate = 0.008333334f
            }
        });
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        mass = 0.025f;
        float pressureLethalLow = 0f;

        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        };
        pressureVulnerable2.Configure(mass, pressureLethalLow, 10f, 30f, safeAtmospheres);
        UprootedMonitor component = gameObject.GetComponent <UprootedMonitor>();

        component.monitorCell = new CellOffset(0, -1);
        gameObject.AddOrGet <StandardCropPlant>();
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "BeanPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BEAN_PLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BEAN_PLANT.DESC;
        anim        = Assets.GetAnim("seed_beanplant_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject gameObject2 = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 4, STRINGS.CREATURES.SPECIES.BEAN_PLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.RECTANGLE, 0.6f, 0.3f, null, string.Empty, false);

        EntityTemplates.ExtendEntityToFood(gameObject2, FOOD.FOOD_TYPES.BEAN);
        EntityTemplates.CreateAndRegisterPreviewForPlant(gameObject2, "BeanPlant_preview", Assets.GetAnim("beanplant_kanim"), "place", 1, 2);
        return(gameObject);
    }
Пример #2
0
        public GameObject CreatePrefab()
        {
            GameObject placedEntity = EntityTemplates.CreatePlacedEntity(ID, CREATURES.SPECIES.HEATBULB.NAME, CREATURES.SPECIES.HEATBULB.DESC, 1f,
                                                                         Assets.GetAnim("plantheatbulb_kanim"), "close", Grid.SceneLayer.BuildingFront, 1, 1, DECOR.BONUS.TIER3, defaultTemperature: 350f);

            EntityTemplates.ExtendEntityToBasicPlant(placedEntity, 258.15f, 288.15f, 363.15f, 373.15f, pressure_sensitive: false);

            Light2D light2D = placedEntity.AddOrGet <Light2D>();

            light2D.Color = new Color(1f, 1f, 0f);
            light2D.Lux   = 1800;
            light2D.Range = 5;
            placedEntity.AddOrGet <Fervine>();

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                EntityTemplates.CreateAndRegisterSeedForPlant(placedEntity, SeedProducer.ProductionType.Hidden, SEED_ID,
                                                              SeedName, SeedDesc, Assets.GetAnim("plantheatbulb_kanim"), "seedling_ground", 0, new List <Tag> {
                GameTags.DecorSeed
            },
                                                              SingleEntityReceptacle.ReceptacleDirection.Top, new Tag(), 6, "",
                                                              EntityTemplates.CollisionShape.CIRCLE, 0.33f, 0.33f, null, string.Empty), "Heatbulb_preview", Assets.GetAnim("plantheatbulb_kanim"), "close", 1, 1);

            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);

            return(placedEntity);
        }
Пример #3
0
        public GameObject CreatePrefab()
        {
            GameObject placedEntity = EntityTemplates.CreatePlacedEntity(ID, CREATURES.SPECIES.JUNGLEGASPLANT.NAME, CREATURES.SPECIES.JUNGLEGASPLANT.DESC, 1f,
                                                                         Assets.GetAnim("palmeratree_kanim"), "idle_loop", Grid.SceneLayer.BuildingFront, 2, 3, DECOR.BONUS.TIER2, defaultTemperature: 350f);

            EntityTemplates.ExtendEntityToBasicPlant(placedEntity, 258.15f, 323.15f, 363.15f, 373.15f, new SimHashes[1] {
                SimHashes.ChlorineGas
            }, true, 0.0f, 0.15f, PalmeraBerryConfig.ID);

            placedEntity.AddOrGet <PalmeraTree>();
            var consumer = placedEntity.AddOrGet <ElementConsumer>();

            consumer.elementToConsume = SimHashes.ChlorineGas;
            consumer.consumptionRate  = 0.001f;

            var emitter = placedEntity.AddOrGet <ElementEmitter>();

            emitter.outputElement = new ElementConverter.OutputElement(0.001f, SimHashes.Hydrogen, outputElementOffsety: 2f);
            emitter.maxPressure   = 1.8f;

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                EntityTemplates.CreateAndRegisterSeedForPlant(placedEntity, SeedProducer.ProductionType.Harvest, SEED_ID,
                                                              "Palmera Tree Seed", "The " + UI.FormatAsLink("Seed", "PLANTS") + " of a " + CREATURES.SPECIES.JUNGLEGASPLANT.NAME + ".",
                                                              Assets.GetAnim("seed_palmeratree_kanim"), "object", 0, new List <Tag> {
                Utils.CropSeed2TileWide
            },
                                                              SingleEntityReceptacle.ReceptacleDirection.Top, new Tag(), 6, CREATURES.SPECIES.JUNGLEGASPLANT.DOMESTICATEDDESC,
                                                              EntityTemplates.CollisionShape.CIRCLE, 0.33f, 0.33f, null, string.Empty), "PalmeraTree_preview", Assets.GetAnim("palmeratree_kanim"), "idle_wilt_loop", 2, 3);

            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);

            return(placedEntity);
        }
Пример #4
0
        public GameObject CreatePrefab()
        {
            var plantEntityTemplate = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: CREATURES.SPECIES.HEATBULB.NAME,
                desc: CREATURES.SPECIES.HEATBULB.DESC,
                width: 1,
                height: 1,
                mass: 1f,
                anim: Assets.GetAnim("plantheatbulb_kanim"),
                initialAnim: "close",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                decor: DECOR.BONUS.TIER3,
                defaultTemperature: 350f);

            EntityTemplates.ExtendEntityToBasicPlant(
                template: plantEntityTemplate,
                temperature_lethal_low: 258.15f,
                temperature_warning_low: 288.15f,
                temperature_warning_high: 363.15f,
                temperature_lethal_high: 373.15f,
                pressure_sensitive: false,
                can_tinker: false);

            var light2D = plantEntityTemplate.AddOrGet <Light2D>();

            light2D.Color = new Color(1f, 1f, 0f);
            light2D.Lux   = 1800;
            light2D.Range = 5;

            plantEntityTemplate.AddOrGet <Fervine>();

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: plantEntityTemplate,
                id: SeedId,
                name: SeedName,
                desc: SeedDesc,
                productionType: SeedProducer.ProductionType.Hidden,
                anim: Assets.GetAnim("plantheatbulb_kanim"),
                initialAnim: "seed_swamplily",
                numberOfSeeds: 0,
                additionalTags: new List <Tag> {
                GameTags.DecorSeed
            },
                sortOrder: 6,
                width: 0.33f,
                height: 0.33f);

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: "Heatbulb_preview",
                anim: Assets.GetAnim("plantheatbulb_kanim"),
                initialAnim: "close",
                width: 1,
                height: 1);

            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);

            return(plantEntityTemplate);
        }
Пример #5
0
    public GameObject CreatePrefab()
    {
        string         id          = "PrickleFlower";
        string         name        = STRINGS.CREATURES.SPECIES.PRICKLEFLOWER.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.PRICKLEFLOWER.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("bristleblossom_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template    = gameObject;

        mass = 218.15f;
        float temperature_warning_low  = 278.15f;
        float temperature_warning_high = 303.15f;
        float temperature_lethal_high  = 398.15f;

        SimHashes[] safe_elements = new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        };
        initialAnim = PrickleFruitConfig.ID;
        EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, safe_elements, true, 0f, 0.15f, initialAnim, true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Water,
                massConsumptionRate = 0.0333333351f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx         = Db.Get().Diseases.GetIndex(Db.Get().Diseases.PollenGerms.id);
        def.singleEmitQuantity = 1000000;
        IlluminationVulnerable illuminationVulnerable = gameObject.AddOrGet <IlluminationVulnerable>();

        illuminationVulnerable.SetPrefersDarkness(false);
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "PrickleFlowerSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.PRICKLEFLOWER.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.PRICKLEFLOWER.DESC;
        anim        = Assets.GetAnim("seed_bristleblossom_kanim");
        int        numberOfSeeds = 0;
        List <Tag> list          = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        id   = STRINGS.CREATURES.SPECIES.PRICKLEFLOWER.DOMESTICATEDDESC;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", numberOfSeeds, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, id, EntityTemplates.CollisionShape.CIRCLE, 0.25f, 0.25f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "PrickleFlower_preview", Assets.GetAnim("bristleblossom_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_grow", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
Пример #6
0
        public GameObject CreatePrefab()
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: Name,
                desc: Description,
                mass: 1f,
                anim: Assets.GetAnim(AnimName),
                initialAnim: "idle_loop",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                width: 1,
                height: 2,
                decor: DECOR.BONUS.TIER2,
                defaultTemperature: 320f);

            EntityTemplates.ExtendEntityToBasicPlant(
                template: placedEntity,
                temperature_lethal_low: 283.15f,
                temperature_warning_low: 294.25f,
                temperature_warning_high: 310.15f,
                temperature_lethal_high: 323.15f,
                safe_elements: new[] { SimHashes.CarbonDioxide, SimHashes.Oxygen, SimHashes.ContaminatedOxygen },
                crop_id: TremGrainConfig.Id);

            placedEntity.AddOrGet <TremWheat>();

            var consumer = placedEntity.AddOrGet <ElementConsumer>();

            consumer.elementToConsume = SimHashes.Water;
            consumer.consumptionRate  = 0.0233334f;

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: placedEntity,
                id: SeedId,
                name: UI.FormatAsLink(SeedName, Id),
                desc: SeedDescription,
                productionType: SeedProducer.ProductionType.Harvest,
                anim: Assets.GetAnim(AnimNameSeed),
                numberOfSeeds: 0,
                additionalTags: new List <Tag> {
                GameTags.CropSeed
            },
                sortOrder: 9,
                domesticatedDescription: "Coolboyoclock",
                width: 0.33f,
                height: 0.33f);

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: "TremWheat_preview",
                anim: Assets.GetAnim(AnimName),
                initialAnim: "place",
                width: 1,
                height: 1);

            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER1);

            return(placedEntity);
        }
Пример #7
0
        public GameObject CreatePrefab()
        {
            GameObject placedEntity = EntityTemplates.CreatePlacedEntity(ID, DisplayName, Description, 1
                                                                         , Assets.GetAnim("sea_lettuce_kanim"), "idle_empty", Grid.SceneLayer.BuildingBack, 1, 2, TUNING.DECOR.BONUS.TIER0, new EffectorValues(), SimHashes.Creature, null, 308.15f);
            GameObject template = placedEntity;
            float      temperature_lethal_low   = 263.15f; // -10C
            float      temperature_warning_low  = 258.15f; // -15C
            float      temperature_warning_high = 383.15f; // 110C
            float      temperature_lethal_high  = 388.15f; // 115C
            bool       pressure_sensitive       = false;

            SimHashes[] safe_elements = new SimHashes[4]
            {
                SimHashes.Water,
                SimHashes.DirtyWater,
                SimHashes.SaltWater,
                SimHashes.Brine
            };
            EntityTemplates.ExtendEntityToBasicPlant(template, temperature_lethal_low, temperature_warning_low, temperature_warning_high, temperature_lethal_high, safe_elements, pressure_sensitive, 0, 0.15f
                                                     , CropId, false
                                                     , true, true, true, 2400f);

            EntityTemplates.ExtendPlantToFertilizable(placedEntity, new PlantElementAbsorber.ConsumeInfo[1]
            {
                new PlantElementAbsorber.ConsumeInfo()
                {
                    tag = SimHashes.Dirt.CreateTag(),
                    massConsumptionRate = 0.0008333334f
                }
            });

            //var drownMonitor = placedEntity.GetComponent<DrowningMonitor>();
            //drownMonitor.canDrownToDeath = false;
            //drownMonitor.livesUnderWater = true;

            placedEntity.AddOrGet <StandardCropPlant>();
            placedEntity.AddOrGet <KAnimControllerBase>().randomiseLoopedOffset = true;
            placedEntity.AddOrGet <LoopingSounds>();
            EntityTemplates.CreateAndRegisterPreviewForPlant(
                EntityTemplates.CreateAndRegisterSeedForPlant(placedEntity, SeedProducer.ProductionType.Harvest
                                                              , ID + "Seed", DisplayName, Description
                                                              , Assets.GetAnim("seed_sealettuce_kanim"), "object", 0
                                                              , new List <Tag>()
            {
                TagManager.Create(nameof(SeedName))
            }
                                                              , SingleEntityReceptacle.ReceptacleDirection.Top, new Tag(), 1
                                                              , DomesticateDesc
                                                              , EntityTemplates.CollisionShape.CIRCLE, 0.25f, 0.25f, null, string.Empty, false)
                , ID + "_preview", Assets.GetAnim("sea_lettuce_kanim"), "place", 1, 2);

            var soundInst = SoundEventVolumeCache.instance;

            soundInst.AddVolume("sea_lettuce_kanim", "SeaLettuce_grow", TUNING.NOISE_POLLUTION.CREATURES.TIER3);
            soundInst.AddVolume("sea_lettuce_kanim", "SeaLettuce_harvest", TUNING.NOISE_POLLUTION.CREATURES.TIER3);

            return(placedEntity);
        }
Пример #8
0
    public GameObject CreatePrefab()
    {
        string         id             = "ForestTree";
        string         name           = STRINGS.CREATURES.SPECIES.WOOD_TREE.NAME;
        string         desc           = STRINGS.CREATURES.SPECIES.WOOD_TREE.DESC;
        float          mass           = 2f;
        KAnimFile      anim           = Assets.GetAnim("tree_kanim");
        string         initialAnim    = "idle_empty";
        EffectorValues tIER           = DECOR.BONUS.TIER1;
        List <Tag>     additionalTags = new List <Tag>();
        GameObject     gameObject     = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.Building, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, additionalTags, 298.15f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 258.15f, 288.15f, 313.15f, 448.15f, null, true, 0f, 0.15f, "WoodLog", true, true, true, false, 2400f);
        gameObject.AddOrGet <BuddingTrunk>();
        gameObject.UpdateComponentRequirement <Harvestable>(false);
        Tag tag = ElementLoader.FindElementByHash(SimHashes.DirtyWater).tag;

        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = tag,
                massConsumptionRate = 0.116666667f
            }
        });
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Dirt,
                massConsumptionRate = 0.0166666675f
            }
        });
        gameObject.AddComponent <StandardCropPlant>();
        UprootedMonitor component = gameObject.GetComponent <UprootedMonitor>();

        component.monitorCell = new CellOffset(0, -1);
        BuddingTrunk buddingTrunk = gameObject.AddOrGet <BuddingTrunk>();

        buddingTrunk.budPrefabID = "ForestTreeBranch";
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim    = "ForestTreeSeed";
        desc           = STRINGS.CREATURES.SPECIES.SEEDS.WOOD_TREE.NAME;
        name           = STRINGS.CREATURES.SPECIES.SEEDS.WOOD_TREE.DESC;
        anim           = Assets.GetAnim("seed_tree_kanim");
        additionalTags = new List <Tag>();
        additionalTags.Add(GameTags.CropSeed);
        additionalTags = additionalTags;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, additionalTags, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 4, STRINGS.CREATURES.SPECIES.WOOD_TREE.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.3f, 0.3f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "ForestTree_preview", Assets.GetAnim("tree_kanim"), "place", 3, 3);
        return(gameObject);
    }
Пример #9
0
    public GameObject CreatePrefab()
    {
        string         id          = "MushroomPlant";
        string         name        = STRINGS.CREATURES.SPECIES.MUSHROOMPLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.MUSHROOMPLANT.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("fungusplant_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template    = gameObject;

        mass = 228.15f;
        float temperature_warning_low  = 278.15f;
        float temperature_warning_high = 308.15f;
        float temperature_lethal_high  = 398.15f;

        SimHashes[] safe_elements = new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        };
        initialAnim = MushroomConfig.ID;
        EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, safe_elements, true, 0f, 0.15f, initialAnim, true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.SlimeMold,
                massConsumptionRate = 0.006666667f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        IlluminationVulnerable illuminationVulnerable = gameObject.AddOrGet <IlluminationVulnerable>();

        illuminationVulnerable.SetPrefersDarkness(true);
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "MushroomSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.MUSHROOMPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.MUSHROOMPLANT.DESC;
        anim        = Assets.GetAnim("seed_fungusplant_kanim");
        int        numberOfSeeds = 0;
        List <Tag> list          = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        id   = STRINGS.CREATURES.SPECIES.MUSHROOMPLANT.DOMESTICATEDDESC;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", numberOfSeeds, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, id, EntityTemplates.CollisionShape.CIRCLE, 0.33f, 0.33f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "MushroomPlant_preview", Assets.GetAnim("fungusplant_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
    public GameObject CreatePrefab()
    {
        string         id          = "ColdWheat";
        string         name        = STRINGS.CREATURES.SPECIES.COLDWHEAT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.COLDWHEAT.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("coldwheat_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, tIER, default(EffectorValues), SimHashes.Creature, null, 255f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 118.149994f, 218.15f, 278.15f, 358.15f, new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        }, true, 0f, 0.15f, "ColdWheatSeed", true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Dirt,
                massConsumptionRate = 0.008333334f
            }
        });
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Water,
                massConsumptionRate = 0.0333333351f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.DigOnly;
        initialAnim = "ColdWheatSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.COLDWHEAT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.COLDWHEAT.DESC;
        anim        = Assets.GetAnim("seed_coldwheat_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        id   = STRINGS.CREATURES.SPECIES.COLDWHEAT.DOMESTICATEDDESC;
        GameObject gameObject2 = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, id, EntityTemplates.CollisionShape.CIRCLE, 0.2f, 0.2f, null, string.Empty, true);

        EntityTemplates.ExtendEntityToFood(gameObject2, FOOD.FOOD_TYPES.COLD_WHEAT_SEED);
        EntityTemplates.CreateAndRegisterPreviewForPlant(gameObject2, "ColdWheat_preview", Assets.GetAnim("coldwheat_kanim"), "place", 1, 1);
        SoundEventVolumeCache.instance.AddVolume("coldwheat_kanim", "ColdWheat_grow", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("coldwheat_kanim", "ColdWheat_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
    public GameObject CreatePrefab()
    {
        string         iD          = ID;
        string         name        = STRINGS.CREATURES.SPECIES.BASICFABRICMATERIALPLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.BASICFABRICMATERIALPLANT.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("swampreed_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER0;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(iD, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingBack, 1, 3, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template    = gameObject;

        initialAnim = BasicFabricConfig.ID;
        SimHashes[] safe_elements = new SimHashes[5]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide,
            SimHashes.DirtyWater,
            SimHashes.Water
        };
        EntityTemplates.ExtendEntityToBasicPlant(template, 248.15f, 295.15f, 310.15f, 398.15f, safe_elements, false, 0f, 0.15f, initialAnim, false, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.DirtyWater,
                massConsumptionRate = 0.266666681f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        gameObject.AddOrGet <KAnimControllerBase>().randomiseLoopedOffset = true;
        gameObject.AddOrGet <LoopingSounds>();
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = SEED_ID;
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BASICFABRICMATERIALPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BASICFABRICMATERIALPLANT.DESC;
        anim        = Assets.GetAnim("seed_swampreed_kanim");
        int        numberOfSeeds = 0;
        List <Tag> list          = new List <Tag>();

        list.Add(GameTags.WaterSeed);
        list = list;
        iD   = STRINGS.CREATURES.SPECIES.BASICFABRICMATERIALPLANT.DOMESTICATEDDESC;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", numberOfSeeds, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 1, iD, EntityTemplates.CollisionShape.CIRCLE, 0.25f, 0.25f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, ID + "_preview", Assets.GetAnim("swampreed_kanim"), "place", 1, 3);
        SoundEventVolumeCache.instance.AddVolume("swampreed_kanim", "FabricPlant_grow", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("swampreed_kanim", "FabricPlant_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
Пример #12
0
    public GameObject CreatePrefab()
    {
        string         id          = "BasicSingleHarvestPlant";
        string         name        = STRINGS.CREATURES.SPECIES.BASICSINGLEHARVESTPLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.BASICSINGLEHARVESTPLANT.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("meallice_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.PENALTY.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingBack, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template    = gameObject;

        SimHashes[] safe_elements = new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        };
        EntityTemplates.ExtendEntityToBasicPlant(template, 218.15f, 283.15f, 303.15f, 398.15f, safe_elements, true, 0f, 0.15f, "BasicPlantFood", true, false, true, true, 2400f);
        gameObject.AddOrGet <StandardCropPlant>();
        gameObject.AddOrGet <KAnimControllerBase>().randomiseLoopedOffset = true;
        gameObject.AddOrGet <LoopingSounds>();
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "BasicSingleHarvestPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BASICSINGLEHARVESTPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BASICSINGLEHARVESTPLANT.DESC;
        anim        = Assets.GetAnim("seed_meallice_kanim");
        int        numberOfSeeds = 0;
        List <Tag> list          = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        id   = STRINGS.CREATURES.SPECIES.BASICSINGLEHARVESTPLANT.DOMESTICATEDDESC;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", numberOfSeeds, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 1, id, EntityTemplates.CollisionShape.CIRCLE, 0.3f, 0.3f, null, string.Empty, false);

        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Dirt,
                massConsumptionRate = 0.0166666675f
            }
        });
        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "BasicSingleHarvestPlant_preview", Assets.GetAnim("meallice_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("meallice_kanim", "MealLice_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("meallice_kanim", "MealLice_LP", NOISE_POLLUTION.CREATURES.TIER4);
        return(gameObject);
    }
Пример #13
0
    public GameObject CreatePrefab()
    {
        string         id          = "GasGrass";
        string         name        = STRINGS.CREATURES.SPECIES.GASGRASS.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.GASGRASS.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("gassygrass_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.BONUS.TIER3;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 3, tIER, default(EffectorValues), SimHashes.Creature, null, 255f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 218.15f, 0f, 348.15f, 373.15f, null, true, 0f, 0.15f, "GasGrassHarvested", true, true, true, true, 2400f);
        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Chlorine,
                massConsumptionRate = 0.000833333354f
            }
        });
        gameObject.AddOrGet <StandardCropPlant>();
        HarvestDesignatable harvestDesignatable = gameObject.AddOrGet <HarvestDesignatable>();

        harvestDesignatable.defaultHarvestStateWhenPlanted = false;
        CropSleepingMonitor.Def def = gameObject.AddOrGetDef <CropSleepingMonitor.Def>();
        def.lightIntensityThreshold = 20000f;
        def.prefersDarkness         = false;
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "GasGrassSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.GASGRASS.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.GASGRASS.DESC;
        anim        = Assets.GetAnim("seed_gassygrass_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, STRINGS.CREATURES.SPECIES.GASGRASS.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.2f, 0.2f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "GasGrass_preview", Assets.GetAnim("gassygrass_kanim"), "place", 1, 1);
        SoundEventVolumeCache.instance.AddVolume("gassygrass_kanim", "GasGrass_grow", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("gassygrass_kanim", "GasGrass_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
Пример #14
0
    public GameObject CreatePrefab()
    {
        string         id                    = "BulbPlant";
        string         name                  = STRINGS.CREATURES.SPECIES.BULBPLANT.NAME;
        string         desc                  = STRINGS.CREATURES.SPECIES.BULBPLANT.DESC;
        float          mass                  = 1f;
        KAnimFile      anim                  = Assets.GetAnim("potted_bulb_kanim");
        string         initialAnim           = "grow_seed";
        EffectorValues pOSITIVE_DECOR_EFFECT = POSITIVE_DECOR_EFFECT;
        GameObject     gameObject            = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, pOSITIVE_DECOR_EFFECT, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template              = gameObject;

        SimHashes[] safe_elements = new SimHashes[3]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide
        };
        EntityTemplates.ExtendEntityToBasicPlant(template, 288f, 293.15f, 313.15f, 333.15f, safe_elements, true, 0f, 0.15f, null, true, false, true, true, 2400f);
        PrickleGrass prickleGrass = gameObject.AddOrGet <PrickleGrass>();

        prickleGrass.positive_decor_effect = POSITIVE_DECOR_EFFECT;
        prickleGrass.negative_decor_effect = NEGATIVE_DECOR_EFFECT;
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "BulbPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.BULBPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.BULBPLANT.DESC;
        anim        = Assets.GetAnim("seed_potted_bulb_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.DecorSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 6, STRINGS.CREATURES.SPECIES.BULBPLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.4f, 0.4f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "BulbPlant_preview", Assets.GetAnim("potted_bulb_kanim"), "place", 1, 1);
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx           = Db.Get().Diseases.GetIndex(Db.Get().Diseases.PollenGerms.id);
        def.singleEmitQuantity   = 0;
        def.averageEmitPerSecond = 5000;
        def.emitFrequency        = 5f;
        return(gameObject);
    }
    public GameObject CreatePrefab()
    {
        string         id                    = "EvilFlower";
        string         name                  = STRINGS.CREATURES.SPECIES.EVILFLOWER.NAME;
        string         desc                  = STRINGS.CREATURES.SPECIES.EVILFLOWER.DESC;
        float          mass                  = 1f;
        KAnimFile      anim                  = Assets.GetAnim("potted_evilflower_kanim");
        string         initialAnim           = "grow_seed";
        EffectorValues pOSITIVE_DECOR_EFFECT = POSITIVE_DECOR_EFFECT;
        GameObject     gameObject            = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, pOSITIVE_DECOR_EFFECT, default(EffectorValues), SimHashes.Creature, null, 293f);

        EntityTemplates.ExtendEntityToBasicPlant(gameObject, 168.15f, 258.15f, 513.15f, 563.15f, new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        }, true, 0f, 0.15f, null, true, false, true, true, 2400f);
        EvilFlower evilFlower = gameObject.AddOrGet <EvilFlower>();

        evilFlower.positive_decor_effect = POSITIVE_DECOR_EFFECT;
        evilFlower.negative_decor_effect = NEGATIVE_DECOR_EFFECT;
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "EvilFlowerSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.EVILFLOWER.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.EVILFLOWER.DESC;
        anim        = Assets.GetAnim("seed_potted_evilflower_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.DecorSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 5, STRINGS.CREATURES.SPECIES.EVILFLOWER.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.4f, 0.4f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "EvilFlower_preview", Assets.GetAnim("potted_evilflower_kanim"), "place", 1, 1);
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        DiseaseDropper.Def def = gameObject.AddOrGetDef <DiseaseDropper.Def>();
        def.diseaseIdx           = Db.Get().Diseases.GetIndex("ZombieSpores");
        def.emitFrequency        = 1f;
        def.averageEmitPerSecond = 1000;
        def.singleEmitQuantity   = 100000;
        return(gameObject);
    }
    public GameObject CreatePrefab()
    {
        string         id                    = "LeafyPlant";
        string         name                  = STRINGS.CREATURES.SPECIES.LEAFYPLANT.NAME;
        string         desc                  = STRINGS.CREATURES.SPECIES.LEAFYPLANT.DESC;
        float          mass                  = 1f;
        KAnimFile      anim                  = Assets.GetAnim("potted_leafy_kanim");
        string         initialAnim           = "grow_seed";
        EffectorValues pOSITIVE_DECOR_EFFECT = POSITIVE_DECOR_EFFECT;
        GameObject     gameObject            = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 1, pOSITIVE_DECOR_EFFECT, default(EffectorValues), SimHashes.Creature, null, 293f);
        GameObject     template              = gameObject;

        SimHashes[] safe_elements = new SimHashes[5]
        {
            SimHashes.Oxygen,
            SimHashes.ContaminatedOxygen,
            SimHashes.CarbonDioxide,
            SimHashes.ChlorineGas,
            SimHashes.Hydrogen
        };
        EntityTemplates.ExtendEntityToBasicPlant(template, 288f, 293.15f, 323.15f, 373f, safe_elements, true, 0f, 0.15f, null, true, false, true, true, 2400f);
        PrickleGrass prickleGrass = gameObject.AddOrGet <PrickleGrass>();

        prickleGrass.positive_decor_effect = POSITIVE_DECOR_EFFECT;
        prickleGrass.negative_decor_effect = NEGATIVE_DECOR_EFFECT;
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "LeafyPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.LEAFYPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.LEAFYPLANT.DESC;
        anim        = Assets.GetAnim("seed_potted_leafy_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.DecorSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 7, STRINGS.CREATURES.SPECIES.LEAFYPLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.RECTANGLE, 0.8f, 0.6f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "LeafyPlant_preview", Assets.GetAnim("potted_leafy_kanim"), "place", 1, 1);
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        return(gameObject);
    }
Пример #17
0
        public GameObject CreatePrefab()
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: Name,
                desc: Description,
                mass: 1f,
                anim: Assets.GetAnim("cactusfruit_kanim"),
                initialAnim: "idle_empty",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                width: 1,
                height: 1,
                decor: TUNING.DECOR.BONUS.TIER1,
                defaultTemperature: DefaultTemperature
                );

            EntityTemplates.ExtendEntityToBasicPlant(
                template: placedEntity,
                temperature_lethal_low: TemperatureLethalLow,
                temperature_warning_low: TemperatureWarningLow,
                temperature_warning_high: TemperatureWarningHigh,
                temperature_lethal_high: TemperatureLethalHigh,
                safe_elements: new[] { SimHashes.Oxygen, SimHashes.CarbonDioxide },
                pressure_sensitive: true,
                pressure_lethal_low: 0.0f,
                pressure_warning_low: 0.15f,
                crop_id: CactusFleshConfig.Id);

            EntityTemplates.ExtendPlantToIrrigated(
                template: placedEntity,
                info: new PlantElementAbsorber.ConsumeInfo()
            {
                tag = GameTags.Water,
                massConsumptionRate = IrrigationRate
            });

            placedEntity.AddOrGet <StandardCropPlant>();

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: placedEntity,
                productionType: SeedProducer.ProductionType.Harvest,
                id: SeedId,
                name: SeedName,
                desc: SeedDescription,
                anim: Assets.GetAnim("cactusseed_kanim"),
                initialAnim: "object",
                numberOfSeeds: 1,
                additionalTags: new List <Tag>()
            {
                GameTags.CropSeed
            },
                planterDirection: SingleEntityReceptacle.ReceptacleDirection.Top,
                replantGroundTag: new Tag(),
                sortOrder: 2,
                domesticatedDescription: DomesticatedDescription,
                collisionShape: EntityTemplates.CollisionShape.CIRCLE,
                width: 0.2f,
                height: 0.2f);

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: $"{Id}_preview",
                anim: Assets.GetAnim("cactusfruit_kanim"),
                initialAnim: "place",
                width: 1,
                height: 1);

            return(placedEntity);
        }
Пример #18
0
        public GameObject CreatePrefab()
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: Name,
                desc: Description,
                mass: 1f,
                anim: Assets.GetAnim("palmeratree_kanim"),
                initialAnim: "idle_loop",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                width: 2,
                height: 3,
                decor: DECOR.BONUS.TIER2,
                defaultTemperature: 350f);

            EntityTemplates.ExtendEntityToBasicPlant(
                template: placedEntity,
                temperature_lethal_low: 258.15f,
                temperature_warning_low: 323.15f,
                temperature_warning_high: 363.15f,
                temperature_lethal_high: 373.15f,
                safe_elements: new[] { SimHashes.ChlorineGas },
                crop_id: PalmeraBerryConfig.Id);

            placedEntity.AddOrGet <PalmeraTree>();

            var consumer = placedEntity.AddOrGet <ElementConsumer>();

            consumer.elementToConsume = SimHashes.ChlorineGas;
            consumer.consumptionRate  = 0.001f;

            var emitter = placedEntity.AddOrGet <ElementEmitter>();

            emitter.outputElement = new ElementConverter.OutputElement(0.001f, SimHashes.Hydrogen, outputElementOffsety: 2f);
            emitter.maxPressure   = 1.8f;

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: placedEntity,
                id: SeedId,
                name: SeedName,
                desc: SeedDescription,
                productionType: SeedProducer.ProductionType.Harvest,
                anim: Assets.GetAnim("seed_palmeratree_kanim"),
                numberOfSeeds: 0,
                additionalTags: new List <Tag> {
                Utils.CropSeed2TileWide
            },
                sortOrder: 7,
                domesticatedDescription: CREATURES.SPECIES.JUNGLEGASPLANT.DOMESTICATEDDESC,
                width: 0.33f,
                height: 0.33f);

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: "PalmeraTree_preview",
                anim: Assets.GetAnim("palmeratree_kanim"),
                initialAnim: "clidle_wilt_loopose",
                width: 2,
                height: 3);

            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "PrickleFlower_harvest", NOISE_POLLUTION.CREATURES.TIER3);

            return(placedEntity);
        }
Пример #19
0
        public GameObject CreatePrefab()
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: Name,
                desc: Description,
                mass: 1f,
                anim: Assets.GetAnim("magmafern"),
                initialAnim: "idle_empty",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                width: 1,
                height: 1,
                decor: TUNING.DECOR.BONUS.TIER2,
                defaultTemperature: DefaultTemperature);

            EntityTemplates.ExtendEntityToBasicPlant(
                template: placedEntity,
                temperature_lethal_low: TemperatureLethalLow,
                temperature_warning_low: TemperatureWarningLow,
                temperature_warning_high: TemperatureWarningHigh,
                temperature_lethal_high: TemperatureLethalHigh,
                safe_elements: new[] { SimHashes.Magma },
                pressure_sensitive: false,
                crop_id: SeedId);

            EntityTemplates.ExtendPlantToFertilizable(
                template: placedEntity,
                fertilizers: new[]
            {
                new PlantElementAbsorber.ConsumeInfo()
                {
                    tag = ElementLoader.FindElementByHash(SimHashes.Obsidian).tag,
                    massConsumptionRate = FertilizationRate
                }
            })
            ;
            EntityTemplates.ExtendPlantToIrrigated(
                template: placedEntity,
                info: new PlantElementAbsorber.ConsumeInfo()
            {
                tag = ElementLoader.FindElementByHash(SimHashes.Magma).tag,
                massConsumptionRate = IrrigationRate
            });

            placedEntity.AddOrGet <StandardCropPlant>();

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: placedEntity,
                productionType: SeedProducer.ProductionType.DigOnly,
                id: SeedId,
                name: SeedName,
                desc: SeedDescription,
                anim: Assets.GetAnim("seed_magmafern"),
                initialAnim: "object",
                numberOfSeeds: 1,
                additionalTags: new List <Tag>()
            {
                GameTags.CropSeed
            },
                planterDirection: SingleEntityReceptacle.ReceptacleDirection.Top,
                replantGroundTag: new Tag(),
                sortOrder: 2,
                domesticatedDescription: DomesticatedDescription,
                collisionShape: EntityTemplates.CollisionShape.CIRCLE,
                width: 0.2f,
                height: 0.2f,
                ignoreDefaultSeedTag: true);

            var foodInfo = new EdiblesManager.FoodInfo(
                SeedId,
                caloriesPerUnit: 0.0f,
                quality: 0,
                preserveTemperatue: PreserveTemperature,
                rotTemperature: RotTemperature,
                spoilTime: TUNING.FOOD.SPOIL_TIME.SLOW,
                can_rot: true);

            EntityTemplates.ExtendEntityToFood(
                template: seed,
                foodInfo: foodInfo);

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: "MagmaFern_preview",
                anim: Assets.GetAnim("magmafern"),
                initialAnim: "place",
                width: 1,
                height: 1);

            SoundEventVolumeCache.instance.AddVolume("magmafern", "MagmaFern_grow", TUNING.NOISE_POLLUTION.CREATURES.TIER3);
            SoundEventVolumeCache.instance.AddVolume("magmafern", "MagmaFern_harvest", TUNING.NOISE_POLLUTION.CREATURES.TIER3);
            return(placedEntity);
        }
    public GameObject CreatePrefab()
    {
        GameObject gameObject = EntityTemplates.CreatePlacedEntity("ColdBreather", STRINGS.CREATURES.SPECIES.COLDBREATHER.NAME, STRINGS.CREATURES.SPECIES.COLDBREATHER.DESC, 400f, Assets.GetAnim("coldbreather_kanim"), "grow_seed", Grid.SceneLayer.BuildingFront, 1, 2, DECOR.BONUS.TIER1, NOISE_POLLUTION.NOISY.TIER2, SimHashes.Creature, null, 293f);

        gameObject.AddOrGet <ReceptacleMonitor>();
        gameObject.AddOrGet <EntombVulnerable>();
        gameObject.AddOrGet <WiltCondition>();
        gameObject.AddOrGet <Prioritizable>();
        gameObject.AddOrGet <Uprootable>();
        gameObject.AddOrGet <UprootedMonitor>();
        gameObject.AddOrGet <DrowningMonitor>();
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Phosphorite.CreateTag(),
                massConsumptionRate = 0.006666667f
            }
        });
        TemperatureVulnerable temperatureVulnerable = gameObject.AddOrGet <TemperatureVulnerable>();

        temperatureVulnerable.Configure(213.15f, 183.15f, 368.15f, 463.15f);
        gameObject.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1]
        {
            ObjectLayer.Building
        };
        ColdBreather coldBreather = gameObject.AddOrGet <ColdBreather>();

        coldBreather.deltaEmitTemperature = -5f;
        coldBreather.emitOffsetCell       = new Vector3(0f, 1f);
        coldBreather.consumptionRate      = 1f;
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        Storage storage = BuildingTemplates.CreateDefaultStorage(gameObject, false);

        storage.showInUI = false;
        ElementConsumer elementConsumer = gameObject.AddOrGet <ElementConsumer>();

        elementConsumer.storeOnConsume    = true;
        elementConsumer.configuration     = ElementConsumer.Configuration.AllGas;
        elementConsumer.capacityKG        = 2f;
        elementConsumer.consumptionRate   = 0.25f;
        elementConsumer.consumptionRadius = 1;
        elementConsumer.sampleCellOffset  = new Vector3(0f, 0f);
        SimTemperatureTransfer component = gameObject.GetComponent <SimTemperatureTransfer>();

        component.SurfaceArea = 10f;
        component.Thickness   = 0.001f;
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        string     id   = "ColdBreatherSeed";
        string     name = STRINGS.CREATURES.SPECIES.SEEDS.COLDBREATHER.NAME;
        string     desc = STRINGS.CREATURES.SPECIES.SEEDS.COLDBREATHER.DESC;
        KAnimFile  anim = Assets.GetAnim("seed_coldbreather_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, id, name, desc, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, STRINGS.CREATURES.SPECIES.COLDBREATHER.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.3f, 0.3f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "ColdBreather_preview", Assets.GetAnim("coldbreather_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("coldbreather_kanim", "ColdBreather_grow", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("coldbreather_kanim", "ColdBreather_intake", NOISE_POLLUTION.CREATURES.TIER3);
        return(gameObject);
    }
Пример #21
0
        public GameObject CreatePrefab()
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(ID, NAME, DESC, 1f, Assets.GetAnim("resonantplant_kanim"),
                                                                  "idle_empty", Grid.SceneLayer.BuildingFront, 1, 2, DECOR.NONE);

            EntityTemplates.ExtendEntityToBasicPlant(placedEntity, K,
                                                     MIN_GROW_TEMP,
                                                     MAX_GROW_TEMP,
                                                     MAX_GROW_TEMP + 80,
                                                     new [] { SimHashes.CarbonDioxide },
                                                     false,
                                                     0f,
                                                     0.15f,
                                                     SEED_ID);

            var pressureVulnerable = placedEntity.AddOrGet <PressureVulnerable>();

            pressureVulnerable.Configure((float)0.15f, (float)0f, 99000f, 99900f, new[]
            {
                SimHashes.CarbonDioxide
            });

            Storage storage = placedEntity.AddOrGet <Storage>();

            storage.showInUI   = false;
            storage.capacityKg = 2f;

            var elementConsumer = placedEntity.AddOrGet <ElementConsumer>();

            elementConsumer.showInStatusPanel = true;
            elementConsumer.showDescriptor    = true;
            elementConsumer.storeOnConsume    = false;
            elementConsumer.configuration     = ElementConsumer.Configuration.Element;
            elementConsumer.elementToConsume  = SimHashes.CarbonDioxide;
            elementConsumer.consumptionRadius = 4;
            elementConsumer.sampleCellOffset  = new Vector3(0.0f, 1f);
            elementConsumer.consumptionRate   = CO2_PER_SECOND;

            placedEntity.AddOrGet <StandardCropPlant>();
            placedEntity.AddOrGet <IlluminationVulnerable>().SetPrefersDarkness(false);
            EntityTemplates.CreateAndRegisterPreviewForPlant(
                EntityTemplates.CreateAndRegisterSeedForPlant(placedEntity,
                                                              SeedProducer.ProductionType.Harvest,
                                                              SEED_ID,
                                                              SEED_NAME,
                                                              SEED_DESC,
                                                              Assets.GetAnim((HashedString)"seed_resonantplant_kanim"),
                                                              "object", 0, new List <Tag>
            {
                GameTags.CropSeed
            }, SingleEntityReceptacle.ReceptacleDirection.Top, new Tag(), 2,
                                                              CREATURES.SPECIES.PRICKLEFLOWER.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.25f,
                                                              0.25f,
                                                              null, string.Empty
                                                              ),
                "Resonantplant_preview",
                Assets.GetAnim("resonantplant_kanim"),
                "place", 1, 2);
            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "resonantplant_harvest",
                                                     NOISE_POLLUTION.CREATURES.TIER3);
            SoundEventVolumeCache.instance.AddVolume("bristleblossom_kanim", "resonantplant_grow",
                                                     NOISE_POLLUTION.CREATURES.TIER3);
            placedEntity.AddOrGet <CoalPlant>();

            return(placedEntity);
        }
Пример #22
0
        public static GameObject CreateCrystalPlantPrefab(string Id, string SeedId, string Name, string SeedName,
                                                          string Description, string SeedDescription, string DomesticatedDescription, string anim, SingleEntityReceptacle.ReceptacleDirection direction)
        {
            var placedEntity = EntityTemplates.CreatePlacedEntity(
                id: Id,
                name: Name,
                desc: Description,
                mass: 1f,
                anim: Assets.GetAnim(anim),
                initialAnim: "idle_empty",
                sceneLayer: Grid.SceneLayer.BuildingFront,
                width: 1,
                height: 2,
                decor: TUNING.DECOR.BONUS.TIER2,
                defaultTemperature: DefaultTemperature);

            EntityTemplates.ExtendEntityToBasicPlant(
                template: placedEntity,
                temperature_lethal_low: TemperatureLethalLow,
                temperature_warning_low: TemperatureWarningLow,
                temperature_warning_high: TemperatureWarningHigh,
                temperature_lethal_high: TemperatureLethalHigh,
                safe_elements: new[] { SimHashes.Oxygen },
                pressure_sensitive: true,
                pressure_lethal_low: 0.0f,
                pressure_warning_low: 0.15f,
                crop_id: Elements.CrystalElement.Id);

            EntityTemplates.ExtendPlantToIrrigated(
                template: placedEntity,
                info: new PlantElementAbsorber.ConsumeInfo()
            {
                tag = ElementLoader.FindElementByHash(Elements.MineralWaterElement.SimHash).tag,
                massConsumptionRate = IrrigationRate
            });

            if (direction == SingleEntityReceptacle.ReceptacleDirection.Bottom)
            {
                EntityTemplates.MakeHangingOffsets(placedEntity, 1, 2);
                placedEntity.GetComponent <UprootedMonitor>().monitorCell = new CellOffset(0, 1);
            }

            placedEntity.AddOrGet <StandardCropPlant>();

            var seed = EntityTemplates.CreateAndRegisterSeedForPlant(
                plant: placedEntity,
                productionType: SeedProducer.ProductionType.DigOnly,
                id: SeedId,
                name: SeedName,
                desc: SeedDescription,
                anim: Assets.GetAnim(anim),
                initialAnim: "object",
                numberOfSeeds: 1,
                additionalTags: new List <Tag>()
            {
                GameTags.CropSeed
            },
                planterDirection: direction,
                replantGroundTag: new Tag(),
                sortOrder: 2,
                domesticatedDescription: DomesticatedDescription,
                collisionShape: EntityTemplates.CollisionShape.CIRCLE,
                width: 0.2f,
                height: 0.2f,
                ignoreDefaultSeedTag: true);;

            EntityTemplates.CreateAndRegisterPreviewForPlant(
                seed: seed,
                id: $"{Id}_preview",
                anim: Assets.GetAnim(anim),
                initialAnim: "place",
                width: 1,
                height: 1);

            SoundEventVolumeCache.instance.AddVolume(anim, $"{Id}_grow", TUNING.NOISE_POLLUTION.CREATURES.TIER3);
            SoundEventVolumeCache.instance.AddVolume(anim, $"{Id}_harvest", TUNING.NOISE_POLLUTION.CREATURES.TIER3);
            return(placedEntity);
        }
Пример #23
0
	public GameObject CreatePrefab()
	{
		string iD = ID;
		string name = STRINGS.CREATURES.SPECIES.SEALETTUCE.NAME;
		string desc = STRINGS.CREATURES.SPECIES.SEALETTUCE.DESC;
		float mass = 1f;
		KAnimFile anim = Assets.GetAnim("sea_lettuce_kanim");
		string initialAnim = "idle_empty";
		EffectorValues tIER = DECOR.BONUS.TIER0;
		GameObject gameObject = EntityTemplates.CreatePlacedEntity(iD, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingBack, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 308.15f);
		GameObject template = gameObject;
		mass = 248.15f;
		float temperature_warning_low = 295.15f;
		float temperature_warning_high = 338.15f;
		float temperature_lethal_high = 398.15f;
		bool pressure_sensitive = false;
		SimHashes[] safe_elements = new SimHashes[3]
		{
			SimHashes.Water,
			SimHashes.SaltWater,
			SimHashes.Brine
		};
		EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, safe_elements, pressure_sensitive, 0f, 0.15f, "Lettuce", true, true, true, true, 2400f);
		EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
		{
			new PlantElementAbsorber.ConsumeInfo
			{
				tag = SimHashes.SaltWater.CreateTag(),
				massConsumptionRate = 0.008333334f
			}
		});
		EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
		{
			new PlantElementAbsorber.ConsumeInfo
			{
				tag = SimHashes.BleachStone.CreateTag(),
				massConsumptionRate = 0.000833333354f
			}
		});
		gameObject.GetComponent<DrowningMonitor>().canDrownToDeath = false;
		gameObject.GetComponent<DrowningMonitor>().livesUnderWater = true;
		gameObject.AddOrGet<StandardCropPlant>();
		gameObject.AddOrGet<KAnimControllerBase>().randomiseLoopedOffset = true;
		gameObject.AddOrGet<LoopingSounds>();
		template = gameObject;
		SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
		initialAnim = ID + "Seed";
		desc = STRINGS.CREATURES.SPECIES.SEEDS.SEALETTUCE.NAME;
		name = STRINGS.CREATURES.SPECIES.SEEDS.SEALETTUCE.DESC;
		anim = Assets.GetAnim("seed_sealettuce_kanim");
		int numberOfSeeds = 0;
		List<Tag> list = new List<Tag>();
		list.Add(GameTags.WaterSeed);
		list = list;
		iD = STRINGS.CREATURES.SPECIES.SEALETTUCE.DOMESTICATEDDESC;
		GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", numberOfSeeds, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 1, iD, EntityTemplates.CollisionShape.CIRCLE, 0.25f, 0.25f, null, string.Empty, false);
		EntityTemplates.CreateAndRegisterPreviewForPlant(seed, ID + "_preview", Assets.GetAnim("sea_lettuce_kanim"), "place", 1, 2);
		SoundEventVolumeCache.instance.AddVolume("sea_lettuce_kanim", "SeaLettuce_grow", NOISE_POLLUTION.CREATURES.TIER3);
		SoundEventVolumeCache.instance.AddVolume("sea_lettuce_kanim", "SeaLettuce_harvest", NOISE_POLLUTION.CREATURES.TIER3);
		return gameObject;
	}
    public GameObject CreatePrefab()
    {
        string         id          = "SaltPlant";
        string         name        = STRINGS.CREATURES.SPECIES.SALTPLANT.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.SALTPLANT.DESC;
        float          mass        = 2f;
        KAnimFile      anim        = Assets.GetAnim("saltplant_kanim");
        string         initialAnim = "idle_empty";
        EffectorValues tIER        = DECOR.PENALTY.TIER1;
        List <Tag>     list        = new List <Tag>();

        list.Add(GameTags.Hanging);
        list = list;
        GameObject gameObject = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingFront, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, list, 258.15f);

        EntityTemplates.MakeHangingOffsets(gameObject, 1, 2);
        GameObject template = gameObject;

        mass = 198.15f;
        float temperature_warning_low  = 248.15f;
        float temperature_warning_high = 323.15f;
        float temperature_lethal_high  = 393.15f;

        initialAnim = 381665462.ToString();
        EntityTemplates.ExtendEntityToBasicPlant(template, mass, temperature_warning_low, temperature_warning_high, temperature_lethal_high, null, true, 0f, 0.15f, initialAnim, true, true, true, true, 2400f);
        gameObject.AddOrGet <SaltPlant>();
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = SimHashes.Sand.CreateTag(),
                massConsumptionRate = 0.0116666667f
            }
        });
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        temperature_lethal_high  = 0.025f;
        temperature_warning_high = 0f;
        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.ChlorineGas
        };
        pressureVulnerable2.Configure(temperature_lethal_high, temperature_warning_high, 10f, 30f, safeAtmospheres);
        KPrefabID component = gameObject.GetComponent <KPrefabID>();

        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component3 = inst.GetComponent <PressureVulnerable>();
            component3.safe_atmospheres.Add(ElementLoader.FindElementByHash(SimHashes.ChlorineGas));
        };
        Storage storage = gameObject.AddOrGet <Storage>();

        storage.showInUI   = false;
        storage.capacityKg = 1f;
        ElementConsumer elementConsumer = gameObject.AddOrGet <ElementConsumer>();

        elementConsumer.showInStatusPanel = true;
        elementConsumer.showDescriptor    = true;
        elementConsumer.storeOnConsume    = false;
        elementConsumer.elementToConsume  = SimHashes.ChlorineGas;
        elementConsumer.configuration     = ElementConsumer.Configuration.Element;
        elementConsumer.consumptionRadius = 4;
        elementConsumer.sampleCellOffset  = new Vector3(0f, -1f);
        elementConsumer.consumptionRate   = 0.006f;
        UprootedMonitor component2 = gameObject.GetComponent <UprootedMonitor>();

        component2.monitorCell = new CellOffset(0, 1);
        gameObject.AddOrGet <StandardCropPlant>();
        template = gameObject;
        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Harvest;
        initialAnim = "SaltPlantSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.SALTPLANT.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.SALTPLANT.DESC;
        anim        = Assets.GetAnim("seed_saltplant_kanim");
        list        = new List <Tag>();
        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed      = EntityTemplates.CreateAndRegisterSeedForPlant(template, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Bottom, default(Tag), 4, STRINGS.CREATURES.SPECIES.SALTPLANT.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.35f, 0.35f, null, string.Empty, false);
        GameObject template2 = EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "SaltPlant_preview", Assets.GetAnim("saltplant_kanim"), "place", 1, 2);

        EntityTemplates.MakeHangingOffsets(template2, 1, 2);
        return(gameObject);
    }
Пример #25
0
    public GameObject CreatePrefab()
    {
        string         id          = "Oxyfern";
        string         name        = STRINGS.CREATURES.SPECIES.OXYFERN.NAME;
        string         desc        = STRINGS.CREATURES.SPECIES.OXYFERN.DESC;
        float          mass        = 1f;
        KAnimFile      anim        = Assets.GetAnim("oxy_fern_kanim");
        string         initialAnim = "idle_full";
        EffectorValues tIER        = DECOR.PENALTY.TIER1;
        GameObject     gameObject  = EntityTemplates.CreatePlacedEntity(id, name, desc, mass, anim, initialAnim, Grid.SceneLayer.BuildingBack, 1, 2, tIER, default(EffectorValues), SimHashes.Creature, null, 293f);

        gameObject.AddOrGet <ReceptacleMonitor>();
        gameObject.AddOrGet <EntombVulnerable>();
        gameObject.AddOrGet <WiltCondition>();
        gameObject.AddOrGet <Prioritizable>();
        gameObject.AddOrGet <Uprootable>();
        gameObject.AddOrGet <UprootedMonitor>();
        gameObject.AddOrGet <DrowningMonitor>();
        TemperatureVulnerable temperatureVulnerable = gameObject.AddOrGet <TemperatureVulnerable>();

        temperatureVulnerable.Configure(273.15f, 253.15f, 313.15f, 373.15f);
        Tag tag = ElementLoader.FindElementByHash(SimHashes.Water).tag;

        EntityTemplates.ExtendPlantToIrrigated(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = tag,
                massConsumptionRate = 0.0316666663f
            }
        });
        EntityTemplates.ExtendPlantToFertilizable(gameObject, new PlantElementAbsorber.ConsumeInfo[1]
        {
            new PlantElementAbsorber.ConsumeInfo
            {
                tag = GameTags.Dirt,
                massConsumptionRate = 0.006666667f
            }
        });
        gameObject.AddOrGet <Oxyfern>();
        gameObject.AddOrGet <OccupyArea>().objectLayers = new ObjectLayer[1]
        {
            ObjectLayer.Building
        };
        gameObject.AddOrGet <KBatchedAnimController>().randomiseLoopedOffset = true;
        PressureVulnerable pressureVulnerable  = gameObject.AddOrGet <PressureVulnerable>();
        PressureVulnerable pressureVulnerable2 = pressureVulnerable;

        mass = 0.025f;
        float pressureLethalLow = 0f;

        SimHashes[] safeAtmospheres = new SimHashes[1]
        {
            SimHashes.CarbonDioxide
        };
        pressureVulnerable2.Configure(mass, pressureLethalLow, 10f, 30f, safeAtmospheres);
        KPrefabID component = gameObject.GetComponent <KPrefabID>();

        component.prefabInitFn += delegate(GameObject inst)
        {
            PressureVulnerable component2 = inst.GetComponent <PressureVulnerable>();
            component2.safe_atmospheres.Add(ElementLoader.FindElementByHash(SimHashes.CarbonDioxide));
        };
        gameObject.AddOrGet <LoopingSounds>();
        Storage storage = gameObject.AddOrGet <Storage>();

        storage.showInUI   = false;
        storage.capacityKg = 1f;
        ElementConsumer elementConsumer = gameObject.AddOrGet <ElementConsumer>();

        elementConsumer.showInStatusPanel = false;
        elementConsumer.storeOnConsume    = true;
        elementConsumer.storage           = storage;
        elementConsumer.elementToConsume  = SimHashes.CarbonDioxide;
        elementConsumer.configuration     = ElementConsumer.Configuration.Element;
        elementConsumer.consumptionRadius = 2;
        elementConsumer.EnableConsumption(true);
        elementConsumer.sampleCellOffset = new Vector3(0f, 0f);
        elementConsumer.consumptionRate  = 0.000156250011f;
        ElementConverter elementConverter = gameObject.AddOrGet <ElementConverter>();

        elementConverter.OutputMultiplier = 50f;
        elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
        {
            new ElementConverter.ConsumedElement(1960575215.ToString().ToTag(), 0.000625000044f)
        };
        elementConverter.outputElements = new ElementConverter.OutputElement[1]
        {
            new ElementConverter.OutputElement(0.0312500037f, SimHashes.Oxygen, 0f, true, false, 0f, 1f, 0.75f, byte.MaxValue, 0)
        };
        GameObject plant = gameObject;

        SeedProducer.ProductionType productionType = SeedProducer.ProductionType.Hidden;
        initialAnim = "OxyfernSeed";
        desc        = STRINGS.CREATURES.SPECIES.SEEDS.OXYFERN.NAME;
        name        = STRINGS.CREATURES.SPECIES.SEEDS.OXYFERN.DESC;
        anim        = Assets.GetAnim("seed_oxyfern_kanim");
        List <Tag> list = new List <Tag>();

        list.Add(GameTags.CropSeed);
        list = list;
        GameObject seed = EntityTemplates.CreateAndRegisterSeedForPlant(plant, productionType, initialAnim, desc, name, anim, "object", 1, list, SingleEntityReceptacle.ReceptacleDirection.Top, default(Tag), 2, STRINGS.CREATURES.SPECIES.OXYFERN.DOMESTICATEDDESC, EntityTemplates.CollisionShape.CIRCLE, 0.3f, 0.3f, null, string.Empty, false);

        EntityTemplates.CreateAndRegisterPreviewForPlant(seed, "Oxyfern_preview", Assets.GetAnim("oxy_fern_kanim"), "place", 1, 2);
        SoundEventVolumeCache.instance.AddVolume("oxy_fern_kanim", "MealLice_harvest", NOISE_POLLUTION.CREATURES.TIER3);
        SoundEventVolumeCache.instance.AddVolume("oxy_fern_kanim", "MealLice_LP", NOISE_POLLUTION.CREATURES.TIER4);
        return(gameObject);
    }