Modding Tutorials/Flooring

From RimWorld Wiki
Revision as of 01:34, 29 April 2014 by Longbyte1 (talk | contribs) (Removed attributes, moved them to TerrainDef)
Jump to navigation Jump to search

< Modding Tutorials

In this tutorial, we're going to be learning how to add your own flooring too the game using the resource which we created in the last tutorial.

Prerequisites

You have completed the Items Tutorial.

You should have read the Getting Started tutorial, which gets you up to speed with how mods are structured in RimWorld. You should also have a good understanding of where files are located (such as About.xml, def XML files, where you should put textures, and so on).

You should also have a look at the TerrainDef article, which should clear up any concerns you have on the attributes we'll be using below.

Making the folders

After you have made your mod folder from the Getting Started tutorial, you will need to create a new folder in which will contain your new flooring xml. Inside your Defs folder create a new subfolder called TerrainDefs. You're now done as far as creating folders go.

Creating the new flooring (Wooden flooring example)

In this example, we'll be making a new wooden flooring using the wood which we created in the last tutorial! Your file should now look like this (if you're making a wood flooring like me) :

<?xml version="1.0" encoding="utf-8" ?>
<TerrainDefs>
	<TerrainDef>
		<defName>WoodFlooring</defName>
		<Label>Wooden Flooring</Label>
		<RenderPrecedence>210</RenderPrecedence>
		<Description>Wooden planks to liven up your lovely colony.</Description>
		<TexturePath>Things/Buildings/Floors/WoodFlooring</TexturePath>
		<Beauty>NiceTiny</Beauty>
		<SurfacesSupported>
			<li>Light</li>
			<li>Heavy</li>
			<li>SmoothHard</li>
		</SurfacesSupported>
		<WorkToBuild>50</WorkToBuild>
		<DesignationCategory>Structure</DesignationCategory>
		<Fertility>0</Fertility>
		<CostList>
			<li>
				<thingDef>Wood</thingDef>
				<count>2</count>
			</li>
		</CostList>
		<ConstructionEffect>ConstructDig</ConstructionEffect>
		<AcceptTerrainSourceFilth>True</AcceptTerrainSourceFilth>
	</TerrainDef>
</TerrainDefs>

Testing

Let’s test our new mod! Fire up RimWorld, making sure to turn on Development mode in the options menu. Open the mods menu and make sure your mod is ticked (For active), and then press the tilde key (~) to check for any errors thrown on runtime. That’s right, no errors! Enjoy your new flooring!

Conclusion

You now know how to:

  • make a simple flooring
  • know most of the terrainDef's global attributes and their functions with the optional choices

Tutorial brought to you by Cala13er, If you have any questions about this tutorial. Message either Cala13er or Tynan on the forums.

Next we'll learn how to make a weapon!