Ghost Graphic Extension - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

GhostGraphicExtension allows you to configure what will be displayed as your building's ghost (for example, while placing it). It's a continuation of the now obsolete ShowBlueprintExtension.

How to use this code?

It is a def extension, so you just add it in XML in the <modExtensions> tag.

Here's a slightly modified example from Vanilla Furniture Expanded - Security:

<modExtensions>
	<li Class="VEF.Buildings.GhostGraphicExtension">
		<!-- Main building graphic. The main graphic, as well as all styled graphics should fall under this. -->
		<!-- Certain building types and comps aren't supported, like power switch. -->
		<ghostMode>CustomGraphicPath</ghostMode>
		<!-- customGraphicData is only used when ghostMode is set to CustomGraphicPath. -->
		<customGraphicData>
			<!-- Graphic to use as a replacement. Required to work. -->
			<texPath>NewThings/Security/ComplexBarricade_Base</texPath>
			<!-- Graphic class that will be used for the ghost. Defaults to Graphic_Single. -->
			<graphicClass>Graphic_Single</graphicClass>
			<!-- If specified, this will be used for the ghost's draw size rather than using the value of its ThingDef. -->
			<drawSize>(3,3)</drawSize>
			<!-- If specified, this will enable/disable rotation rather than using the value of its ThingDef. -->
			<drawRotated>false</drawRotated>
			<!-- If specified, this will enable/disable flipping of the graphic rather than using the value of its ThingDef. -->
			<allowFlip>false</allowFlip>
		</customGraphicData>

		<!-- Extra building graphics. One example of such graphic would be be top of the turret. -->
		<!-- Certain graphics from some buildings, like power switch, will also fall under this category. -->
		<extraGraphicGhostMode>CustomGraphicPath</extraGraphicGhostMode>
		<!-- extraCustomGraphicDatais only used when extraGraphicGhostModeis set to CustomGraphicPath. -->
		<extraCustomGraphicData>
			<!-- For more details, check explanation in customGraphicData above. -->
			<texPath>NewThings/Security/ComplexBarricade_Base</texPath>
			<graphicClass>Graphic_Single</graphicClass>
			<drawSize>(3,3)</drawSize>
			<drawRotated>false</drawRotated>
			<allowFlip>false</allowFlip>
		</extraCustomGraphicData>
	</li>
</modExtensions>

Here's a simple example that works the same as ShowBlueprintExtension:

<modExtensions>
	<li Class="VEF.Buildings.GhostGraphicExtension">
		<!-- For more details, check the explanation in the example above. -->
		<ghostMode>Blueprint</ghostMode>
		<extraGraphicGhostMode>Blueprint</extraGraphicGhostMode>
	</li>
</modExtensions>

What can I use for ghostMode and extraGraphicGhostMode

Both ghostMode and extraGraphicGhostMode support several possible values. Those are:

  • Vanilla
    • Let vanilla handle it (no replacement at all).
  • VanillaNoLinking
    • Same as vanilla, but don't allow for linking graphics. Useful for non-main graphics like turret tops, since vanilla will treat those as linked graphics.
  • Blueprint
  • CustomGraphicPath
    • Use custom graphic, either from customGraphicPath or extraCustomGraphicPath.
  • CustomGraphicMethodCached
    • Uses the GetCustomGraphic method (requires custom C# code). Guaranteed to never change and result will be cached.
  • CustomGraphicMethodNotCached
    • Uses the GetCustomGraphic method (requires custom C# code). It may change, so it'll never be cached.
⚠️ **GitHub.com Fallback** ⚠️