Ejemplo n.º 1
0
        public List <Descriptor> GetDescriptors(GameObject obj)
        {
            List <Descriptor> list = new List <Descriptor>();

            if (targetAtmosphere == (SimHashes)0)
            {
                list.Add(new Descriptor(UI.BUILDINGEFFECTS.SCALE_GROWTH.Replace("{Item}", itemDroppedOnShear.ProperName()).Replace("{Amount}", GameUtil.GetFormattedMass(dropMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")).Replace("{Time}", GameUtil.GetFormattedCycles(1f / defaultGrowthRate, "F1")), UI.BUILDINGEFFECTS.TOOLTIPS.SCALE_GROWTH.Replace("{Item}", itemDroppedOnShear.ProperName()).Replace("{Amount}", GameUtil.GetFormattedMass(dropMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")).Replace("{Time}", GameUtil.GetFormattedCycles(1f / defaultGrowthRate, "F1")), Descriptor.DescriptorType.Effect, false));
            }
            else
            {
                list.Add(new Descriptor(UI.BUILDINGEFFECTS.SCALE_GROWTH_ATMO.Replace("{Item}", itemDroppedOnShear.ProperName()).Replace("{Amount}", GameUtil.GetFormattedMass(dropMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")).Replace("{Time}", GameUtil.GetFormattedCycles(1f / defaultGrowthRate, "F1"))
                                        .Replace("{Atmosphere}", targetAtmosphere.CreateTag().ProperName()), UI.BUILDINGEFFECTS.TOOLTIPS.SCALE_GROWTH_ATMO.Replace("{Item}", itemDroppedOnShear.ProperName()).Replace("{Amount}", GameUtil.GetFormattedMass(dropMass, GameUtil.TimeSlice.None, GameUtil.MetricMassFormat.UseThreshold, true, "{0:0.#}")).Replace("{Time}", GameUtil.GetFormattedCycles(1f / defaultGrowthRate, "F1"))
                                        .Replace("{Atmosphere}", targetAtmosphere.CreateTag().ProperName()), Descriptor.DescriptorType.Effect, false));
            }
            return(list);
        }
Ejemplo n.º 2
0
        public static GameObject CreateHatch(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(
                BaseHatchConfig.BaseHatch(
                    id,
                    name,
                    desc,
                    anim_file,
                    BaseTraitId,
                    is_baby,
                    SymbolOverride
                    ),
                HatchTuning.PEN_SIZE_PER_CREATURE,
                MaxAge);

            CreateTrait(name);

            List <Diet.Info> diet_infos = SturdyDiet(
                poopTag: EmitElement.CreateTag(),
                caloriesPerKg: CaloriesPerKgOfFood,
                producedConversionRate: TUNING.CREATURES.CONVERSION_EFFICIENCY.NORMAL);//nerfed effiendy from 3 to normal

            wildCreature.AddOrGet <DecorProvider>()?.SetValues(tier);
            return(BaseHatchConfig.SetupDiet(wildCreature, diet_infos, CaloriesPerKgOfFood, MinPoopSizeKg));
        }
Ejemplo n.º 3
0
        public const float warningHighTemperature = 873.15f; //303.15f;
        public static GameObject CreatePuft(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BasePuftConfig.BasePuft(id, name, desc, BASE_TRAIT_ID, anim_file, is_baby, "",
                                                                                                         warningLowTemperature, warningHighTemperature), PuftTuning.PEN_SIZE_PER_CREATURE);
            Trait trait = Db.Get().CreateTrait(BASE_TRAIT_ID, name, name, (string)null, false, (ChoreGroup[])null, true, true);

            trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.maxAttribute.Id, PuftTuning.STANDARD_STOMACH_SIZE, name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.Calories.deltaAttribute.Id, (float)(-(double)PuftTuning.STANDARD_CALORIES_PER_CYCLE / 600.0), name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.HitPoints.maxAttribute.Id, 25f, name, false, false, true));
            trait.Add(new AttributeModifier(Db.Get().Amounts.Age.maxAttribute.Id, 75f, name, false, false, true));
            GameObject go = BasePuftConfig.SetupDiet(wildCreature, CONSUME_ELEMENT.CreateTag(), EMIT_ELEMENT.CreateTag(),
                                                     DevilPuftConfig.CALORIES_PER_KG_OF_ORE, TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_2, (string)null, 0.0f,
                                                     DevilPuftConfig.MIN_POOP_SIZE_IN_KG);

            go.AddOrGetDef <LureableMonitor.Def>().lures = new Tag[1]
            {
                SimHashes.Sulfur.CreateTag()
            };
            return(go);
        }
Ejemplo n.º 4
0
        public static GameObject CreateHatch(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(
                BaseHatchConfig.BaseHatch(
                    id,
                    name,
                    desc,
                    anim_file,
                    BaseTraitId,
                    is_baby,
                    SymbolOverride
                    ),
                HatchTuning.PEN_SIZE_PER_CREATURE,
                MaxAge);

            CreateTrait(name);

            List <Diet.Info> diet_infos = MutedDiet(
                poopTag: EmitElement.CreateTag(),
                caloriesPerKg: CaloriesPerKgOfFood,
                producedConversionRate: TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_3);

            return(BaseHatchConfig.SetupDiet(wildCreature, diet_infos, CaloriesPerKgOfFood, MinPoopSizeKg));
        }
Ejemplo n.º 5
0
        public static GameObject CreatePacu(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            var prefab = BasePacuConfig.CreatePrefab(id, "PacuOilBaseTrait", name, desc, anim_file, is_baby, "glp_",
                                                     243.15f, 278.15f);

            var def4 = prefab.AddOrGetDef <CreatureCalorieMonitor.Def>();

            def4.diet = new Diet(new Diet.Info(new HashSet <Tag>
            {
                SimHashes.Carbon.CreateTag()
            }, SimHashes.Sulfur.CreateTag(),
                                               PacuTuning.STANDARD_CALORIES_PER_CYCLE / 140f
                                               , CREATURES.CONVERSION_EFFICIENCY.NORMAL));

            var wildCreature =
                EntityTemplates.ExtendEntityToWildCreature(prefab, PacuTuning.PEN_SIZE_PER_CREATURE, 25f);

            if (!is_baby)
            {
                wildCreature.AddComponent <Storage>().capacityKg = 10f;
                var elementConsumer = (ElementConsumer)wildCreature.AddOrGet <PassiveElementConsumer>();
                elementConsumer.elementToConsume  = INPUT_ELEMENT;
                elementConsumer.consumptionRate   = 0.2f;
                elementConsumer.capacityKG        = 10f;
                elementConsumer.consumptionRadius = 3;
                elementConsumer.showInStatusPanel = true;
                elementConsumer.sampleCellOffset  = new Vector3(0.0f, 0.0f, 0.0f);
                elementConsumer.isRequired        = false;
                elementConsumer.storeOnConsume    = true;
                elementConsumer.showDescriptor    = false;
                wildCreature.AddOrGet <UpdateElementConsumerPosition>();
                var bubbleSpawner = wildCreature.AddComponent <BubbleSpawner>();
                bubbleSpawner.element         = OUTPUT_ELEMENT;
                bubbleSpawner.emitMass        = 2f;
                bubbleSpawner.emitVariance    = 0.5f;
                bubbleSpawner.initialVelocity = new Vector2f(0, 1);
                var elementConverter = wildCreature.AddOrGet <ElementConverter>();
                elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                {
                    new ElementConverter.ConsumedElement(INPUT_ELEMENT.CreateTag(), 0.2f)
                };
                elementConverter.outputElements = new ElementConverter.OutputElement[1]
                {
                    new ElementConverter.OutputElement(0.2f, OUTPUT_ELEMENT, 0.0f, true, true)
                };
            }

            return(wildCreature);
        }
Ejemplo n.º 6
0
        public static GameObject CreateHatch(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(
                BaseHatchConfig.BaseHatch(
                    id,
                    name,
                    desc,
                    anim_file,
                    BaseTraitId,
                    is_baby,
                    SymbolOverride
                    ),
                HatchTuning.PEN_SIZE_PER_CREATURE);

            CreateTrait(name);

            List <Diet.Info> diet_infos = WoodenDiet(
                poopTag: WoodLogConfig.TAG,
                caloriesPerKg: CaloriesPerKgOfFood,
                producedConversionRate: TUNING.CREATURES.CONVERSION_EFFICIENCY.GOOD_2);//nerfed effiendy from 3 to normal

            wildCreature.AddOrGet <DecorProvider>()?.SetValues(tier);
            if (!is_baby)
            {
                wildCreature.AddComponent <Storage>().capacityKg = 10f;
                ElementConsumer elementConsumer = (ElementConsumer)wildCreature.AddOrGet <PassiveElementConsumer>();
                elementConsumer.elementToConsume  = element_input;
                elementConsumer.consumptionRate   = 0.2f;
                elementConsumer.capacityKG        = 10f;
                elementConsumer.consumptionRadius = (byte)3;
                elementConsumer.showInStatusPanel = true;
                elementConsumer.sampleCellOffset  = new Vector3(0.0f, 0.0f, 0.0f);
                elementConsumer.isRequired        = false;
                elementConsumer.storeOnConsume    = true;
                elementConsumer.showDescriptor    = false;
                ElementConverter elementConverter = wildCreature.AddOrGet <ElementConverter>();
                elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                {
                    new ElementConverter.ConsumedElement(element_input.CreateTag(), 0.2f)
                };
                elementConverter.outputElements = new ElementConverter.OutputElement[1]
                {
                    new ElementConverter.OutputElement(0.2f, element_output, 0.0f, false, false, 0.0f, 0.5f, 1f, byte.MaxValue, 0)
                };
            }

            return(BaseHatchConfig.SetupDiet(wildCreature, diet_infos, CaloriesPerKgOfFood, MinPoopSizeKg));
        }
Ejemplo n.º 7
0
        public static GameObject CreateCritter(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BaseSquirrelConfig.BaseSquirrel(id, name, desc, anim_file, "SquirrelBaseTrait", is_baby, (string)null), SquirrelTuning.PEN_SIZE_PER_CREATURE);

            CreateTrait(name);
            Diet.Info[] diet_infos = Diet(
                EMIT_ELEMENT.CreateTag(), CALORIES_PER_DAY_OF_PLANT_EATEN,
                KG_POOP_PER_DAY_OF_PLANT,
                (string)null, 0.0f);
            double minPoopSizeKg = (double)MIN_POOP_SIZE_KG;

            return(BaseSquirrelConfig.SetupDiet(wildCreature, diet_infos, (float)minPoopSizeKg));
        }
Ejemplo n.º 8
0
        public static GameObject CreatePacu(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BasePacuConfig.CreatePrefab(id, BASE_TRAIT_ID, name, desc, anim_file, is_baby, null, 303.15f, 353.15f), PacuTuning.PEN_SIZE_PER_CREATURE, 25f);

            if (!is_baby)
            {
                wildCreature.AddComponent <Storage>().capacityKg = 10f;
                ElementConsumer elementConsumer = wildCreature.AddOrGet <PassiveElementConsumer>();
                elementConsumer.elementToConsume  = INPUT_ELEMENT;
                elementConsumer.consumptionRate   = 0.2f;
                elementConsumer.capacityKG        = 10f;
                elementConsumer.consumptionRadius = 3;
                elementConsumer.showInStatusPanel = true;
                elementConsumer.sampleCellOffset  = new Vector3(0.0f, 0.0f, 0.0f);
                elementConsumer.isRequired        = false;
                elementConsumer.storeOnConsume    = true;
                elementConsumer.showDescriptor    = false;
                wildCreature.AddOrGet <UpdateElementConsumerPosition>();
                BubbleSpawner bubbleSpawner = wildCreature.AddComponent <BubbleSpawner>();
                bubbleSpawner.element         = OUTPUT_ELEMENT;
                bubbleSpawner.emitMass        = 2f;
                bubbleSpawner.emitVariance    = 0.5f;
                bubbleSpawner.initialVelocity = new Vector2f(0, 1);
                ElementConverter elementConverter = wildCreature.AddOrGet <ElementConverter>();
                elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                {
                    new ElementConverter.ConsumedElement(INPUT_ELEMENT.CreateTag(), 0.2f)
                };
                elementConverter.outputElements = new ElementConverter.OutputElement[1]
                {
                    new ElementConverter.OutputElement(0.2f, OUTPUT_ELEMENT, 0.0f, true, true, 0.0f, 0.5f, 1f, byte.MaxValue, 0)
                };
            }
            return(wildCreature);
        }
Ejemplo n.º 9
0
        public static GameObject CreateCritter(
            string id,
            string name,
            string desc,
            string anim_file,
            bool is_baby)
        {
            GameObject wildCreature = EntityTemplates.ExtendEntityToWildCreature(BaseSquirrelConfig.BaseSquirrel(id, name, desc, anim_file, "SquirrelBaseTrait", is_baby, (string)null), SquirrelTuning.PEN_SIZE_PER_CREATURE);

            CreateTrait(name);
            Diet.Info[] diet_infos = Diet(
                EMIT_ELEMENT.CreateTag(), CALORIES_PER_DAY_OF_PLANT_EATEN,
                KG_POOP_PER_DAY_OF_PLANT,
                (string)null, 0.0f);
            double minPoopSizeKg          = (double)MIN_POOP_SIZE_KG;
            float  warningLowTemperature  = MIN_TEMP;
            float  warningHighTemperature = MAX_TEMP;
            float  lethalLowTemperature   = warningLowTemperature - 20f;
            float  lethalHighTemperature  = warningHighTemperature + 20f;

            wildCreature.AddOrGet <TemperatureVulnerable>().Configure(warningLowTemperature, lethalLowTemperature, warningHighTemperature, lethalHighTemperature);
            return(BaseSquirrelConfig.SetupDiet(wildCreature, diet_infos, (float)minPoopSizeKg));
        }
Ejemplo n.º 10
0
        public void Sim200ms(float dt)
        {
            GameObject     storedObject = this.storage.FindFirst(elementTag);
            PrimaryElement component    = null;
            float          stored       = 0f;

            if (storedObject != null)
            {
                component = storedObject.GetComponent <PrimaryElement>();
                stored    = component.Mass;
            }

            if (stored > 0f && dispenser != null)
            {
                if (!dispenser.IsConnected)
                {
                    Element element     = component.Element;
                    float   temperature = component.Temperature;
                    int     disease     = component.DiseaseCount;

                    int outputCell = dispenser.UtilityCell;

                    if (element.IsGas)
                    {
                        Console.WriteLine("Outputing " + stored.ToString() + " of " + elementHash.CreateTag() + " at " + outputCell.ToString());
                        SimMessages.ModifyMass(outputCell, stored, 255, disease, CellEventLogger.Instance.EnergyGeneratorModifyMass, temperature, elementHash);
                    }
                    else if (element.IsLiquid)
                    {
                        int elementIndex = ElementLoader.GetElementIndex(elementHash);
                        FallingWater.instance.AddParticle(outputCell, (byte)elementIndex, stored, temperature, 255, disease, true, false, false, false);
                    }
                    else
                    {
                        element.substance.SpawnResource(Grid.CellToPosCCC(outputCell, Grid.SceneLayer.Front), stored, temperature, 255, disease, true, false, false);
                    }
                    storage.ConsumeIgnoringDisease(storedObject);
                    stored = 0f;
                }
            }
            bool overfilled = stored >= capacity;

            this.operational.SetFlag(outputFlag, !overfilled);
        }
Ejemplo n.º 11
0
        internal static PortDisplayOutput AddOutput(GameObject go, CellOffset offset, SimHashes elementHash)
        {
            Element     element     = ElementLoader.GetElement(elementHash.CreateTag());
            ConduitType conduitType = element.IsGas ? ConduitType.Gas : element.IsLiquid ? ConduitType.Liquid : ConduitType.Solid;

            // port color
            Color32 color = element.substance.conduitColour;

            color.a = 255; // for some reason the alpha channel is set to invisible for some elements (hydrogen only?)

            if (color.r == 0 && color.g == 0 && color.b == 0)
            {
                // avoid completely black icons since the background is black
                color.r = 25;
                color.g = 25;
                color.b = 25;
            }

            PortDisplayOutput outputPort = new PortDisplayOutput(conduitType, offset, null, color);

            PortDisplayController controller = go.AddOrGet <PortDisplayController>();

            controller.Init(go);

            controller.AssignPort(go, outputPort);

            ElementConverter converter = go.GetComponent <ElementConverter>();

            if (converter != null)
            {
                for (int i = 0; i < converter.outputElements.Length; ++i)
                {
                    ElementConverter.OutputElement item = converter.outputElements[i];
                    if (item.elementHash == elementHash)
                    {
                        converter.outputElements[i].storeOutput = true;

                        PipedDispenser dispenser = go.AddComponent <PipedDispenser>();
                        dispenser.elementFilter = new SimHashes[] { elementHash };
                        dispenser.AssignPort(outputPort);
                        dispenser.alwaysDispense     = true;
                        dispenser.SkipSetOperational = true;

                        PipedOptionalExhaust exhaust = go.AddComponent <PipedOptionalExhaust>();
                        exhaust.dispenser   = dispenser;
                        exhaust.elementHash = elementHash;
                        exhaust.elementTag  = elementHash.CreateTag();
                        exhaust.capacity    = item.massGenerationRate * converter.OutputMultiplier * 5;

                        break;
                    }
                }
            }
            else
            {
                EnergyGenerator energyGenerator = go.GetComponent <EnergyGenerator>();
                if (energyGenerator != null)
                {
                    for (int i = 0; i < energyGenerator.formula.outputs.Length; ++i)
                    {
                        EnergyGenerator.OutputItem item = energyGenerator.formula.outputs[i];
                        if (item.element == elementHash)
                        {
                            energyGenerator.formula.outputs[i].store = true;

                            PipedDispenser dispenser = go.AddComponent <PipedDispenser>();
                            dispenser.elementFilter = new SimHashes[] { elementHash };
                            dispenser.AssignPort(outputPort);
                            dispenser.alwaysDispense     = true;
                            dispenser.SkipSetOperational = true;

                            PipedOptionalExhaust exhaust = go.AddComponent <PipedOptionalExhaust>();
                            exhaust.dispenser   = dispenser;
                            exhaust.elementHash = elementHash;
                            exhaust.elementTag  = elementHash.CreateTag();
                            exhaust.capacity    = item.creationRate * 5;

                            break;
                        }
                    }
                }
            }
            return(outputPort);
        }
Ejemplo n.º 12
0
        protected override void ApplyTrait(GameObject go)
        {
            var reduction_factor  = 4;
            var consumptionRate   = 0.2f / reduction_factor;
            var outputKgPerSecond = 0.2f / reduction_factor;

            if (//go.GetComponent<GeneticTraitComponent>().IsBaby() ||
                go.GetComponent <GeneticTraitComponent>().IsAdult()
                //||go.GetComponent<GeneticTraitComponent>().IsEgg()
                )
            {
                Util.Shuffle(Possible_Inputs);
                element_input = Possible_Inputs.First();
                Util.Shuffle(Possible_Outputs);
                List <SimHashes> complete_list = Possible_Outputs.Where(x => x != element_input).ToList();
                element_output = complete_list.First();
                element_input  = SimHashes.ContaminatedOxygen;
                element_output = SimHashes.Hydrogen;
                var element1      = ElementLoader.FindElementByHash(element_input);
                var element2      = ElementLoader.FindElementByHash(element_output);
                var string_holder = go.AddComponent <StringHolderComponent>();
                string_holder.text = "This critter skin absorbs small quantities of " + element1.name + " and drops " + element2.name;
                string_holder.id   = ID;
                go.AddOrGet <Storage>().capacityKg = 10f;
                ElementConsumer elementConsumer = (ElementConsumer)go.AddOrGet <PassiveElementConsumer>();
                elementConsumer.elementToConsume  = element_input;
                elementConsumer.consumptionRate   = consumptionRate;
                elementConsumer.capacityKG        = 10f;
                elementConsumer.consumptionRadius = (byte)3;
                elementConsumer.showInStatusPanel = true;
                elementConsumer.sampleCellOffset  = new Vector3(0.0f, 0.0f, 0.0f);
                elementConsumer.isRequired        = false;
                elementConsumer.storeOnConsume    = true;
                elementConsumer.showDescriptor    = false;
                elementConsumer.EnableConsumption(true);

                if (element2.IsGas)
                {
                    DebugHelper.Log("element2.IsGas");
                    go.AddOrGet <UpdateElementConsumerPosition>();
                    ElementConverter elementConverter = go.AddOrGet <ElementConverter>();
                    elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                    {
                        new ElementConverter.ConsumedElement(element_input.CreateTag(), consumptionRate)
                    };
                    elementConverter.outputElements = new ElementConverter.OutputElement[1]
                    {
                        new ElementConverter.OutputElement(outputKgPerSecond, element_output, 0.0f, true, false, 0.0f, 0.5f, 1f, byte.MaxValue, 0)
                    };
                }
                if (element2.IsLiquid)
                {
                    DebugHelper.Log("element2.IsLiquid");
                    go.AddOrGet <UpdateElementConsumerPosition>();
                    BubbleSpawner bubbleSpawner = go.AddComponent <BubbleSpawner>();
                    bubbleSpawner.element         = element_output;
                    bubbleSpawner.emitMass        = 2f;
                    bubbleSpawner.emitVariance    = 0.5f;
                    bubbleSpawner.initialVelocity = (Vector2) new Vector2f(0, 1);
                    ElementConverter elementConverter = go.AddOrGet <ElementConverter>();
                    elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                    {
                        new ElementConverter.ConsumedElement(element_input.CreateTag(), consumptionRate)
                    };
                    elementConverter.outputElements = new ElementConverter.OutputElement[1]
                    {
                        new ElementConverter.OutputElement(outputKgPerSecond, element_output, 0.0f, true, true, 0.0f, 0.5f, 1f, byte.MaxValue, 0)
                    };
                }
                if (element2.IsSolid)
                {
                    DebugHelper.Log("element2.IsSolid");
                    go.AddOrGet <UpdateElementConsumerPosition>();
                    ElementDropper elementDropper = go.AddComponent <ElementDropper>();
                    elementDropper.emitMass   = 2f;
                    elementDropper.emitTag    = element_output.CreateTag();
                    elementDropper.emitOffset = new Vector3(0.0f, 0.0f, 0.0f);
                    ElementConverter elementConverter = go.AddOrGet <ElementConverter>();
                    elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
                    {
                        new ElementConverter.ConsumedElement(element_input.CreateTag(), consumptionRate)
                    };
                    elementConverter.outputElements = new ElementConverter.OutputElement[1]
                    {
                        new ElementConverter.OutputElement(outputKgPerSecond, element_output, 0.0f, true, true, 0.0f, 0.5f, 1f, byte.MaxValue, 0)
                    };
                }
            }
        }
Ejemplo n.º 13
0
        public override void DoPostConfigureComplete(GameObject go)
        {
            go.AddOrGet <LoopingSounds>();
            Light2D light2D = go.AddOrGet <Light2D>();

            light2D.overlayColour = LIGHT2D.FLOORLAMP_OVERLAYCOLOR;
            light2D.Color         = KELVIN1500;
            light2D.Range         = RANGE;
            light2D.Offset        = new Vector2(0f, 0.5f);
            light2D.shape         = LightShape.Circle;
            light2D.drawOverlay   = true;
            light2D.Lux           = LUX;
            light2D.overlayColour = Color.red;

            go.AddOrGet <Lantern>();
            SimHashes element    = SimHashes.CrudeOil; //Config.SettingsManager.Settings.LanternPowerSource == "Oil" ? SimHashes.CrudeOil : SimHashes.Petroleum;
            Tag       elementTag = element.CreateTag();

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

            storage.capacityKg       = CAPACITY;
            storage.showInUI         = true;
            storage.allowItemRemoval = false;
            storage.storageFilters   = new List <Tag> {
                elementTag
            };

            ManualDeliveryKG manualDeliveryKG = go.AddOrGet <ManualDeliveryKG>();

            manualDeliveryKG.SetStorage(storage);
            manualDeliveryKG.requestedItemTag       = elementTag;
            manualDeliveryKG.capacity               = CAPACITY;
            manualDeliveryKG.refillMass             = 1.5f;
            manualDeliveryKG.choreTypeIDHash        = Db.Get().ChoreTypes.FetchCritical.IdHash;
            manualDeliveryKG.operationalRequirement = FetchOrder2.OperationalRequirement.Functional;
            manualDeliveryKG.allowPause             = true;

            ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

            conduitConsumer.conduitType          = ConduitType.Liquid;
            conduitConsumer.consumptionRate      = CONSUMPTION_RATE;
            conduitConsumer.capacityTag          = GameTagExtensions.Create(element);
            conduitConsumer.capacityKG           = CAPACITY;
            conduitConsumer.forceAlwaysSatisfied = true;
            conduitConsumer.ignoreMinMassCheck   = true;
            conduitConsumer.alwaysConsume        = true;
            conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;

            ElementConverter elementConverter = go.AddComponent <ElementConverter>();

            elementConverter.consumedElements = new ElementConverter.ConsumedElement[1]
            {
                new ElementConverter.ConsumedElement(ElementLoader.FindElementByHash(element).tag, CONSUMPTION_RATE)
            };
            elementConverter.outputElements = new ElementConverter.OutputElement[]
            {
                new ElementConverter.OutputElement(0.01f, SimHashes.CarbonDioxide, 303.15f, false, false, 0f, 1f, 1f, byte.MaxValue, 0)
            };
            go.AddOrGetDef <LightController.Def>();

            go.GetComponent <RequireInputs>().SetRequirements(false, false);
            Prioritizable.AddRef(go);
        }