public void SetupValues() { ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { MaxCapacity = extra_def.vatProperties.maxCapacity; FermentationModifier = extra_def.vatProperties.fermentationModifier; } }
private Thing FindInputThing(Pawn pawn, Building_FermentingVat barrel) { Predicate <Thing> predicate = (Thing x) => !x.IsForbidden(pawn) && pawn.CanReserve(x, 1); Predicate <Thing> validator = predicate; ThingDef input_def = null; ExtraThingDef extra_def = barrel.def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { input_def = extra_def.vatProperties.inputThingDef; } return(GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(input_def), PathEndMode.ClosestTouch, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, validator, null, 0, -1, false, RegionType.Set_Passable, false)); }
public Thing TakeOutThing() { if (!this.Fermented) { Log.Warning("Tried to get Defs but it's not yet fermented."); return(null); } Thing thing = null; int stack_count_modifier = 1; ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { thing = ThingMaker.MakeThing(extra_def.vatProperties.outputThingDef, null); stack_count_modifier = extra_def.vatProperties.inputToOutputRatio; } thing.stackCount = this.thingCount / stack_count_modifier; this.Reset(); return(thing); }
public override string GetInspectString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.GetInspectString()); if (stringBuilder.Length != 0) { stringBuilder.AppendLine(); } CompTemperatureRuinable comp = base.GetComp <CompTemperatureRuinable>(); if (!this.Empty && !comp.Ruined) { if (this.Fermented) { ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { stringBuilder.AppendLine(extra_def.vatProperties.containsOutputTranslation.Translate(new object[] { this.thingCount, MaxCapacity })); } else { stringBuilder.AppendLine("ContainsBerries".Translate(new object[] { this.thingCount, MaxCapacity })); } } else { ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { stringBuilder.AppendLine(extra_def.vatProperties.containsInputTranslation.Translate(new object[] { this.thingCount, MaxCapacity })); } else { stringBuilder.AppendLine("ContainsCider".Translate(new object[] { this.thingCount, MaxCapacity })); } } } if (!this.Empty) { if (this.Fermented) { ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { stringBuilder.AppendLine(extra_def.vatProperties.fermentedTranslation.Translate()); } else { stringBuilder.AppendLine("Fermented".Translate()); } } else { ExtraThingDef extra_def = def as ExtraThingDef; if (extra_def != null && extra_def.vatProperties != null) { stringBuilder.AppendLine(extra_def.vatProperties.fermentationProgressTranslation.Translate(new object[] { this.Progress.ToStringPercent(), this.EstimatedTicksLeft.ToStringTicksToPeriod() })); } else { stringBuilder.AppendLine("FermentationProgress".Translate(new object[] { this.Progress.ToStringPercent(), this.EstimatedTicksLeft.ToStringTicksToPeriod() })); } if (this.CurrentTempProgressSpeedFactor != 1f) { if (extra_def != null && extra_def.vatProperties != null) { stringBuilder.AppendLine(extra_def.vatProperties.fermentationNonIdealTranslation.Translate(new object[] { this.CurrentTempProgressSpeedFactor.ToStringPercent() })); } else { stringBuilder.AppendLine("FermentationBarrelOutOfIdealTemperature".Translate(new object[] { this.CurrentTempProgressSpeedFactor.ToStringPercent() })); } } } } stringBuilder.AppendLine("Temperature".Translate() + ": " + base.AmbientTemperature.ToStringTemperature("F0")); stringBuilder.AppendLine(string.Concat(new string[] { "IdealFermentingTemperature".Translate(), ": ", 7f.ToStringTemperature("F0"), " ~ ", comp.Props.maxSafeTemperature.ToStringTemperature("F0") })); return(stringBuilder.ToString().TrimEndNewlines()); }