public Designator_PlanMine() { this.defaultLabel = "Plan to Mine"; this.icon = ContentFinder <Texture2D> .Get(itemPath : "MTP/PlanMine"); this.defaultDesc = "Quickly change planning to mining designations"; this.soundDragSustain = SoundDefOf.Designate_DragStandard; this.soundDragChanged = SoundDefOf.Designate_DragStandard_Changed; this.useMouseIcon = true; this.soundSucceeded = SoundDefOf.Designate_Haul; DesignationCategoryDef named = DefDatabase <DesignationCategoryDef> .GetNamed(defName : "Orders"); Type type = named.specialDesignatorClasses.Find(match: x => x == this.GetType()); if (type != null) { return; } named.specialDesignatorClasses.Add(item: this.GetType()); named.ResolveReferences(); DesignationCategoryDef named2 = DefDatabase <DesignationCategoryDef> .GetNamed(defName : "OrdersPlanMine"); List <DesignationCategoryDef> allDefsListForReading = DefDatabase <DesignationCategoryDef> .AllDefsListForReading; allDefsListForReading.Remove(item: named2); DefDatabase <DesignationCategoryDef> .ResolveAllReferences(); }
private static void RecacheDesignationCategory(DesignationCategoryDef category) { category.ResolveReferences(); // calls ResolveDesignators, recreating cache; }