public override void DefsLoaded() { base.DefsLoaded(); List <ThingDef> allAnimals = DefUtility.getAnimals(); allAnimals = allAnimals.OrderBy(o => o.defName).ToList(); tabsHandler = Settings.GetHandle <String>("tabs", "GUC_Tabs_Title".Translate(), "", "none"); bodySizeFilter = Settings.GetHandle <float>("bodySizeFilter", "GUC_BodySizeFilter_Title".Translate(), "GUC_BodySizeFilter_Description".Translate(), 0.8f); animalSelecter = Settings.GetHandle <DictAnimalRecordHandler>("Animalselecter", "GUC_Animalselection_Title".Translate(), "GUC_Animalselection_Description".Translate(), getDefaultForAnimalSelecter(allAnimals)); drawSelecter = Settings.GetHandle <DictAnimalRecordHandler>("drawSelecter", "GUC_Drawselection_Title".Translate(), "GUC_Drawselection_Description".Translate(), getDefaultForDrawSelecter(allAnimals)); tabsHandler.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Tabs(rect, tabsHandler, tabNames)); }; bodySizeFilter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Filter(rect, bodySizeFilter, false, 0, 5, highlight1)); }; animalSelecter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, animalSelecter, allAnimals, bodySizeFilter, "GUC_SizeOk".Translate(), "GUC_SizeNotOk".Translate())); }; bodySizeFilter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); }; animalSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); }; drawSelecter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, drawSelecter, allAnimals, null, "GUC_DrawFront".Translate(), "GUC_DrawBack".Translate())); }; drawSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[1]); }; if (animalSelecter.Value == null) { animalSelecter.Value = getDefaultForAnimalSelecter(allAnimals); } if (drawSelecter.Value == null) { drawSelecter.Value = getDefaultForDrawSelecter(allAnimals); } }
public override void DefsLoaded() { base.DefsLoaded(); if (AssemblyExists("GiddyUpMechanoids")) { GiddyUpMechanoidsLoaded = true; } if (AssemblyExists("FacialStuff")) { facialStuffLoaded = true; } List <ThingDef> allAnimals = DefUtility.getAnimals(); allAnimals = allAnimals.OrderBy(o => o.defName).ToList(); handlingMovementImpact = Settings.GetHandle <float>("handlingMovementImpact", "GUC_HandlingMovementImpact_Title".Translate(), "GUC_HandlingMovementImpact_Description".Translate(), 2.5f, Validators.FloatRangeValidator(0f, 10f)); accuracyPenalty = Settings.GetHandle <int>("accuracyPenalty", "GUC_AccuracyPenalty_Title".Translate(), "GUC_AccuracyPenalty_Description".Translate(), 10, Validators.IntRangeValidator(minPercentage, maxPercentage)); handlingAccuracyImpact = Settings.GetHandle <float>("handlingAccuracyImpact", "GUC_HandlingAccuracyImpact_Title".Translate(), "GUC_HandlingAccuracyImpact_Description".Translate(), 0.5f, Validators.FloatRangeValidator(0f, 2f)); tabsHandler = Settings.GetHandle <String>("tabs", "GUC_Tabs_Title".Translate(), "", "none"); bodySizeFilter = Settings.GetHandle <float>("bodySizeFilter", "GUC_BodySizeFilter_Title".Translate(), "GUC_BodySizeFilter_Description".Translate(), 0.8f); animalSelecter = Settings.GetHandle <DictAnimalRecordHandler>("Animalselecter", "GUC_Animalselection_Title".Translate(), "GUC_Animalselection_Description".Translate(), null); drawSelecter = Settings.GetHandle <DictAnimalRecordHandler>("drawSelecter", "GUC_Drawselection_Title".Translate(), "GUC_Drawselection_Description".Translate(), null); tabsHandler.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Tabs(rect, tabsHandler, tabNames)); }; bodySizeFilter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_Filter(rect, bodySizeFilter, false, 0, 5, highlight1)); }; animalSelecter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, animalSelecter, allAnimals, bodySizeFilter, "GUC_SizeOk".Translate(), "GUC_SizeNotOk".Translate())); }; bodySizeFilter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); }; animalSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[0]); }; drawSelecter.CustomDrawer = rect => { return(DrawUtility.CustomDrawer_MatchingAnimals_active(rect, drawSelecter, allAnimals, null, "GUC_DrawFront".Translate(), "GUC_DrawBack".Translate())); }; drawSelecter.VisibilityPredicate = delegate { return(tabsHandler.Value == tabNames[1]); }; DrawUtility.filterAnimals(ref animalSelecter, allAnimals, bodySizeFilter); DrawUtility.filterAnimals(ref drawSelecter, allAnimals, null); foreach (ThingDef td in allAnimals) { if (td.HasModExtension <DrawingOffsetPatch>()) { td.GetModExtension <DrawingOffsetPatch>().Init(); } } foreach (BiomeDef biomeDef in DefDatabase <BiomeDef> .AllDefs) { foreach (PawnKindDef animalKind in biomeDef.AllWildAnimals) { if (!animalsWithBiome.Contains(animalKind)) { animalsWithBiome.Add(animalKind); } } } foreach (PawnKindDef animalWithoutBiome in from d in DefDatabase <PawnKindDef> .AllDefs where d.RaceProps.Animal && !animalsWithBiome.Contains(d) && !animalsWithoutBiome.Contains(d) select d) { animalsWithoutBiome.Add(animalWithoutBiome); } /* * foreach (PawnKindDef pd in DefDatabase<PawnKindDef>.AllDefs) * { * if (pd.HasModExtension<CustomMountsPatch>()) * { * pd.GetModExtension<CustomMountsPatch>().Init(); * } * } */ }