public override void PostDraw() { if (RimBees_Settings.RB_Ben_ShowMissingBees) { Building_Beehouse beehouse = this.parent as Building_Beehouse; var expectingQueens = beehouse.BeehouseIsExpectingQueens; var expectingDrones = beehouse.BeehouseIsExpectingBees; var queenContainer = beehouse.innerContainerQueens; var droneContainer = beehouse.innerContainerDrones; var missingPlant = !beehouse.flagPlants; int offset = 0; if ((queenContainer.NullOrEmpty() && !expectingQueens) || (droneContainer.NullOrEmpty() && !expectingDrones)) { RenderMissingFuelOverlay(DroneMat, ref offset); } else if (compPower != null && !compPower.PowerOn) { var matNoPower = MaterialPool.MatFrom("UI/Overlays/NeedsPower", ShaderDatabase.MetaOverlay); RenderMissingFuelOverlay(matNoPower, ref offset); } else if (missingPlant) { // only one "weird plant" is needed even if both bees require different plants, so if we got here, both are missing. var weirdPlant = BenLubarsRimBeesPatches.GetWeirdPlantDef(queenContainer.FirstOrFallback()) ?? BenLubarsRimBeesPatches.GetWeirdPlantDef(droneContainer.FirstOrFallback()); if (weirdPlant != null) { var mat = MaterialPool.MatFrom(new MaterialRequest(weirdPlant.uiIcon, ShaderDatabase.MetaOverlay)); RenderMissingFuelOverlay(mat, ref offset); } } } if (RimBees_Settings.RB_Ben_ShowProgress) { Building_Beehouse beehouse = this.parent as Building_Beehouse; var averageDays = (float)beehouse.CalculateTheTicksAverage(); if (averageDays > 0f) { var progress = beehouse.tickCounter / (beehouse.ticksToDays * averageDays); GenDraw.DrawFillableBar(new GenDraw.FillableBarRequest { center = parent.DrawPos + ProgressBarOffset, size = ProgressBarSize, fillPercent = progress, margin = 0.1f, rotation = Rot4.North, filledMat = FilledMat, unfilledMat = UnfilledMat, }); } } }
private void AddBeeHyperlinks(ThingDef def, ThingDef other, HashSet <ThingDef> processedCombs) { if (def.descriptionHyperlinks == null) { def.descriptionHyperlinks = new List <DefHyperlink>(); } def.descriptionHyperlinks.Add(other); foreach (var comp in def.comps) { if (CompProperties_Bees.IsInstanceOfType(comp)) { var combDef = DefDatabase <ThingDef> .GetNamed(BenLubarsRimBeesPatches.comb(comp)); def.descriptionHyperlinks.Add(combDef); var weirdPlantName = BenLubarsRimBeesPatches.weirdplantneeded(comp); if (weirdPlantName != "no") { def.descriptionHyperlinks.Add(DefDatabase <ThingDef> .GetNamed(weirdPlantName)); } if (processedCombs.Add(combDef)) { if (combDef.descriptionHyperlinks == null) { combDef.descriptionHyperlinks = new List <DefHyperlink>(); } foreach (var product in combDef.butcherProducts) { combDef.descriptionHyperlinks.Add(product.thingDef); } } break; } } }
private void BackfillSpecies(Thing thing) { var name = BenLubarsRimBeesPatches.GetBeeSpecies(thing); BeeSpeciesData species = new BeeSpeciesData(); try { species = BeeSpecies[BeeSpeciesInv[name]]; } catch (Exception e) { } if (species.Parent1 == null) { return; } if (name == "Amalgam") { LogAttempt("Temperate", "Hybrid", "Amalgam"); LogAttempt("Mild", "Hybrid", "Amalgam"); } else { LogAttempt(species.Parent1, species.Parent2, name); } }