コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }