Beispiel #1
0
    public override void ConfigureBuildingTemplate(GameObject go, Tag prefab_tag)
    {
        go.GetComponent <KPrefabID>().AddTag(RoomConstraints.ConstraintTags.IndustrialMachinery, false);
        OreScrubber oreScrubber = go.AddOrGet <OreScrubber>();

        oreScrubber.massConsumedPerUse  = 0.07f;
        oreScrubber.consumedElement     = SimHashes.ChlorineGas;
        oreScrubber.diseaseRemovalCount = 480000;
        ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

        conduitConsumer.conduitType        = ConduitType.Liquid;
        conduitConsumer.consumptionRate    = 1f;
        conduitConsumer.capacityKG         = 10f;
        conduitConsumer.wrongElementResult = ConduitConsumer.WrongElementResult.Dump;
        conduitConsumer.capacityTag        = ElementLoader.FindElementByHash(SimHashes.ChlorineGas).tag;
        go.AddOrGet <DirectionControl>();
        OreScrubber.Work work = go.AddOrGet <OreScrubber.Work>();
        work.overrideAnims = new KAnimFile[1]
        {
            Assets.GetAnim("anim_interacts_ore_scrubber_kanim")
        };
        work.workTime  = 10.2f;
        work.trackUses = true;
        work.workLayer = Grid.SceneLayer.BuildingUse;
        Storage storage = go.AddOrGet <Storage>();

        storage.SetDefaultStoredItemModifiers(Storage.StandardSealedStorage);
    }
Beispiel #2
0
        protected override bool OnWorkTick(Worker worker, float dt)
        {
            base.OnWorkTick(worker, dt);
            OreScrubber    component     = GetComponent <OreScrubber>();
            Storage        component2    = GetComponent <Storage>();
            PrimaryElement firstInfected = GetFirstInfected(worker.GetComponent <Storage>());
            int            num           = 0;

            SimUtil.DiseaseInfo invalid = SimUtil.DiseaseInfo.Invalid;
            if ((UnityEngine.Object)firstInfected != (UnityEngine.Object)null)
            {
                num             = Math.Min((int)(dt / workTime * (float)component.diseaseRemovalCount), firstInfected.DiseaseCount);
                diseaseRemoved += num;
                invalid.idx     = firstInfected.DiseaseIdx;
                invalid.count   = num;
                firstInfected.ModifyDiseaseCount(-num, "OreScrubber.OnWorkTick");
            }
            component.maxPossiblyRemoved += num;
            float num2 = component.massConsumedPerUse * dt / workTime;

            SimUtil.DiseaseInfo disease_info = SimUtil.DiseaseInfo.Invalid;
            component2.ConsumeAndGetDisease(ElementLoader.FindElementByHash(component.consumedElement).tag, num2, out disease_info, out float aggregate_temperature);
            if (component.outputElement != SimHashes.Vacuum)
            {
                disease_info = SimUtil.CalculateFinalDiseaseInfo(invalid, disease_info);
                component2.AddLiquid(component.outputElement, num2, aggregate_temperature, disease_info.idx, disease_info.count, false, true);
            }
            return(diseaseRemoved > component.diseaseRemovalCount);
        }