// Token: 0x06000089 RID: 137 RVA: 0x000059A4 File Offset: 0x00003BA4 public override IEnumerable <Gizmo> GetGizmos() { foreach (var gizmo in base.GetGizmos()) { yield return(gizmo); } if (Faction != Faction.OfPlayer) { yield break; } string SelectDesc = "RPThingMaker.ThingSelectDesc".Translate(); if (MakerThingDef == null) { string NoChem = "RPThingMaker.ThingSelect".Translate(); yield return(new Command_Action { defaultLabel = NoChem, icon = ContentFinder <Texture2D> .Get(thingTexPath), defaultDesc = SelectDesc, action = RPMakerSelectThing }); } else { var IconToUse = RPThingMakerUtility.GetRPThingIcon(MakerThingDef); var LabelDetail = MakerThingDef.label.CapitalizeFirst(); LabelDetail = string.Concat(LabelDetail, " [", NumProd, "] "); if (TotalProdWorkTicks > 0) { LabelDetail = LabelDetail + " (" + (int)((TotalProdWorkTicks - ProdWorkTicks) / (float)TotalProdWorkTicks * 100f) + "%)"; } yield return(new Command_Action { defaultLabel = LabelDetail, icon = IconToUse, defaultDesc = SelectDesc, action = RPMakerSelectThing }); } string LabelProduce = "RPThingMaker.Production".Translate(); string LabelProduceDesc = "RPThingMaker.ProductionDesc".Translate(); if (isProducing) { if (MakerThingDef != null) { if (RPThingMakerUtility.RCPProdValues(MakerThingDef, out _, out var minProd, out var maxProd, out _)) { LabelProduce += "RPThingMaker.ProdLabelRange".Translate(minProd.ToString(), maxProd.ToString()); } else { LabelProduce += "RPThingMaker.ProdLabelERR".Translate(); } } else { LabelProduce += "RPThingMaker.ProdNoThing".Translate(); } }
// Token: 0x06000087 RID: 135 RVA: 0x00005260 File Offset: 0x00003460 public bool ValidateRecipe(ThingDef t, out bool CanUseMax, out List <RCPItemCanUse> FinalList, out int MinProd, out int MaxProd, out int Ticks) { CanUseMax = true; FinalList = null; MinProd = 0; MaxProd = 0; Ticks = 0; if (debug && Find.TickManager.TicksGame % 100 == 0) { Log.Message("ValRep: " + t.defName); } if (!RPThingMakerUtility.RCPProdValues(t, out var ticks, out var minProd, out var maxProd, out var Res)) { return(false); } Ticks = ticks; MinProd = minProd; MaxProd = maxProd; if (debug) { Log.Message( string.Concat("RCPVals: Ticks: ", ticks.ToString(), " minProd: ", minProd.ToString(), " maxProd: ", maxProd.ToString(), " Res: ", Res)); } if (!ResearchProjectDef.Named(Res).IsFinished || minProd <= 0 || maxProd <= 0 || ticks <= 0) { if (!ResearchProjectDef.Named(Res).IsFinished) { Log.Message("RPThingMaker.ErrorRes".Translate(MakerThingDef.label)); isProducing = false; NumProd = 0; ProdWorkTicks = 0; TotalProdWorkTicks = 0; } else { Log.Message( "RPThingMaker.ErrorRCP".Translate(MakerThingDef.label, ticks.ToString(), minProd.ToString(), maxProd.ToString())); isProducing = false; NumProd = 0; ProdWorkTicks = 0; TotalProdWorkTicks = 0; } return(false); } var listRCP = RPThingMakerUtility.GetRCPList(t); if (listRCP.Count <= 0) { if (debug) { Log.Message("RCP is False."); } return(false); } if (debug) { Log.Message("RCP Listings: " + listRCP.Count); } var RCPListPotentials = new List <RCPItemCanUse>(); var RCPGroups = new List <int>(); foreach (var rprcpListItem in listRCP) { var MaterialsMin = 0; var MaterialsMax = 0; var RCPItem = rprcpListItem; var RCPMinNumNeeded = (int)Math.Round(RCPItem.num * minProd * RCPItem.ratio); var RCPMaxNumNeeded = (int)Math.Round(RCPItem.num * maxProd * RCPItem.ratio); if (HasEnoughMaterialInHoppers(RCPItem.def, RCPMinNumNeeded, true)) { MaterialsMin = RCPMinNumNeeded; } if (HasEnoughMaterialInHoppers(RCPItem.def, RCPMaxNumNeeded, false)) { MaterialsMax = RCPMaxNumNeeded; } if (MaterialsMin > 0 || MaterialsMax > 0) { RCPListPotentials.Add(new RCPItemCanUse { def = RCPItem.def, Min = MaterialsMin, Max = MaterialsMax, Grp = RCPItem.mixgrp }); } if (!RCPGroups.Contains(RCPItem.mixgrp)) { RCPGroups.Add(RCPItem.mixgrp); } } if (debug) { Log.Message( "InnerRecipe List: Groups: " + RCPGroups.Count + " , Potentials: " + RCPListPotentials.Count); } FinalList = new List <RCPItemCanUse>(); var NotAllGroups = false; if (RCPGroups.Count > 0) { foreach (var grp in RCPGroups) { var foundGroup = false; if (RCPListPotentials.Count > 0) { var bestthingsofar = default(RCPItemCanUse); var best = false; var bestmax = false; foreach (var itemchk in RCPListPotentials) { if (itemchk.Grp != grp) { continue; } foundGroup = true; if (itemchk.Min <= 0) { continue; } if (itemchk.Max > 0) { if (bestmax) { continue; } bestthingsofar.def = itemchk.def; bestthingsofar.Min = itemchk.Min; bestthingsofar.Max = itemchk.Max; bestthingsofar.Grp = itemchk.Grp; best = true; bestmax = true; } else if (!best) { bestthingsofar.def = itemchk.def; bestthingsofar.Min = itemchk.Min; bestthingsofar.Max = itemchk.Max; bestthingsofar.Grp = itemchk.Grp; best = true; } } if (!bestmax) { bestthingsofar.Max = 0; } FinalList.Add(bestthingsofar); } if (foundGroup) { continue; } NotAllGroups = true; DoNotFoundGroupsOverlay(this, t, grp); } } if (FinalList.Count > 0) { for (var l = 0; l < FinalList.Count; l++) { if (FinalList[l].Max == 0) { CanUseMax = false; } } } if (NotAllGroups) { if (debug) { Log.Message("RCP is False. Not all inputs found"); } return(false); } if (debug) { Log.Message("RCP is True. with (" + FinalList.Count + ") final list items"); } return(true); }