public static IEnumerable <ThingDef> ImpliedBlueprintAndFrameDefs() { foreach (ThingDef def in DefDatabase <ThingDef> .AllDefs.ToList <ThingDef>()) { ThingDef blueprint = null; if (def.BuildableByPlayer) { blueprint = ThingDefGenerator_Buildings.NewBlueprintDef_Thing(def, false, null); yield return(blueprint); yield return(ThingDefGenerator_Buildings.NewFrameDef_Thing(def)); } if (def.Minifiable) { yield return(ThingDefGenerator_Buildings.NewBlueprintDef_Thing(def, true, blueprint)); } } foreach (TerrainDef terrDef in DefDatabase <TerrainDef> .AllDefs) { if (terrDef.BuildableByPlayer) { yield return(ThingDefGenerator_Buildings.NewBlueprintDef_Terrain(terrDef)); yield return(ThingDefGenerator_Buildings.NewFrameDef_Terrain(terrDef)); } } yield break; }
public static void GenerateImpliedDefs_PreResolve() { IEnumerable <ThingDef> enumerable = ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs()) .Concat(ThingDefGenerator_Leather.ImpliedLeatherDefs()); foreach (ThingDef item in enumerable) { item.PostLoad(); DefDatabase <ThingDef> .Add(item); } DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent); foreach (TerrainDef item2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs()) { item2.PostLoad(); DefDatabase <TerrainDef> .Add(item2); } foreach (RecipeDef item3 in RecipeDefGenerator.ImpliedRecipeDefs()) { item3.PostLoad(); DefDatabase <RecipeDef> .Add(item3); } foreach (PawnColumnDef item4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs()) { item4.PostLoad(); DefDatabase <PawnColumnDef> .Add(item4); } }
private static ThingDef NewFrameDef_Terrain(TerrainDef terrDef) { ThingDef thingDef = ThingDefGenerator_Buildings.BaseFrameDef(); thingDef.defName = ThingDefGenerator_Buildings.BuildingFrameDefNamePrefix + terrDef.defName; thingDef.label = terrDef.label + "FrameLabelExtra".Translate(); thingDef.entityDefToBuild = terrDef; thingDef.useHitPoints = false; thingDef.fillPercent = 0f; thingDef.description = "Terrain building in progress."; thingDef.passability = Traversability.Standable; thingDef.selectable = true; thingDef.constructEffect = terrDef.constructEffect; thingDef.building.isEdifice = false; thingDef.constructionSkillPrerequisite = terrDef.constructionSkillPrerequisite; thingDef.clearBuildingArea = false; thingDef.modContentPack = terrDef.modContentPack; thingDef.category = ThingCategory.Ethereal; thingDef.entityDefToBuild = terrDef; terrDef.frameDef = thingDef; if (!thingDef.IsFrame) { Log.Error("Framedef is not frame: " + thingDef, false); } return(thingDef); }
public static void GenerateImpliedDefs_PreResolve() { foreach (ThingDef item in ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Techprints.ImpliedTechprintDefs()) .Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs())) { AddImpliedDef(item); } DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent); foreach (TerrainDef item2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs()) { AddImpliedDef(item2); } foreach (RecipeDef item3 in RecipeDefGenerator.ImpliedRecipeDefs()) { AddImpliedDef(item3); } foreach (PawnColumnDef item4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs()) { AddImpliedDef(item4); } foreach (ThingDef item5 in NeurotrainerDefGenerator.ImpliedThingDefs()) { AddImpliedDef(item5); } }
public static IEnumerable <ThingDef> ImpliedBlueprintAndFrameDefs() { foreach (ThingDef item in DefDatabase <ThingDef> .AllDefs.ToList()) { ThingDef blueprint2 = null; if (item.designationCategory != null) { blueprint2 = ThingDefGenerator_Buildings.NewBlueprintDef_Thing(item, false, null); yield return(blueprint2); /*Error: Unable to find new state assignment for yield return*/; } if (item.Minifiable) { yield return(ThingDefGenerator_Buildings.NewBlueprintDef_Thing(item, true, blueprint2)); /*Error: Unable to find new state assignment for yield return*/; } } foreach (TerrainDef allDef in DefDatabase <TerrainDef> .AllDefs) { if (allDef.designationCategory != null) { yield return(ThingDefGenerator_Buildings.NewBlueprintDef_Terrain(allDef)); /*Error: Unable to find new state assignment for yield return*/; } } yield break; IL_0226: /*Error near IL_0227: Unexpected return in MoveNext()*/; }
private static ThingDef NewFrameDef_Thing(ThingDef def) { ThingDef thingDef = ThingDefGenerator_Buildings.BaseFrameDef(); thingDef.defName = def.defName + ThingDefGenerator_Buildings.BuildingFrameDefNameSuffix; thingDef.label = def.label + "FrameLabelExtra".Translate(); thingDef.size = def.size; thingDef.SetStatBaseValue(StatDefOf.MaxHitPoints, (float)((float)def.BaseMaxHitPoints * 0.25)); thingDef.SetStatBaseValue(StatDefOf.Beauty, -8f); thingDef.fillPercent = 0.2f; thingDef.pathCost = 10; thingDef.description = def.description; thingDef.passability = def.passability; if ((int)thingDef.passability > 1) { thingDef.passability = Traversability.PassThroughOnly; } thingDef.selectable = def.selectable; thingDef.constructEffect = def.constructEffect; thingDef.building.isEdifice = def.building.isEdifice; thingDef.constructionSkillPrerequisite = def.constructionSkillPrerequisite; thingDef.clearBuildingArea = def.clearBuildingArea; thingDef.drawPlaceWorkersWhileSelected = def.drawPlaceWorkersWhileSelected; if (def.placeWorkers != null) { thingDef.placeWorkers = new List <Type>(def.placeWorkers); } if (def.designationCategory != null) { thingDef.stuffCategories = def.stuffCategories; } thingDef.entityDefToBuild = def; def.frameDef = thingDef; return(thingDef); }
private static ThingDef NewBlueprintDef_Terrain(TerrainDef terrDef) { ThingDef thingDef = ThingDefGenerator_Buildings.BaseBlueprintDef(); thingDef.thingClass = typeof(Blueprint_Build); thingDef.defName = terrDef.defName + ThingDefGenerator_Buildings.BlueprintDefNameSuffix; thingDef.label = terrDef.label + "BlueprintLabelExtra".Translate(); thingDef.entityDefToBuild = terrDef; thingDef.graphicData = new GraphicData(); thingDef.graphicData.shaderType = ShaderType.MetaOverlay; thingDef.graphicData.texPath = ThingDefGenerator_Buildings.TerrainBlueprintGraphicPath; thingDef.graphicData.graphicClass = typeof(Graphic_Single); thingDef.constructionSkillPrerequisite = terrDef.constructionSkillPrerequisite; thingDef.clearBuildingArea = false; thingDef.entityDefToBuild = terrDef; terrDef.blueprintDef = thingDef; return(thingDef); }
public static void GenerateImpliedDefs_PreResolve() { IEnumerable <ThingDef> enumerable = ThingDefGenerator_Buildings.ImpliedBlueprintAndFrameDefs().Concat(ThingDefGenerator_Meat.ImpliedMeatDefs()).Concat(ThingDefGenerator_Corpses.ImpliedCorpseDefs()); foreach (ThingDef current in enumerable) { DefGenerator.AddImpliedDef <ThingDef>(current); } DirectXmlCrossRefLoader.ResolveAllWantedCrossReferences(FailMode.Silent); foreach (TerrainDef current2 in TerrainDefGenerator_Stone.ImpliedTerrainDefs()) { DefGenerator.AddImpliedDef <TerrainDef>(current2); } foreach (RecipeDef current3 in RecipeDefGenerator.ImpliedRecipeDefs()) { DefGenerator.AddImpliedDef <RecipeDef>(current3); } foreach (PawnColumnDef current4 in PawnColumnDefgenerator.ImpliedPawnColumnDefs()) { DefGenerator.AddImpliedDef <PawnColumnDef>(current4); } }
private static ThingDef NewBlueprintDef_Thing(ThingDef def, bool isInstallBlueprint, ThingDef normalBlueprint = null) { ThingDef thingDef = ThingDefGenerator_Buildings.BaseBlueprintDef(); thingDef.defName = ThingDefGenerator_Buildings.BlueprintDefNamePrefix + def.defName; thingDef.label = def.label + "BlueprintLabelExtra".Translate(); thingDef.size = def.size; thingDef.clearBuildingArea = def.clearBuildingArea; thingDef.modContentPack = def.modContentPack; if (!isInstallBlueprint) { thingDef.constructionSkillPrerequisite = def.constructionSkillPrerequisite; } thingDef.drawPlaceWorkersWhileSelected = def.drawPlaceWorkersWhileSelected; if (def.placeWorkers != null) { thingDef.placeWorkers = new List <Type>(def.placeWorkers); } if (isInstallBlueprint) { thingDef.defName = ThingDefGenerator_Buildings.BlueprintDefNamePrefix + ThingDefGenerator_Buildings.InstallBlueprintDefNamePrefix + def.defName; } if (isInstallBlueprint && normalBlueprint != null) { thingDef.graphicData = normalBlueprint.graphicData; } else { thingDef.graphicData = new GraphicData(); if (def.building.blueprintGraphicData != null) { thingDef.graphicData.CopyFrom(def.building.blueprintGraphicData); if (thingDef.graphicData.graphicClass == null) { thingDef.graphicData.graphicClass = typeof(Graphic_Single); } if (thingDef.graphicData.shaderType == null) { thingDef.graphicData.shaderType = ShaderTypeDefOf.Transparent; } thingDef.graphicData.drawSize = def.graphicData.drawSize; thingDef.graphicData.linkFlags = def.graphicData.linkFlags; thingDef.graphicData.linkType = def.graphicData.linkType; thingDef.graphicData.color = ThingDefGenerator_Buildings.BlueprintColor; } else { thingDef.graphicData.CopyFrom(def.graphicData); thingDef.graphicData.shaderType = ShaderTypeDefOf.EdgeDetect; thingDef.graphicData.color = ThingDefGenerator_Buildings.BlueprintColor; thingDef.graphicData.colorTwo = Color.white; thingDef.graphicData.shadowData = null; } } if (thingDef.graphicData.shadowData != null) { Log.Error("Blueprint has shadow: " + def, false); } if (isInstallBlueprint) { thingDef.thingClass = typeof(Blueprint_Install); } else { thingDef.thingClass = def.building.blueprintClass; } if (def.thingClass == typeof(Building_Door)) { thingDef.drawerType = DrawerType.RealtimeOnly; } else { thingDef.drawerType = DrawerType.MapMeshAndRealTime; } thingDef.entityDefToBuild = def; if (isInstallBlueprint) { def.installBlueprintDef = thingDef; } else { def.blueprintDef = thingDef; } return(thingDef); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: enumerator = DefDatabase <ThingDef> .AllDefs.ToList <ThingDef>().GetEnumerator(); num = 4294967293u; break; case 1u: case 2u: case 3u: break; case 4u: case 5u: goto IL_16D; default: return(false); } try { switch (num) { case 1u: this.$current = ThingDefGenerator_Buildings.NewFrameDef_Thing(def); if (!this.$disposing) { this.$PC = 2; } flag = true; return(true); case 2u: break; case 3u: goto IL_12D; default: goto IL_12E; } IL_ED: if (def.Minifiable) { this.$current = ThingDefGenerator_Buildings.NewBlueprintDef_Thing(def, true, blueprint); if (!this.$disposing) { this.$PC = 3; } flag = true; return(true); } IL_12D: IL_12E: if (enumerator.MoveNext()) { def = enumerator.Current; blueprint = null; if (def.BuildableByPlayer) { blueprint = ThingDefGenerator_Buildings.NewBlueprintDef_Thing(def, false, null); this.$current = blueprint; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } goto IL_ED; } } finally { if (!flag) { ((IDisposable)enumerator).Dispose(); } } enumerator2 = DefDatabase <TerrainDef> .AllDefs.GetEnumerator(); num = 4294967293u; try { IL_16D: switch (num) { case 4u: this.$current = ThingDefGenerator_Buildings.NewFrameDef_Terrain(terrDef); if (!this.$disposing) { this.$PC = 5; } flag = true; return(true); } while (enumerator2.MoveNext()) { terrDef = enumerator2.Current; if (terrDef.BuildableByPlayer) { this.$current = ThingDefGenerator_Buildings.NewBlueprintDef_Terrain(terrDef); if (!this.$disposing) { this.$PC = 4; } flag = true; return(true); } } } finally { if (!flag) { if (enumerator2 != null) { enumerator2.Dispose(); } } } this.$PC = -1; return(false); }