public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(base.GetInspectString());

            if (ParentHolder != null && !(ParentHolder is Map))
            {
                // If minified, don't show computer and feedstock check Inspector messages
            }
            else
            {
                if (!ReplimatUtility.CanFindComputer(this))
                {
                    stringBuilder.AppendLine("NotConnectedToComputer".Translate());
                }

                if (Empty)
                {
                    stringBuilder.AppendLine("CorpseRecyclerEmpty".Translate());
                }
                else
                {
                    stringBuilder.AppendLine("CorpseRecyclerMassRemaining".Translate(corpseRemainingMass.ToString("0.00"), corpseInitialMass.ToString("0.00")));
                }
            }
            return(stringBuilder.ToString().TrimEndNewlines());
        }
Пример #2
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());

            if (ParentHolder != null && !(ParentHolder is Map))
            {
                // If minified, don't show computer and feedstock check Inspector messages
            }
            else
            {
                if (!ReplimatUtility.CanFindComputer(this, PowerComp.PowerNet))
                {
                    stringBuilder.AppendLine();
                    stringBuilder.Append("NotConnectedToComputer".Translate());
                }
                else if (!HasEnoughFeedstockInHoppers())
                {
                    stringBuilder.AppendLine();
                    stringBuilder.Append("NotEnoughFeedstock".Translate());
                }
                else
                {
                }
            }

            return(stringBuilder.ToString());
        }
Пример #3
0
        public override void Tick()
        {
            base.Tick();

            if (!powerComp.PowerOn || !ReplimatUtility.CanFindComputer(this, PowerComp.PowerNet))
            {
                return;
            }

            if (this.IsHashIntervalTick(60))
            {
                List <Thing> list         = Map.thingGrid.ThingsListAtFast(Position);
                Thing        foodInFeeder = list.FirstOrDefault(x => x.def.IsNutritionGivingIngestible);

                if (foodInFeeder == null)
                {
                    int maxAnimFeed = Mathf.FloorToInt(powerComp.PowerNet.GetTanks().Sum(x => x.storedFeedstock) / volumePerAnimalFeed);
                    maxAnimFeed = Mathf.Min(maxAnimFeed, CurrentAnimalFeedDef.stackLimit);

                    if (maxAnimFeed > 0 && powerComp.PowerNet.TryConsumeFeedstock(volumePerAnimalFeed * maxAnimFeed))
                    {
                        ReplicatingTicks = GenTicks.SecondsToTicks(2f);
                        def.building.soundDispense.PlayOneShot(new TargetInfo(Position, Map, false));

                        Thing t = ThingMaker.MakeThing(CurrentAnimalFeedDef, null);
                        t.stackCount = maxAnimFeed;
                        GenPlace.TryPlaceThing(t, Position, Map, ThingPlaceMode.Direct);
                    }
                }
                else if (foodInFeeder.def == CurrentAnimalFeedDef && foodInFeeder.stackCount < (CurrentAnimalFeedDef.stackLimit * 0.25))
                {
                    int refill      = Mathf.Min(foodInFeeder.def.stackLimit - foodInFeeder.stackCount, foodInFeeder.def.stackLimit);
                    int maxAnimFeed = Mathf.FloorToInt(powerComp.PowerNet.GetTanks().Sum(x => x.storedFeedstock) / volumePerAnimalFeed);
                    maxAnimFeed = Mathf.Min(maxAnimFeed, refill);

                    if (maxAnimFeed > 0 && powerComp.PowerNet.TryConsumeFeedstock(volumePerAnimalFeed * maxAnimFeed))
                    {
                        ReplicatingTicks = GenTicks.SecondsToTicks(2f);
                        def.building.soundDispense.PlayOneShot(new TargetInfo(Position, Map, false));

                        foodInFeeder.stackCount += maxAnimFeed;
                    }
                }
            }

            powerComp.PowerOutput = -powerComp.Props.basePowerConsumption;

            if (ReplicatingTicks > 0)
            {
                ReplicatingTicks--;
                powerComp.PowerOutput = -Math.Max(stateDependentPowerComp.ActiveModePowerConsumption, powerComp.Props.basePowerConsumption);
            }
        }
Пример #4
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(base.GetInspectString());
            if ((ParentHolder == null || ParentHolder is Map) && !ReplimatUtility.CanFindComputer(this, PowerComp.PowerNet))
            {
                stringBuilder.AppendLine();
                stringBuilder.Append(Translator.Translate("NotConnectedToComputer"));
            }
            return(stringBuilder.ToString());
        }
Пример #5
0
        public override string GetInspectString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(base.GetInspectString());
            stringBuilder.Append("FeedstockStored".Translate(storedFeedstock.ToString("0.00"), StoredFeedstockMax.ToString("0.00")));

            if (ParentHolder != null && !(ParentHolder is Map))
            {
                // If minified, don't show computer and feedstock check Inspector messages
            }
            else
            {
                if (!ReplimatUtility.CanFindComputer(this, PowerComp.PowerNet))
                {
                    stringBuilder.AppendLine();
                    stringBuilder.Append("NotConnectedToComputer".Translate());
                }
            }
            return(stringBuilder.ToString().TrimEndNewlines());
        }