Modding Tutorials/Furniture
Buildings and Furniture are distinct mainly by how tall they are defined. Otherwise, both types of objects are usually usable by colonists. For example, both the Comms Console and the Kitchen Stove are used to perform tasks. But the Comms Console is considered a building because it is taller than a colonist while the Kitchen Stove has a counter that is not as tall as the colonist.
Making Furniture Interactive[edit]
The first thing most modders want to do when they create new furniture or buildings is to make the object interactive. Interactive objects have a yellow circle indicator that shows where the colonist stands when using the object.
The Smelter tutorial is intended to get you started with making interactive buildings that function like work benches.
Building XML Codes[edit]
Common Stuff (needed for all Buildings):
<ThingDef Name="BuildingBase" Abstract="True"> <category>Building</category> <soundImpactDefault>BulletImpactMetal</soundImpactDefault> <selectable>true</selectable> <drawerType>MapMeshAndRealTime</drawerType> <terrainAffordanceNeeded>Light</terrainAffordanceNeeded> <repairEffect>Repair</repairEffect> <leaveResourcesWhenKilled>true</leaveResourcesWhenKilled> <filthLeaving>BuildingRubble</filthLeaving> </ThingDef>
Example Building: Barbed Wire (out of elStrange's DefendThatColony!, modified by Cefwyn):
<ThingDef ParentName="BuildingBase"> <defName>WallWire</defName> <label>Barbed Wire</label> <thingClass>Building</thingClass> <category>Building</category> <description>[DTC!] A cheap and easy defence system that is impassable</description>
The above defines a new object 'WallWire' that inherited all previously defined qualities of the object 'BuildingBase' (see above). In game it will be labeled as 'Barbed Wire', and have the indicated description on mouse-over.
<rotatable>false</rotatable> <selectable>true</selectable> <neverMultiSelect>true</neverMultiSelect> <placingDraggableDimensions>1</placingDraggableDimensions> <terrainAffordanceNeeded>Light</terrainAffordanceNeeded> <designationCategory>Security</designationCategory>
DesignationCategory defines the in-game tab the new building can be found under
<staticSunShadowHeight>0.5</staticSunShadowHeight> <constructEffect>ConstructDirt</constructEffect> <repairEffect>ConstructDirt</repairEffect>
staticSunShadowHeight defines how much of a shadow the strucure casts (Range: 0.0 - 1.0)
<graphicData> <texPath>Things/Buildings/BarbedWire_Atlas</texPath> <graphicClass>Graphic_Single</graphicClass> <linkType>CornerFiller</linkType> <linkFlags> <li>Sandbags</li> </linkFlags> </graphicData>
New in A11:
<graphicData> opens a new strucure that contains the above parts
<texPath> includes the Path to the texture graphic - either graphic already included in the base game, or alternatively included with the mod
<linkFlags> <li>STRUCTURE</li> </linkFlags>
This part defines structures which our Barbed Wire directly connects to.
Options include Walls, Sandbags, Rocks, and more. Just replace STRUCTURE with the desired option.
Add another row with <li>STRUCTURE</li> for each option.
<blueprintGraphicData> <texPath>Things/Building/Linked/Sandbags_Blueprint_Atlas</texPath> </blueprintGraphicData>
This part is also new in A11, and replaces the previous single-line <blueprintgraphicsPath>.
It defines which texture is used to display the planed structure before pawns start building it.
<uiIconPath>Things/Buildings/BarbedWire_Icon</uiIconPath> <statBases> <MaxHitPoints>250</MaxHitPoints> <Beauty>-10</Beauty> <WorkToMake>200</WorkToMake> <Flammability>0</Flammability> </statBases> <pathCost>500</pathCost> <passability>Impassable</passability> <altitudeLayer>FloorEmplacement</altitudeLayer> <castEdgeShadows>false</castEdgeShadows> <fillPercent>0.3</fillPercent> <costList> <WoodLog>1</WoodLog> <Steel>1</Steel> </costList> </ThingDef>