<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rimworldwiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alistaire</id>
	<title>RimWorld Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://rimworldwiki.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Alistaire"/>
	<link rel="alternate" type="text/html" href="https://rimworldwiki.com/wiki/Special:Contributions/Alistaire"/>
	<updated>2026-04-08T11:45:45Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.8</generator>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Topic:Vrbkob5ggehrr5al&amp;topic_postId=w1ek47pq7eyc76vh&amp;topic_revId=w1ek47pq7eyc76vh&amp;action=single-view</id>
		<title>Topic:Vrbkob5ggehrr5al</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Topic:Vrbkob5ggehrr5al&amp;topic_postId=w1ek47pq7eyc76vh&amp;topic_revId=w1ek47pq7eyc76vh&amp;action=single-view"/>
		<updated>2021-01-12T21:03:53Z</updated>

		<summary type="html">&lt;span class=&quot;plainlinks&quot;&gt;&lt;a href=&quot;/wiki/User:Alistaire&quot; class=&quot;mw-userlink&quot; title=&quot;User:Alistaire&quot;&gt;&lt;bdi&gt;Alistaire&lt;/bdi&gt;&lt;/a&gt; &lt;span class=&quot;mw-usertoollinks&quot;&gt;(&lt;a href=&quot;/wiki/User_talk:Alistaire&quot; class=&quot;mw-usertoollinks-talk&quot; title=&quot;User talk:Alistaire&quot;&gt;talk&lt;/a&gt; | &lt;a href=&quot;/wiki/Special:Contributions/Alistaire&quot; class=&quot;mw-usertoollinks-contribs&quot; title=&quot;Special:Contributions/Alistaire&quot;&gt;contribs&lt;/a&gt;)&lt;/span&gt; &lt;a rel=&quot;nofollow&quot; class=&quot;external text&quot; href=&quot;https://rimworldwiki.com/index.php?title=Topic:Vrbkob5ggehrr5al&amp;amp;topic_showPostId=w1ek47pq7eyc76vh#flow-post-w1ek47pq7eyc76vh&quot;&gt;commented&lt;/a&gt; on &quot;Question:&quot; (&lt;em&gt;How are you supposed to cut something with a wood knife&lt;/em&gt;)&lt;/span&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=56654</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=56654"/>
		<updated>2018-06-04T21:18:06Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Sharpdevelop */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* The manual option in this tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]] (the Visual Studio automatic option sets this up for you).&lt;br /&gt;
* You will want to have an IDE installed: [[Modding Tutorials/Recommended software#IDE's|Recommended IDE's]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Visual Studio Community 2017===&lt;br /&gt;
''NOTE: Visual Studio 2017 is a rather heavy application (2-3 GB for basic functionality) but has a bit more functionality. Only Install if your computer can handle it! The tutorial is similar for Visual Studio 2015.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Option 1 (Manual Method):====&lt;br /&gt;
# Create a new class library project&lt;br /&gt;
## Once loaded, go to File -&amp;gt; New -&amp;gt; Project...&lt;br /&gt;
## Go to Templates -&amp;gt; Visual C# -&amp;gt; Class Library (Be sure to select the *.NET Framework* version, not *.NET Standard*) [[File:Capture.png|200px|thumb|right|Installing the .NET framework]]&lt;br /&gt;
## Enter your name and solution name in the lower pane.&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create directory for solution&amp;quot;&lt;br /&gt;
# In your project, set target framework and various other porperties&lt;br /&gt;
## In your Solution Explorer, right click your project -&amp;gt; Properties&lt;br /&gt;
## Once in your properties, select Application -&amp;gt; Set Target Framework to .NET Framework 3.5 (No client profile)&lt;br /&gt;
## ''Optional'': Change your Assembly and Namespace names to anything of your choice&lt;br /&gt;
## Go to Build -&amp;gt; Advanced... and set &amp;quot;Debugging information&amp;quot; to none&lt;br /&gt;
## Leave Advanced..., and set the Output Path to &amp;quot;..\..\Assemblies\&amp;quot; (The Assemblies folder in your mod folder)&lt;br /&gt;
# Add references to RimWorld code&lt;br /&gt;
## Expand your project. Then right click &amp;quot;References&amp;quot; -&amp;gt; Add Reference...&lt;br /&gt;
## Click Browse...&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Add&amp;quot;&lt;br /&gt;
## Right click on both Assembly-CSharp.dll and UnityEngine.dll and set Copy Local to False (Properties pane).&lt;br /&gt;
&lt;br /&gt;
====Option 2 (Automatic Method):====&lt;br /&gt;
# Open Visual Studio&lt;br /&gt;
# Once loaded, go to File -&amp;gt; New -&amp;gt; From Cookiecutter...&lt;br /&gt;
# Search for ''rimworld''&lt;br /&gt;
# Double-click ''cookiecutter-rimworld-mod-development''&lt;br /&gt;
# Change the Template Options:&lt;br /&gt;
## ''Create To'' =&amp;gt; ''Your/Rimworld/Mod/Directory''&lt;br /&gt;
## ''mod_name''&lt;br /&gt;
## ''namespace_name'' (don't change if unsure)&lt;br /&gt;
## ''author'' =&amp;gt; ''your steam username''&lt;br /&gt;
## ''target_version'' =&amp;gt; current RW version (can leave blank for most up-to-date)&lt;br /&gt;
## ''in_game_description'' (not required, can change later in About-Release.xml)&lt;br /&gt;
## ''url'' (can leave blank for link to your Steam Workshop profile)&lt;br /&gt;
# Click &amp;quot;Create and Open Folder&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
'''Caution:''' Sharpdevelop (or #develop) does NOT CURRENTLY allow for C# 6.0+ syntax without plugins and does NOT ALLOW for C# 7.0+ syntax at all. For your average project this does not matter, however some existing projects are already built entirely upon C# 6.0+ syntax which can not be compiled anymore in Sharpdevelop. Visual Studio does not have these issues and should be your go-to for compiling large projects such as Combat Extended.&lt;br /&gt;
&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse...&amp;quot;;&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Open&amp;quot; then &amp;quot;OK&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Debug info&amp;quot; and choose &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to output&amp;quot; (If you haven't resized the properties bar, this will be truncated to &amp;quot;Copy to out&amp;quot;) to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Output path&amp;quot; and change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Xamarin===&lt;br /&gt;
The setup is similar as the one above. A few special points to address:&lt;br /&gt;
# Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against .NET3.5 dlls.&lt;br /&gt;
# Make sure you uncheck &amp;quot;Use MSBuild build engine (recommended for this project type)&amp;quot; under project &amp;gt; options &amp;gt; build &amp;gt; general&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===macOS===&lt;br /&gt;
There is no best practice for modding on a Mac since Xamarin is not backwards compatible with .Net3.5. That said, there is a very practical way around this by virtualizing Visual Studio and ILSpy on macOS with VirtualBox. This approach allows the use of macOS or Windows development tools, but relies on Visual Studio for compilation.&lt;br /&gt;
# [https://github.com/roxxploxx/RimWorldModGuide/wiki/SHORTTUTORIAL%3A-Mac-Modding-HowTo Mac Modding HowTo]&lt;br /&gt;
# Follow the above steps for Visual Studio&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=56653</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=56653"/>
		<updated>2018-06-04T21:17:33Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Sharpdevelop */ Warning on use&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* The manual option in this tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]] (the Visual Studio automatic option sets this up for you).&lt;br /&gt;
* You will want to have an IDE installed: [[Modding Tutorials/Recommended software#IDE's|Recommended IDE's]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Visual Studio Community 2017===&lt;br /&gt;
''NOTE: Visual Studio 2017 is a rather heavy application (2-3 GB for basic functionality) but has a bit more functionality. Only Install if your computer can handle it! The tutorial is similar for Visual Studio 2015.''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Option 1 (Manual Method):====&lt;br /&gt;
# Create a new class library project&lt;br /&gt;
## Once loaded, go to File -&amp;gt; New -&amp;gt; Project...&lt;br /&gt;
## Go to Templates -&amp;gt; Visual C# -&amp;gt; Class Library (Be sure to select the *.NET Framework* version, not *.NET Standard*) [[File:Capture.png|200px|thumb|right|Installing the .NET framework]]&lt;br /&gt;
## Enter your name and solution name in the lower pane.&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create directory for solution&amp;quot;&lt;br /&gt;
# In your project, set target framework and various other porperties&lt;br /&gt;
## In your Solution Explorer, right click your project -&amp;gt; Properties&lt;br /&gt;
## Once in your properties, select Application -&amp;gt; Set Target Framework to .NET Framework 3.5 (No client profile)&lt;br /&gt;
## ''Optional'': Change your Assembly and Namespace names to anything of your choice&lt;br /&gt;
## Go to Build -&amp;gt; Advanced... and set &amp;quot;Debugging information&amp;quot; to none&lt;br /&gt;
## Leave Advanced..., and set the Output Path to &amp;quot;..\..\Assemblies\&amp;quot; (The Assemblies folder in your mod folder)&lt;br /&gt;
# Add references to RimWorld code&lt;br /&gt;
## Expand your project. Then right click &amp;quot;References&amp;quot; -&amp;gt; Add Reference...&lt;br /&gt;
## Click Browse...&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Add&amp;quot;&lt;br /&gt;
## Right click on both Assembly-CSharp.dll and UnityEngine.dll and set Copy Local to False (Properties pane).&lt;br /&gt;
&lt;br /&gt;
====Option 2 (Automatic Method):====&lt;br /&gt;
# Open Visual Studio&lt;br /&gt;
# Once loaded, go to File -&amp;gt; New -&amp;gt; From Cookiecutter...&lt;br /&gt;
# Search for ''rimworld''&lt;br /&gt;
# Double-click ''cookiecutter-rimworld-mod-development''&lt;br /&gt;
# Change the Template Options:&lt;br /&gt;
## ''Create To'' =&amp;gt; ''Your/Rimworld/Mod/Directory''&lt;br /&gt;
## ''mod_name''&lt;br /&gt;
## ''namespace_name'' (don't change if unsure)&lt;br /&gt;
## ''author'' =&amp;gt; ''your steam username''&lt;br /&gt;
## ''target_version'' =&amp;gt; current RW version (can leave blank for most up-to-date)&lt;br /&gt;
## ''in_game_description'' (not required, can change later in About-Release.xml)&lt;br /&gt;
## ''url'' (can leave blank for link to your Steam Workshop profile)&lt;br /&gt;
# Click &amp;quot;Create and Open Folder&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
Sharpdevelop (or #develop) does NOT CURRENTLY allow for C# 6.0+ syntax without plugins and does NOT ALLOW for C# 7.0+ syntax at all. For your average project this does not matter, however some existing projects are already built entirely upon C# 6.0+ syntax which can not be compiled anymore in Sharpdevelop. Visual Studio does not have these issues and should be your go-to for compiling large projects such as Combat Extended.&lt;br /&gt;
&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse...&amp;quot;;&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Open&amp;quot; then &amp;quot;OK&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Debug info&amp;quot; and choose &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to output&amp;quot; (If you haven't resized the properties bar, this will be truncated to &amp;quot;Copy to out&amp;quot;) to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Output path&amp;quot; and change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Xamarin===&lt;br /&gt;
The setup is similar as the one above. A few special points to address:&lt;br /&gt;
# Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against .NET3.5 dlls.&lt;br /&gt;
# Make sure you uncheck &amp;quot;Use MSBuild build engine (recommended for this project type)&amp;quot; under project &amp;gt; options &amp;gt; build &amp;gt; general&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===macOS===&lt;br /&gt;
There is no best practice for modding on a Mac since Xamarin is not backwards compatible with .Net3.5. That said, there is a very practical way around this by virtualizing Visual Studio and ILSpy on macOS with VirtualBox. This approach allows the use of macOS or Windows development tools, but relies on Visual Studio for compilation.&lt;br /&gt;
# [https://github.com/roxxploxx/RimWorldModGuide/wiki/SHORTTUTORIAL%3A-Mac-Modding-HowTo Mac Modding HowTo]&lt;br /&gt;
# Follow the above steps for Visual Studio&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=48518</id>
		<title>Modding Tutorials/Writing custom code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=48518"/>
		<updated>2017-05-13T08:18:28Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Writing code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:TheTynan|TheTynan]]|extra=1}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial gives you a broad idea how to work on a C# solution.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a class=&lt;br /&gt;
&amp;lt;!--  ### THE FOLLOWING TEXT was stripped from the page because it's not in line with the tone of the article&lt;br /&gt;
&lt;br /&gt;
In addition to creating data for the game to use, you can also write code. You could probably write in any .NET language, but I’ve only tested C#.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
&lt;br /&gt;
When you start your software you'll see a '''Projects''' file explorer to the left, a '''Properties''' explorer to the right and currently opened files in the middle.&lt;br /&gt;
&lt;br /&gt;
* With your solution open, create a new class inside your '''Projects''' explorer;&lt;br /&gt;
*# If you don't have [[Modding Tutorials/Setting up a solution|your solution]] open you can do so by clicking File -&amp;gt; Open -&amp;gt; Project/Solution.. or by choosing a recent project on the '''Start page''' in the middle;&lt;br /&gt;
*# If it's not expanded, click the + next to &amp;quot;Solution ''MySolutionName''&amp;quot;. Right-click ''MyProjectName'' (this could be the same as ''MySolutionName'' or different, depending on how you set up the solution);&lt;br /&gt;
*# Select Add -&amp;gt; New Item.. -&amp;gt; '''Categories:''' C# -&amp;gt; '''Templates:''' Class -&amp;gt; '''File Name:''' ''MyClassName''.cs,&lt;br /&gt;
&lt;br /&gt;
====Template====&lt;br /&gt;
&lt;br /&gt;
Let's go over the template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;/*&lt;br /&gt;
 * Created by SharpDevelop.&lt;br /&gt;
 * User: You&lt;br /&gt;
 * Date: 01-01-1970&lt;br /&gt;
 * Time: 00:00&lt;br /&gt;
 * &lt;br /&gt;
 * To change this template use Tools | Options | Coding | Edit Standard Headers.&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Description of MyClassName.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	public class MyClassName&lt;br /&gt;
	{&lt;br /&gt;
		public MyClassName()&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using====&lt;br /&gt;
&lt;br /&gt;
The first thing you notice is ''using System;'' which indicates this class can call anything from the namespace ''System'' without calling it like ''System.Class.SomeDataType'' but rather ''SomeDataType''. This is very useful because we don't have to worry about such calls anymore (for now).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next section shows which namespaces you could put in ''using''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Namespace====&lt;br /&gt;
&lt;br /&gt;
Next up is the ''namespace MyNameSpace'' part - in principle everything inside of a namespace knows everything else inside of that namespace. If you were to make a folder inside of your project (''MyProjectName'' not Solution ''MySolutionName''), any classes inside of that folder would have the namespace ''MyNameSpace.MyFolderName''. '''That's a different namespace''' and unless you tell other classes that it exists (''using MyNameSpace.MyFolderName;'') they won't accept calls to parts of that namespace without that namespace as a prefix.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anything inside of ''MyNameSpace.MyFolderName'' does however know of everything inside ''MyNameSpace'', just nothing about other subfolders of ''MyNameSpace''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default your project knows nothing. Adding DLL references to the ''References'' folder (as done in the previous tutorial) allows you to reference them with ''using'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
namespace MyNameSpace {}		/* Assuming MyNameSpace is your ROOT NAMESPACE (MyProjectName -&amp;gt;&lt;br /&gt;
					Properties -&amp;gt; Application -&amp;gt; Root namespace), this will compile. */&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace.MyFolderName {}	/* Assuming this class is inside of the folder MyFolderName inside of&lt;br /&gt;
					MyProjectName, this will compile. Other classes outside of the folder&lt;br /&gt;
					will have to reference this, this class will have to reference classes&lt;br /&gt;
					in different subfolders (but not the ones in the root folder). */&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld {}			/* Don't do this. It will compile if RimWorld is your root namespace&lt;br /&gt;
					but it's bad practice. */&lt;br /&gt;
&lt;br /&gt;
namespace System {}			/* No, just no. */&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can set your project's namespace by right-clicking MyProjectName -&amp;gt; Properties -&amp;gt; Application -&amp;gt; Root namespace. Please take some time to make it unique so no compatibility issues will arise with other mods, for your and everyone else's sanity.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some very useful namespaces in general are the following:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections.Generic || Makes it so you can use part of the IEnumerable interface, which is used for datatypes like List&amp;lt;&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| System.Linq || Allows for cool operations on the IEnumerable interface such as ''.Where()'' which accepts lambda operations (oh my!).&lt;br /&gt;
|-&lt;br /&gt;
| System.Text.RegularExpressions || Introduces Regular Expressions (RegEx) to C# which allows for intricate operations on strings.&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections || Holds other parts of the IEnumerable interface you will require when inheriting from that class.&lt;br /&gt;
|-&lt;br /&gt;
| System.Text || Contains the ''StringBuilder'' which accepts a list of strings and returns them in a specific way.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the namespaces for RimWorld in particular are these:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld || Many classes can be found in this namespace.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.Planet || Everything (almost everything) having to do with the planet savefile is in here.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.SquadAI || Holds the squad AI, clearly. You'll know it when you need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse || Sometimes more complex classes are found here.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.AI || You might never have to touch this either.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Grammar || Contains functionality for the Languages folder and other things having to do with text operations such as the art flavour text generator.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Noise || Something something you'll never need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Sound || Much like Verse.Noise except it's required to play sounds directly with your code.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Steam || Steam integration by Tynan - it's not active so you won't need it.&lt;br /&gt;
|-&lt;br /&gt;
| UnityEngine || Contains many more methods you most likely won't need.&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between RimWorld and Verse is not very clear and you might as well add both using statements whenever you want.&amp;lt;br/&amp;gt;&lt;br /&gt;
If you want to use the exact functionality of a base game class you're best off copying all its ''using'' statements, its ''namespace'' and the namespace of its parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Summary====&lt;br /&gt;
&lt;br /&gt;
This summary is part of the template but it's not required. It can help other people understand your code better when you provide the source but besides that you really don't need it.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class and Constructor====&lt;br /&gt;
&lt;br /&gt;
This is your class definition. To access anything inside of a ''public class'' you will need a reference to an instance of that class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
MyClassNamefoo = new MyClassName();&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brackets at ''new MyClassName()'' indicate you're creating this instance without ''parameters'' which is possible because your class contains a constructor (anything inside of ''class MyClassName'' which has parameters and isn't a method, often abbreviated '''.ctor''') which accepts a call without parameters:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class MyClassName&lt;br /&gt;
{&lt;br /&gt;
	public MyClassName()	/* No parameters */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo, int bar)	/* Required parameters of datatypes string and int */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo = &amp;quot;none supplied&amp;quot;, int bar = 42)	/* Default parameters &amp;quot; &amp;quot; &amp;quot; */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last implementation of the constructor (''MyNameSpace.MyClassName.MyClassName'' inside of ''MyNameSpace.MyClassName'') is capable of accepting zero to two parameters while the second implementation of the constructor will only accept calls with exactly two parameters.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing code=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/Decompiling source code|Decompile source code]] to take a look at the game's existing code;&lt;br /&gt;
## If you get stuck on anything, any modding questions can be asked on the [https://ludeon.com/forums/index.php?board=14.0 subforum],&lt;br /&gt;
# Compile your class into a .dll;&lt;br /&gt;
## Most IDE's, integrated development environments, have a button that says &amp;quot;Compile&amp;quot; or you could press F5 or a similar hotkey. Compiling is entirely driven by the software, you only have to supply a location for it to compile to - as explained in [[Modding Tutorials/Setting up a solution|Setting up a solution]].&lt;br /&gt;
## Make sure your project's output type is &amp;quot;class library&amp;quot;;&lt;br /&gt;
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem,&lt;br /&gt;
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;&lt;br /&gt;
## '''Example:''' Create a new ThingDef with a &amp;lt;thingClass&amp;gt; that points to a class in your .dll,&lt;br /&gt;
# The game should load your class now;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod.&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=48517</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=48517"/>
		<updated>2017-05-13T08:17:22Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Visual Studio Community 2017 */ Removed the unrelated text about .NET 7.0 and the comparison to SharpDevelop, fixed the note being in italics&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]].&lt;br /&gt;
* You will want to have an IDE installed: [[Modding Tutorials/Recommended software#IDE's|Recommended IDE's]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Visual Studio Community 2017===&lt;br /&gt;
''NOTE: Visual Studio 2017 is a rather heavy application (2-3 GB for basic functionality) but has a bit more functionality. Only Install if your computer can handle it! The tutorial is similar for Visual Studio 2015.''&lt;br /&gt;
# Create a new class library project&lt;br /&gt;
## Once loaded, go to File -&amp;gt; New -&amp;gt; Project...&lt;br /&gt;
## Go to Templates -&amp;gt; Visual C# -&amp;gt; Class Library (.NET Framework if applicable)&lt;br /&gt;
## Enter your name and solution name in the lower pane.&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create directory for solution&amp;quot;&lt;br /&gt;
# In your project, set target framework and various other porperties&lt;br /&gt;
## In your Solution Explorer, right click your project -&amp;gt; Properties&lt;br /&gt;
## Once in your properties, select Application -&amp;gt; Set Target Framework to .NET Framework 3.5 (No client profile)&lt;br /&gt;
## ''Optional'': Change your Assembly and Namespace names to anything of your choice&lt;br /&gt;
## Go to Build -&amp;gt; Advanced... -&amp;gt; Debugging information and set it to none&lt;br /&gt;
## Leave Advanced..., and set the Output Path to &amp;quot;..\..\Assemblies\&amp;quot; (The Assemblies folder in your mod folder)&lt;br /&gt;
# Add references to RimWorld code&lt;br /&gt;
## Expand your project. Then right click &amp;quot;References&amp;quot; -&amp;gt; Add Reference...&lt;br /&gt;
## Click Browse...&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Add&amp;quot;&lt;br /&gt;
## Right click on both Assembly-CSharp.dll and UnityEngine.dll and set Copy Local to False (Properties pane).&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse...&amp;quot;;&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Open&amp;quot; then &amp;quot;OK&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Debug info&amp;quot; and choose &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to output&amp;quot; (If you haven't resized the properties bar, this will be truncated to &amp;quot;Copy to out&amp;quot;) to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Output path&amp;quot; and change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Xamarin===&lt;br /&gt;
The setup is similar as the one above. A few special points to address:&lt;br /&gt;
# Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against .NET3.5 dlls.&lt;br /&gt;
# Make sure you uncheck &amp;quot;Use MSBuild build engine (recommended for this project type)&amp;quot; under project &amp;gt; options &amp;gt; build &amp;gt; general&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=48516</id>
		<title>Modding Tutorials/Writing custom code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=48516"/>
		<updated>2017-05-13T08:15:11Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Writing code */ Additional explanation on compiling&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:TheTynan|TheTynan]]|extra=1}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial gives you a broad idea how to work on a C# solution.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a class=&lt;br /&gt;
&amp;lt;!--  ### THE FOLLOWING TEXT was stripped from the page because it's not in line with the tone of the article&lt;br /&gt;
&lt;br /&gt;
In addition to creating data for the game to use, you can also write code. You could probably write in any .NET language, but I’ve only tested C#.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
&lt;br /&gt;
When you start your software you'll see a '''Projects''' file explorer to the left, a '''Properties''' explorer to the right and currently opened files in the middle.&lt;br /&gt;
&lt;br /&gt;
* With your solution open, create a new class inside your '''Projects''' explorer;&lt;br /&gt;
*# If you don't have [[Modding Tutorials/Setting up a solution|your solution]] open you can do so by clicking File -&amp;gt; Open -&amp;gt; Project/Solution.. or by choosing a recent project on the '''Start page''' in the middle;&lt;br /&gt;
*# If it's not expanded, click the + next to &amp;quot;Solution ''MySolutionName''&amp;quot;. Right-click ''MyProjectName'' (this could be the same as ''MySolutionName'' or different, depending on how you set up the solution);&lt;br /&gt;
*# Select Add -&amp;gt; New Item.. -&amp;gt; '''Categories:''' C# -&amp;gt; '''Templates:''' Class -&amp;gt; '''File Name:''' ''MyClassName''.cs,&lt;br /&gt;
&lt;br /&gt;
====Template====&lt;br /&gt;
&lt;br /&gt;
Let's go over the template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;/*&lt;br /&gt;
 * Created by SharpDevelop.&lt;br /&gt;
 * User: You&lt;br /&gt;
 * Date: 01-01-1970&lt;br /&gt;
 * Time: 00:00&lt;br /&gt;
 * &lt;br /&gt;
 * To change this template use Tools | Options | Coding | Edit Standard Headers.&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Description of MyClassName.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	public class MyClassName&lt;br /&gt;
	{&lt;br /&gt;
		public MyClassName()&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using====&lt;br /&gt;
&lt;br /&gt;
The first thing you notice is ''using System;'' which indicates this class can call anything from the namespace ''System'' without calling it like ''System.Class.SomeDataType'' but rather ''SomeDataType''. This is very useful because we don't have to worry about such calls anymore (for now).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next section shows which namespaces you could put in ''using''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Namespace====&lt;br /&gt;
&lt;br /&gt;
Next up is the ''namespace MyNameSpace'' part - in principle everything inside of a namespace knows everything else inside of that namespace. If you were to make a folder inside of your project (''MyProjectName'' not Solution ''MySolutionName''), any classes inside of that folder would have the namespace ''MyNameSpace.MyFolderName''. '''That's a different namespace''' and unless you tell other classes that it exists (''using MyNameSpace.MyFolderName;'') they won't accept calls to parts of that namespace without that namespace as a prefix.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anything inside of ''MyNameSpace.MyFolderName'' does however know of everything inside ''MyNameSpace'', just nothing about other subfolders of ''MyNameSpace''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default your project knows nothing. Adding DLL references to the ''References'' folder (as done in the previous tutorial) allows you to reference them with ''using'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
namespace MyNameSpace {}		/* Assuming MyNameSpace is your ROOT NAMESPACE (MyProjectName -&amp;gt;&lt;br /&gt;
					Properties -&amp;gt; Application -&amp;gt; Root namespace), this will compile. */&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace.MyFolderName {}	/* Assuming this class is inside of the folder MyFolderName inside of&lt;br /&gt;
					MyProjectName, this will compile. Other classes outside of the folder&lt;br /&gt;
					will have to reference this, this class will have to reference classes&lt;br /&gt;
					in different subfolders (but not the ones in the root folder). */&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld {}			/* Don't do this. It will compile if RimWorld is your root namespace&lt;br /&gt;
					but it's bad practice. */&lt;br /&gt;
&lt;br /&gt;
namespace System {}			/* No, just no. */&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can set your project's namespace by right-clicking MyProjectName -&amp;gt; Properties -&amp;gt; Application -&amp;gt; Root namespace. Please take some time to make it unique so no compatibility issues will arise with other mods, for your and everyone else's sanity.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some very useful namespaces in general are the following:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections.Generic || Makes it so you can use part of the IEnumerable interface, which is used for datatypes like List&amp;lt;&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| System.Linq || Allows for cool operations on the IEnumerable interface such as ''.Where()'' which accepts lambda operations (oh my!).&lt;br /&gt;
|-&lt;br /&gt;
| System.Text.RegularExpressions || Introduces Regular Expressions (RegEx) to C# which allows for intricate operations on strings.&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections || Holds other parts of the IEnumerable interface you will require when inheriting from that class.&lt;br /&gt;
|-&lt;br /&gt;
| System.Text || Contains the ''StringBuilder'' which accepts a list of strings and returns them in a specific way.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the namespaces for RimWorld in particular are these:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld || Many classes can be found in this namespace.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.Planet || Everything (almost everything) having to do with the planet savefile is in here.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.SquadAI || Holds the squad AI, clearly. You'll know it when you need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse || Sometimes more complex classes are found here.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.AI || You might never have to touch this either.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Grammar || Contains functionality for the Languages folder and other things having to do with text operations such as the art flavour text generator.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Noise || Something something you'll never need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Sound || Much like Verse.Noise except it's required to play sounds directly with your code.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Steam || Steam integration by Tynan - it's not active so you won't need it.&lt;br /&gt;
|-&lt;br /&gt;
| UnityEngine || Contains many more methods you most likely won't need.&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between RimWorld and Verse is not very clear and you might as well add both using statements whenever you want.&amp;lt;br/&amp;gt;&lt;br /&gt;
If you want to use the exact functionality of a base game class you're best off copying all its ''using'' statements, its ''namespace'' and the namespace of its parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Summary====&lt;br /&gt;
&lt;br /&gt;
This summary is part of the template but it's not required. It can help other people understand your code better when you provide the source but besides that you really don't need it.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class and Constructor====&lt;br /&gt;
&lt;br /&gt;
This is your class definition. To access anything inside of a ''public class'' you will need a reference to an instance of that class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
MyClassNamefoo = new MyClassName();&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brackets at ''new MyClassName()'' indicate you're creating this instance without ''parameters'' which is possible because your class contains a constructor (anything inside of ''class MyClassName'' which has parameters and isn't a method, often abbreviated '''.ctor''') which accepts a call without parameters:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class MyClassName&lt;br /&gt;
{&lt;br /&gt;
	public MyClassName()	/* No parameters */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo, int bar)	/* Required parameters of datatypes string and int */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo = &amp;quot;none supplied&amp;quot;, int bar = 42)	/* Default parameters &amp;quot; &amp;quot; &amp;quot; */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last implementation of the constructor (''MyNameSpace.MyClassName.MyClassName'' inside of ''MyNameSpace.MyClassName'') is capable of accepting zero to two parameters while the second implementation of the constructor will only accept calls with exactly two parameters.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing code=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/Decompiling source code|Decompile source code]] to take a look at the game's existing code;&lt;br /&gt;
## If you get stuck on anything, any modding questions can be asked on the [https://ludeon.com/forums/index.php?board=14.0 subforum],&lt;br /&gt;
# Compile your class into a .dll;&lt;br /&gt;
## Most IDE's, integrated development environments, have a button that says &amp;quot;Compile&amp;quot; or you could press F5 or a similar hotkey. Compiling is entirely driven by the software, you only have to supply a location for it to compile to.&lt;br /&gt;
## Make sure your project's output type is &amp;quot;class library&amp;quot;;&lt;br /&gt;
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem,&lt;br /&gt;
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;&lt;br /&gt;
## '''Example:''' Create a new ThingDef with a &amp;lt;thingClass&amp;gt; that points to a class in your .dll,&lt;br /&gt;
# The game should load your class now;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod.&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=40846</id>
		<title>Template:LudeonThread</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=40846"/>
		<updated>2016-08-23T08:09:22Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Fixed the msg part of the template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;[{{{link|http://ludeon.com/forums/index.php?{{{3|topic}}}={{{1|{{{topic|}}}}}}}}}{{#if:{{{msg|}}}|.msg{{{msg|}}}#msg{{{msg|}}}|}} {{{2|Thread}}}]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;[[Category:Templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=40844</id>
		<title>Template:LudeonThread</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=40844"/>
		<updated>2016-08-23T07:59:19Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;[{{{link|http://ludeon.com/forums/index.php?{{{3|topic}}}={{{1|{{{topic|}}}}}}}}}{{#if:{{{msg|}}}|.msg{{{msg|}}}#{{{msg|}}}|}} {{{2|Thread}}}]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;[[Category:Templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=38934</id>
		<title>Template:LudeonThread</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=38934"/>
		<updated>2016-07-15T20:38:15Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: noincluded category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;[{{{link|http://ludeon.com/forums/index.php?{{{3|topic}}}={{{1|{{{number|}}}}}}}}} {{{2|Thread}}}]&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;[[Category:Templates]]&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Recommended_software&amp;diff=38829</id>
		<title>Modding Tutorials/Recommended software</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Recommended_software&amp;diff=38829"/>
		<updated>2016-07-05T12:57:44Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
This tutorial lists a few programs you could use to edit XML and C# code.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=XML Code Editors=&lt;br /&gt;
&lt;br /&gt;
===Basic Editors===&lt;br /&gt;
&lt;br /&gt;
Just about any text editor can write XML code, but as a modder you will want to at the very least see when you forgot closing brackets, a closing tag and other syntax errors.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notepad doesn't do this, so if you're even somewhat serious about modding, the following software will help you immensely:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [NotepadQQ] || Linux || Notepadqq is a Notepad++-like editor for the Linux desktop so has the exact same UI and functions as Notepad++&lt;br /&gt;
|-&lt;br /&gt;
| [http://notepad-plus-plus.org/download/ Notepad++] || Windows || Has well implemented auto-completion and a very customizable user interface. Can be used to write both XML and C# code, although C# software usually has its own text editor&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.sublimetext.com/ Sublime Text] || Mono || Natively supports many programming languages and markup languages, and its functionality can be extended by users with plugins - A brief overview of its functionality can be found [http://webdesign.tutsplus.com/tutorials/useful-shortcuts-for-a-faster-workflow-in-sublime-text-3--cms-22185 here] and a full course [http://code.tutsplus.com/courses/perfect-workflow-in-sublime-text-2 here]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.pnotepad.org/download/ Programmer's Notepad] || Windows || More lightweight with a less cluttered interface than Notepad++, also capable of editing both XML and C# code&lt;br /&gt;
|-&lt;br /&gt;
| [http://xmlnotepad.codeplex.com/releases/ XML Notepad] || Windows || XML-oriented editor with a lot of features you will most likely never use in Rimworld modding&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.geany.org/ Geany] || Any || Extremely lightweight text editor with syntax highlighting and some other basic features oriented towards XML and code editing.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Editors===&lt;br /&gt;
&lt;br /&gt;
There's many editors out there specifically made for XML code. Because Rimworld uses XML in a very simple way, advanced code editors are rarely needed. In case you're ever in need of one, however, the following ones might help:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/xpontus/files/ XPontus] || Windows || Has a tree view and is capable of checking XML for errors, fixing tabs and creating schema's detailing every tag's data types&lt;br /&gt;
|-&lt;br /&gt;
| [http://xmlgrid.net/ XMLGrid] || - || Capable of validating XML and turning it into Excel Spreadsheets, XSD Charts and an online table detailing each tag of a certain type and its contents&lt;br /&gt;
|-&lt;br /&gt;
| [http://codebeautify.org/xmlviewer Codebeautify's xmlviewer] || - || Can display as a tree view, automatically format/indent your code and can validate and show errors too. Also have a function share code (like [http://codebeautify.org/xmlviewer/b39586 that])&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=IDE's=&lt;br /&gt;
&lt;br /&gt;
C# code is best edited in an IDE (Integrated Development Environment) to make the process of editing code, managing a solution's content and compiling its projects both easier and faster. Any IDE for C# will probably work just fine, so here's a list of suggested editors:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.visualstudio.com/ Visual Studio] || Windows || Very extensive IDE with paid, trial and free versions. Any of these versions will probably work, so you might as well take [https://www.visualstudio.com/products/visual-studio-community-vs Visual Studio Community 2015] which is free for individuals and small teams&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.icsharpcode.net/OpenSource/SD/Download/ SharpDevelop] || Windows || Free IDE specifically made for C#&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.monodevelop.com/download/ MonoDevelop] || Mono&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; || Free, cross-platform IDE with customizable user interface. Has support for C# as well as some other languages you won't need for Rimworld&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.xamarin.com/platform Xamarin] || Mac || It's free but you need to register to download it. Probably your best option on a mac. PLEASE SOMEONE FIX THIS LINK&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
# Windows, Mac and Linux&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whichever IDE you choose, make sure it's capable of compiling for .NET Framework 3.5. If you for whatever reason don't have this framework installed, you can download it [https://www.microsoft.com/en-us/download/details.aspx?id=21 here].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Additional C# Software=&lt;br /&gt;
&lt;br /&gt;
Besides your IDE it's strongly recommended to install the following software for decompiling:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://ilspy.net/ ILSpy] || Windows || Software which is capable of [[Modding Tutorials/Decompiling source code|decompiling source code]], which is very useful in Rimworld modding&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.monodevelop.com/download/ MonoDevelop] || Mono || The Linux version of the software has an integrated decompiler for .DLLs&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Graphics Software=&lt;br /&gt;
&lt;br /&gt;
For making textures you will need graphics software. Any image editing program should work, and if you have an alternative to the following links that's probably okay:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.photofiltre-studio.com/download-en.htm Photofiltre Studio] || Windows || Functional software with very little user interface clutter for its applications. Doesn't support pen tablet, and has a 100% free (non-trial) version called [http://photofiltre.free.fr/download_en.htm Photofiltre]&lt;br /&gt;
|-&lt;br /&gt;
| [http://inkscape.org/en/download/ Inkscape] || Mono || Free vector graphic program with a steeper learning curve due to the vector based image editing. Vector graphics can look better than bitmap graphics in Rimworld&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.photoshop.com/products Photoshop] || Windows/Mac || Paid software with a trial version. Rimworld's original graphics are made in Photoshop (they're .PSD files)&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gimp.org/ Gimp] || Mono || A free, open-source alternative to Photoshop that's been around since 1998. Gimp has a large user community, with great list of [http://www.gimp.org/tutorials/ tutorials] on the official sites&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Audio Software=&lt;br /&gt;
&lt;br /&gt;
Recording your own audio for mods might be too much to ask, but editing audio is always possible. This can be done with the following software or your own alternative:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/audacity/ Audacity] || Mono || Audio editing software with many tutorials online, lots of useful functionality and a relatively readable interface&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]] starts you off with the XML side of modding.&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]] starts you off with the C# side of modding. Knowledge of the XML part can and will be very useful.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38611</id>
		<title>Modding Tutorials/Mod folder structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38611"/>
		<updated>2016-05-12T19:51:12Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* The Source and Assemblies folders */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Modding Tutorials/Mod folder structure#Complete mod folder structure|Complete mod folder structure]] is a list of all folders you might find in your average mod directory. This includes /Core/.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Folder structure|Exploring the Folder Structure]] starts off explaining the folder structure. This is part two if you will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the following mod structure:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Defs/&lt;br /&gt;
      (..)&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
    Sounds/&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        ProjectName.sln&lt;br /&gt;
    Textures/&lt;br /&gt;
&lt;br /&gt;
.. Along with a few tips on how to keep your mod folder structure readable and functional.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Standard mod folder structure=&lt;br /&gt;
&lt;br /&gt;
Mod folders are located in the mods folder, which is located as such:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  RimWorld******/&lt;br /&gt;
    Mods/&lt;br /&gt;
&lt;br /&gt;
..relative to your RimWorld install directory. Each mod is a sub folder of this Mods folder and each mod has to follow the following structure precisely.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The About folder==&lt;br /&gt;
{{Main|Modding Tutorials/About folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making a mod starts with you making a folder structure. Some mods need textures and sounds, while others are XML or even C# only.&amp;lt;br/&amp;gt;&lt;br /&gt;
Every mod does however require the following structure to show up in the mods list:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
&lt;br /&gt;
Along with this vital information it's possible to add a preview image for your mod. This makes the structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
&lt;br /&gt;
The size of the base game Preview.png is 400x61 pixels, but some mods use higher preview images. The image is centered in the mod's description, and can be of any size.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Defs folders==&lt;br /&gt;
{{Main|Modding Tutorials/Defs folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your mod adds new content, chances are you're going to use XML files. These files are going to be stored in the folder structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      BiomeDefs/&lt;br /&gt;
        Biomes.xml&lt;br /&gt;
      BodyDefs/&lt;br /&gt;
        Bodies.xml&lt;br /&gt;
      BodyPartDefs/&lt;br /&gt;
        BodyParts.xml&lt;br /&gt;
      (..)&lt;br /&gt;
&lt;br /&gt;
The contents of a Def folder don't follow a clear naming convention, but the folder names are generally the same in every mod.&amp;lt;br/&amp;gt;&lt;br /&gt;
Using a non-standard name is going to make it harder for others to navigate your mod's folders, so it is advised to keep the folder names consistent with the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typically, the files inside these folders are named after their contents:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Apparel_Hats.xml&lt;br /&gt;
        Apparel_Shield.xml&lt;br /&gt;
        (..)&lt;br /&gt;
        Weapons_Melee.xml&lt;br /&gt;
        Weapons_RangedNeolithic.xml&lt;br /&gt;
&lt;br /&gt;
This makes it easier for people to navigate XML code. If your mod is going to add both apparel and weapons, or even both hats and shoes, you're best off separating the XML code in their respective files.&amp;lt;br/&amp;gt;&lt;br /&gt;
Some mod authors choose to make a separate file for each of their items. This makes it easier for others to remove only part of your mod and keep the rest of it, but with very large mods it makes it harder to navigate the folder.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Textures and Sounds folders==&lt;br /&gt;
{{Main|Modding Tutorials/Textures folder|Modding Tutorials/Sounds folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using Defs chances are you're creating a content mod. This type of mod is most likely very dull without its own custom graphics and sounds. Adding such content requires the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Textures/&lt;br /&gt;
    Sounds/&lt;br /&gt;
&lt;br /&gt;
The contents of the Textures and Sounds folder usually aren't the same between mods. The base game sorts these files in various folders and subfolders, but in the end it's very hard to navigate them based on the folder names.&amp;lt;br/&amp;gt;&lt;br /&gt;
It's possible to categorize this content by item (submachinegun#1, pistol#3) or item type (guns, buildings), as an example. Whatever you do it's best to keep the structure consistent throughout both folders.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Source and Assemblies folders==&lt;br /&gt;
{{Main|Modding Tutorials/Setting up a solution}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to take a shot at [[Modding Tutorials/Writing custom code|C# modding]], you want an '''empty''' Source and an '''empty''' Assemblies folder. You'll want to [[Modding Tutorials/Setting up a solution|create the C# project]] inside your Source folder, and compile the class library into the Assemblies folder. These things are processed automatically by your [[Modding Tutorials/Recommended software#IDE's|IDE]], so you don't have to make these folder structures yourself:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      SolutionName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName/&lt;br /&gt;
          ProjectName.csproj&lt;br /&gt;
          (..)&lt;br /&gt;
&lt;br /&gt;
''Or:''&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName.csproj&lt;br /&gt;
        (..)&lt;br /&gt;
&lt;br /&gt;
'''Once again''', the structure of these folders is decided almost entirely by the author's editing software. Therefore the only things you have to set up are the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
    Source/&lt;br /&gt;
&lt;br /&gt;
.. And then once you create a solution starting in ../YourModName/Source/ everything else will be sorted out by the software. People don't navigate these folders, they open ProjectName.sln to navigate it using their software of choice.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Languages folder==&lt;br /&gt;
{{Main|Modding Tutorials/Languages folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unless you're on a translation team, you're unlikely to need this folder a lot. If you want to randomly generate names using your own words, you will however have to use this folder:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
&lt;br /&gt;
In this folder you put .txt files with a new word on every line. Using XML you will then be able to randomly pick one of the lines in the file.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the average mod the rest of the folder is quite useless. You are unlikely to translate your mod into tens of different languages.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Complete mod folder structure=&lt;br /&gt;
&lt;br /&gt;
  */&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png-&lt;br /&gt;
    Assemblies/-&lt;br /&gt;
      *.dll+&lt;br /&gt;
    Defs/-&lt;br /&gt;
      *Defs/+&lt;br /&gt;
        *.xml+&lt;br /&gt;
    Languages/-&lt;br /&gt;
      */*&lt;br /&gt;
        DefInjected/-&lt;br /&gt;
          *Defs/+&lt;br /&gt;
            *.xml+&lt;br /&gt;
        Keyed/-&lt;br /&gt;
          *.xml+&lt;br /&gt;
        Strings/-&lt;br /&gt;
          NameBanks/&lt;br /&gt;
            *.txt+&lt;br /&gt;
        FriendlyName.txt-&lt;br /&gt;
        LangIcon.png&lt;br /&gt;
        LanguageInfo.xml&lt;br /&gt;
    Sounds/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.wav+&lt;br /&gt;
    Source/-&lt;br /&gt;
      */*#&lt;br /&gt;
        bin/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        obj/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        Properties/-&lt;br /&gt;
          AssemblyInfo.cs&lt;br /&gt;
        Source-DLLs/-&lt;br /&gt;
          Assembly-CSharp.dll&lt;br /&gt;
          UnityEngine.dll&lt;br /&gt;
        *.csproj&lt;br /&gt;
        *.OpenCover.Settings&lt;br /&gt;
        *.sln&lt;br /&gt;
        */*#&lt;br /&gt;
          *.cs+&lt;br /&gt;
    Textures/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.psd*&lt;br /&gt;
        *.psd.meta*&lt;br /&gt;
        *.png*&lt;br /&gt;
&lt;br /&gt;
  Anything with a / at the end is a folder;&lt;br /&gt;
  Anything with a . in it is a file;&lt;br /&gt;
  The * in *.* and */ stands for any arbitrary string;&lt;br /&gt;
  The * after a file/folder stands for an occurence of &amp;gt;= 0;&lt;br /&gt;
  The + after a file/folder stands for an occurrence of &amp;gt; 0;&lt;br /&gt;
  The - after a file/folder stands for an occurrence of &amp;lt;= 1;&lt;br /&gt;
  The # after a folder stands for a folder depth of &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
* [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=38562</id>
		<title>Modding Tutorials/Decompiling source code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=38562"/>
		<updated>2016-04-24T09:31:21Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* ILSpy */ Request to add github links.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base game provides a bunch of code snippets in ''../Source/'', relative to your Rimworld installation. Since this isn't a lot, one might want to take a look at the game's full source code:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Decompiling source code=&lt;br /&gt;
&lt;br /&gt;
===ILSpy===&lt;br /&gt;
&lt;br /&gt;
One method is to use ILSpy. This software is recommended because its settings are correct on a clean install. It is for Windows only, but you can compile it yourself as a CLI application for Mono framework on OS X and Linux, see [https://github.com/icsharpcode/ILSpy/issues/691 (This issue)] or [https://github.com/icsharpcode/ILSpy/issues/416 (This issue)] on GitHub for more info.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://ilspy.net/ ILSpy] (Download Binaries) and extract it to a directory of your choosing. Optionally create a desktop shortcut;&lt;br /&gt;
# '''Either''': associate the .dll extension with ILSpy:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select a standard program. Navigate to your ILSpy installation and double-click ''ILSpy.exe'', tick the checkbox and accept;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open ILSpy and open a .dll:&lt;br /&gt;
## Open ILSpy;&lt;br /&gt;
## Go to File -&amp;gt; Open or press Ctrl+O, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ILSpy again:&lt;br /&gt;
## Ctrl+Shift+F or Ctrl+E opens the search bar which can be used to search through all loaded assemblies;&lt;br /&gt;
## Ctrl+F opens a search bar for the currently opened decompiled class.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MonoDevelop===&lt;br /&gt;
&lt;br /&gt;
MonoDevelop is capable of decompiling DLLs, albeit using clumsy initial settings. It is Linux only, otherwise you have to download Xamarin Studio which doesn't have a decompiler.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://www.monodevelop.com/download/ MonoDevelop] and install it;&lt;br /&gt;
# '''Either''': associate the .dll extension with MonoDevelop:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select MonoDevelop as standard program;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open MonoDevelop and open a .dll:&lt;br /&gt;
## Open MonoDevelop;&lt;br /&gt;
## Go to File -&amp;gt; Open, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Visibility&amp;quot; and change it from &amp;quot;Only public members&amp;quot; to &amp;quot;All members&amp;quot;;&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Language&amp;quot; and change it from &amp;quot;Summary&amp;quot; to &amp;quot;C#&amp;quot;;&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ''Assembly-CSharp.dll'' again.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] shows a broad overview of C# coding.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/XML_file_structure&amp;diff=38523</id>
		<title>Modding Tutorials/XML file structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/XML_file_structure&amp;diff=38523"/>
		<updated>2016-04-09T17:27:25Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Basegun thingDef */ Changed Abstract for A13&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will start learning the XML syntax, why the base game uses it and what everything about it does.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the default structure of def files:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def Name=&amp;quot;Parent&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def ParentName=&amp;quot;Parent&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.. Along with how inheritance using Name, ParentName and Abstract works.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Def structure=&lt;br /&gt;
===Standard defs===&lt;br /&gt;
&lt;br /&gt;
Find a Def .xml file in the Core folder, for example thingDefs/Weapons_Guns.xml:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;../Mods/Core/Defs/ThingDefs/Weapons_Guns.xml&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing in this file is the following line:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which tells us this .xml files uses UTF-8 encoding and XML version 1.0, which are the default values for these fields - some XML editors choose to hide this line on editing and then save it on top of the document without ever asking the user about it.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, the structure of the file consists of '''&amp;lt;Defs&amp;gt;''' and '''&amp;lt;Def&amp;gt;''' tags:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each '''&amp;lt;Def&amp;gt;''' contains something's ''def'' (or definition), which can be used to specify each and every modifiable property, e.g for a certain ''thing'' (thingDef).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Differences in defs===&lt;br /&gt;
&lt;br /&gt;
If you look through some .xml files, you'll find the code is inconsistent in the use of some defs;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several ''Buildings_**.xml'' files use the '''&amp;lt;Buildings&amp;gt;''' tag instead of the '''&amp;lt;Defs&amp;gt;''' one. They then proceed to use '''&amp;lt;thingDef&amp;gt;''''s inside the '''&amp;lt;Buildings&amp;gt;''' tag.&amp;lt;br/&amp;gt;&lt;br /&gt;
Other ''Buildings_**.xml'' files use '''&amp;lt;Defs&amp;gt;''' instead of '''&amp;lt;ThingDefs&amp;gt;''', and some even use '''&amp;lt;GameData&amp;gt;''' instead of '''&amp;lt;ThingDefs&amp;gt;'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This implies that the name of the beginning and ending tags isn't important. Rimworld doesn't read their names, it just looks whether they exist.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This '''doesn't''' mean that '''&amp;lt;Def&amp;gt;''' tags are interchangeable. Using &amp;quot;&amp;lt;Def&amp;gt;&amp;quot; will break the game; you will have to specify what C# class will be loaded to parse its contents.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full code===&lt;br /&gt;
&lt;br /&gt;
'''It is important that your file follows this structure to the point where mods won't work with multiple &amp;lt;Defs&amp;gt;, or a &amp;lt;Def&amp;gt; outside of &amp;lt;Defs&amp;gt;:'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Inheritance=&lt;br /&gt;
&lt;br /&gt;
'''Summary''': In XML, inheritance is used to decrease redundancy. If something has a ParentName=&amp;quot;YourParentName&amp;quot;, it takes all contents from Name=&amp;quot;YourParentName&amp;quot;. In case this ParentName is incomplete this will crash the game, and you stop it from being loaded into the game with Abstract=&amp;quot;True&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basegun thingDef===&lt;br /&gt;
&lt;br /&gt;
The first thing in ''Weapons_Guns.xml'' is a '''&amp;lt;thingDef&amp;gt;''' with a Name and Abstract ''type'':&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Abstract type means that contents of this '''&amp;lt;thingDef&amp;gt;''' will not be loaded into the game, that after reading and processing the information in this tag it (the game) will finish reading the XML file ('''entire mod folder as of Alpha 13''') and '''discard''' this tag and its contents, leaving alone (not discarding) anything that might have copied (taken, inherited) the contents of it. All of this is done with this tag:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Name type means the contents of this '''&amp;lt;thingDef&amp;gt;''' can be ''inherited'' by (read: copied by) another '''&amp;lt;thingDef&amp;gt;'''. This way you can write everything you're going to repeat a lot throughout the file in a single location, such as the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;category&amp;gt;Item&amp;lt;/category&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which notifies that this '''&amp;lt;thingDef&amp;gt;''' is of the ''Item'' category, as opposed to those of the ''Building'' category. Because there's a lot of ''tags'' repeated throughout every thing, this greatly compacts the XML file.&amp;lt;br/&amp;gt;&lt;br /&gt;
The full BaseGun parent only has to be defined once in a file, and can then be inherited (copied) with:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef ParentName=&amp;quot;BaseGun&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;thingDef ParentName=&amp;quot;Parent&amp;quot;&amp;gt;''' inherits all contents from '''&amp;lt;thingDef Name=&amp;quot;Parent&amp;quot;&amp;gt;'''. It is common practice to copy the vanilla BaseGun parent and paste it on top of a mod's Weapons_Guns.xml file.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another parent is BaseBullet which holds every standard bullet's commonly repeated properties, such as the property that bullets don't use hitpoints:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;useHitPoints&amp;gt;False&amp;lt;/useHitPoints&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last '''&amp;lt;thingDef&amp;gt;''' on top of the file is one with the Name type ''BaseHumanGun'' and the ParentName type ''BaseGun''. It inherits the contents of BaseGun and is inherited by everything with '''&amp;lt;thingDef ParentName=&amp;quot;BaseHumanGun&amp;quot;&amp;gt;''':&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list representation of how inheritance works in Rimworld's XML might help you out, either early on or to collect your thoughts after reading the above.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Game launches&lt;br /&gt;
# Game loads mods individually:&lt;br /&gt;
## Inheritance information is taken from each tag&lt;br /&gt;
## Anything with a PARENTNAME type inherits (read: copies) and applies all content from its associated NAME type&lt;br /&gt;
##* Anything that gets content is a child&lt;br /&gt;
##* Anything that sends it is a parent&lt;br /&gt;
##* It's possible to be both of these&lt;br /&gt;
## Content information (read: everything between the &amp;lt;thingDef&amp;gt;) is taken and applied for each tag&lt;br /&gt;
##* All interfering content from parents is now overwritten&lt;br /&gt;
## Now that all &amp;lt;Def&amp;gt;s know their contents, ABSTRACT type defs are discarded and therefore ignored by the game&lt;br /&gt;
## All &amp;lt;Def&amp;gt;s and their contents  finish loading&lt;br /&gt;
# Game finishes loading mods&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breakdown===&lt;br /&gt;
&lt;br /&gt;
Let's break down the inheritance chunks of the BaseGun code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;thingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;thingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;thingDef Name=&amp;quot;BaseBullet&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|&amp;lt;ThingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;lt;thingDef&amp;amp;gt; || The name of this ''tag'', which is read by the game and processed into a correct definition based on this name.&amp;lt;br/&amp;gt;All tags in ''../Mods/Core/Defs/ThingDefs/'' use the '''&amp;lt;thingDef&amp;gt;''' tag.&lt;br /&gt;
|-&lt;br /&gt;
| Name=&amp;quot;BaseGun&amp;quot; || The Name ''type'' of this tag. This tag is a parent with the Name value of &amp;quot;BaseGun&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| Abstract=&amp;quot;True&amp;quot; || The [https://en.wikipedia.org/wiki/Abstract_type Abstract type] of this tag is True.&amp;lt;br/&amp;gt;This makes it so that the contents of this tag aren't ''instantiated'', which in practice means the contents of it can only be inherited by other tags and won't be loaded into the game because its only purpose is in inheritance, in being a parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;Is the only use of this '''&amp;lt;thingDef&amp;gt;''' to be inherited from? Yes: add Abstract=&amp;quot;True&amp;quot;. No: don't.&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|&amp;lt;ThingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ParentName=&amp;quot;BaseGun&amp;quot; || The ParentName type of this tag. This tag inherits from a parent with the Name value of &amp;quot;BaseGun&amp;quot;.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full code===&lt;br /&gt;
&lt;br /&gt;
After the addition of inheritance, our XML file structure looks like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def Name=&amp;quot;Parent&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def ParentName=&amp;quot;Parent&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''&amp;lt;Defs&amp;gt;''' can have any name you want;&lt;br /&gt;
* '''&amp;lt;Def&amp;gt;''' has to have a specific name.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml]] continues explanations on the BaseGun parent, the tags inside its '''&amp;lt;thingDef&amp;gt;''''s and further information on modding in weaponry.&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Assets&amp;diff=38522</id>
		<title>Modding Tutorials/Assets</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Assets&amp;diff=38522"/>
		<updated>2016-04-09T17:23:13Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Created&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to rip base game assets through the use of Unity Assets Explorer and XnConvert.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* You will want to have the following software installed:&lt;br /&gt;
*# [http://zenhax.com/viewtopic.php?t=36 Unity Assets Explorer v1.3+] (there are newer versions available) for ripping Unity .assets files;&lt;br /&gt;
*# [http://www.xnview.com/en/xnconvert/#downloads XnConvert] for mass-converting .dds/.tex files to .png or whichever is your preferred format.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Unity Assets Explorer=&lt;br /&gt;
To convert game assets from a Unity .assets file into their original file formats we can use Unity Assets Explorer.&amp;lt;br/&amp;gt;&lt;br /&gt;
The download page of the software provides a tutorial however we will be listing the steps you have to take in this section as well.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download Unity Assets Explorer;&lt;br /&gt;
## Search the software or download [http://zenhax.com/viewtopic.php?t=36 here (v1.3)];&lt;br /&gt;
## ''Optional'': drag the executable just outside your RimWorld root folder or in a similar location for ease of access;&lt;br /&gt;
## Take note of the location of the .exe file since the output folders will be generated in that same location,&lt;br /&gt;
# Open Unity Assets Explorer and select source files;&lt;br /&gt;
## Double-click the executable, allow it to run if such prompt comes up.&lt;br /&gt;
## &amp;quot;Open Assets-file&amp;quot;, select &amp;lt;pre&amp;gt;RimWorld******\RimWorld******_Data\resources.assets&amp;lt;/pre&amp;gt;&lt;br /&gt;
# Decide which assets you want to rip;&lt;br /&gt;
#* '''Textures''': Sort by &amp;quot;TYPE&amp;quot;, select all &amp;quot;Texture2D - ***&amp;quot; and Right-click, &amp;quot;Extract This Files&amp;quot;&amp;lt;sup&amp;gt;[sic]&amp;lt;/sup&amp;gt;;&lt;br /&gt;
#* '''Sounds''': Sort by &amp;quot;TYPE&amp;quot;, select all &amp;quot;AudioClip&amp;quot; '''but no AudioClip - OGGVORBIS''' and Right-click, &amp;quot;Extract This Files&amp;quot;&amp;lt;sup&amp;gt;[sic]&amp;lt;/sup&amp;gt;,&lt;br /&gt;
#* ''The default settings for extraction are sufficient.''&lt;br /&gt;
# Navigate towards your Unity Assets Explorer location, refresh with F5. A folder called &amp;quot;resources&amp;quot; should be created.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=XnConvert=&lt;br /&gt;
The output format of Unity Assets Explorer for textures is .dds or .tex and all textures are flipped vertically. This can be fixed through the use of XnConvert.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download XnConvert;&lt;br /&gt;
## Download [http://www.xnview.com/en/xnconvert/#downloads here];&lt;br /&gt;
# Open the software and select files to be converted;&lt;br /&gt;
## Double-click the executable or shortcut;&lt;br /&gt;
## &amp;quot;Add folder...&amp;quot;, select the output '''folder''' containing all .dds and .tex files;&lt;br /&gt;
# Select actions to be performed per file;&lt;br /&gt;
## Go to &amp;quot;Actions [0/0]&amp;quot;, select &amp;quot;Add action&amp;gt;&amp;quot; -&amp;gt; &amp;quot;Image&amp;quot; -&amp;gt; &amp;quot;Mirror&amp;quot;;&lt;br /&gt;
## Tick &amp;quot;Vertical&amp;quot;, make sure the action is &amp;quot;Enabled&amp;quot;;&lt;br /&gt;
## ''Optional'': look at the preview before and after tabs to make sure the correct actions are being applied,&lt;br /&gt;
# Choose output format and directory;&lt;br /&gt;
## &amp;quot;Output&amp;quot;: choose &amp;quot;Folder&amp;quot;, decide on the folder location;&lt;br /&gt;
## &amp;quot;Filename&amp;quot;: choose &amp;quot;{Filename}&amp;quot;, optionally add &amp;quot;_out&amp;quot; or similar;&lt;br /&gt;
## &amp;quot;Format&amp;quot;: choose &amp;quot;PNG - Portable Network Graphics&amp;quot; or whichever file format you prefer;&lt;br /&gt;
## ''Optional'': &amp;quot;After conversion&amp;quot; tick &amp;quot;Clear the 'Input' file(s)&amp;quot;,&lt;br /&gt;
# Click &amp;quot;Convert&amp;quot;, wait;&lt;br /&gt;
# The resource files are now fully converted to your format of choice and are present in the specified Output folder.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Recommended software#Graphics Software|Recommended graphics software]] for suggestions on software for further editing or viewing of source files.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38521</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38521"/>
		<updated>2016-04-09T17:22:35Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* General modding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
#* [[Modding Tutorials/About folder|About folder]]&lt;br /&gt;
#* [[Modding Tutorials/Defs folder|Defs folder]]&lt;br /&gt;
#* [[Modding Tutorials/Languages folder|Languages folder]]&lt;br /&gt;
#* [[Modding Tutorials/Textures folder|Textures folder]]&lt;br /&gt;
#* [[Modding Tutorials/Sounds folder|Sounds folder]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
* [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&lt;br /&gt;
* [[Modding Tutorials/Assets|Decompiling Texture/Sound Assets]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
# [[Modding Tutorials/XML Defs|Introduction to XML Defs]]&lt;br /&gt;
#* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]]&lt;br /&gt;
# In-depth XML Def tutorials&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38520</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38520"/>
		<updated>2016-04-09T12:30:00Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* General modding */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
#* [[Modding Tutorials/About folder|About folder]]&lt;br /&gt;
#* [[Modding Tutorials/Defs folder|Defs folder]]&lt;br /&gt;
#* [[Modding Tutorials/Languages folder|Languages folder]]&lt;br /&gt;
#* [[Modding Tutorials/Textures folder|Textures folder]]&lt;br /&gt;
#* [[Modding Tutorials/Sounds folder|Sounds folder]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
* [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&lt;br /&gt;
* [[Modding Tutorials/Assets|Ripping Textures]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
# [[Modding Tutorials/XML Defs|Introduction to XML Defs]]&lt;br /&gt;
#* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]]&lt;br /&gt;
# In-depth XML Def tutorials&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38519</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38519"/>
		<updated>2016-04-09T11:02:52Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Sharpdevelop */ Updated to not include the Source-DLLs folder&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]].&lt;br /&gt;
* You will want to have an IDE installed: [[Modding Tutorials/Recommended software#IDE's|Recommended IDE's]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse...&amp;quot;;&lt;br /&gt;
## Navigate towards &amp;lt;pre&amp;gt;RimWorld******/RimWorld******_Data/Managed&amp;lt;/pre&amp;gt; and select files: &amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;Assembly-CSharp.dll&amp;amp;#10;UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Click &amp;quot;Open&amp;quot; then &amp;quot;OK&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;Solution (YourSolutionName)&amp;quot; or just &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Change the debug info to &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to out&amp;quot; to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=38356</id>
		<title>Modding Tutorials/Decompiling source code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=38356"/>
		<updated>2015-12-06T11:31:21Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* ILSpy */ Added info on searching&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base game provides a bunch of code snippets in ''../Source/'', relative to your Rimworld installation. Since this isn't a lot, one might want to take a look at the game's full source code:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Decompiling source code=&lt;br /&gt;
&lt;br /&gt;
===ILSpy===&lt;br /&gt;
&lt;br /&gt;
One method is to use ILSpy. This software is recommended because its settings are correct on a clean install. It is Windows only, though.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://ilspy.net/ ILSpy] (Download Binaries) and extract it to a directory of your choosing. Optionally create a desktop shortcut;&lt;br /&gt;
# '''Either''': associate the .dll extension with ILSpy:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select a standard program. Navigate to your ILSpy installation and double-click ''ILSpy.exe'', tick the checkbox and accept;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open ILSpy and open a .dll:&lt;br /&gt;
## Open ILSpy;&lt;br /&gt;
## Go to File -&amp;gt; Open or press Ctrl+O, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ILSpy again:&lt;br /&gt;
## Ctrl+Shift+F or Ctrl+E opens the search bar which can be used to search through all loaded assemblies;&lt;br /&gt;
## Ctrl+F opens a search bar for the currently opened decompiled class.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MonoDevelop===&lt;br /&gt;
&lt;br /&gt;
MonoDevelop is capable of decompiling DLLs, albeit using clumsy initial settings. It is Linux only, otherwise you have to download Xamarin Studio which doesn't have a decompiler.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://www.monodevelop.com/download/ MonoDevelop] and install it;&lt;br /&gt;
# '''Either''': associate the .dll extension with MonoDevelop:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select MonoDevelop as standard program;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open MonoDevelop and open a .dll:&lt;br /&gt;
## Open MonoDevelop;&lt;br /&gt;
## Go to File -&amp;gt; Open, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Visibility&amp;quot; and change it from &amp;quot;Only public members&amp;quot; to &amp;quot;All members&amp;quot;;&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Language&amp;quot; and change it from &amp;quot;Summary&amp;quot; to &amp;quot;C#&amp;quot;;&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ''Assembly-CSharp.dll'' again.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] shows a broad overview of C# coding.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38314</id>
		<title>Modding Tutorials/Writing custom code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38314"/>
		<updated>2015-11-25T15:14:32Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Namespace */ Fixed error in code MyNameSpace -&amp;gt; RimWorld&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:TheTynan|TheTynan]]|extra=1}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial gives you a broad idea how to work on a C# solution.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a class=&lt;br /&gt;
&amp;lt;!--  ### THE FOLLOWING TEXT was stripped from the page because it's not in line with the tone of the article&lt;br /&gt;
&lt;br /&gt;
In addition to creating data for the game to use, you can also write code. You could probably write in any .NET language, but I’ve only tested C#.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
&lt;br /&gt;
When you start your software you'll see a '''Projects''' file explorer to the left, a '''Properties''' explorer to the right and currently opened files in the middle.&lt;br /&gt;
&lt;br /&gt;
* With your solution open, create a new class inside your '''Projects''' explorer;&lt;br /&gt;
*# If you don't have [[Modding Tutorials/Setting up a solution|your solution]] open you can do so by clicking File -&amp;gt; Open -&amp;gt; Project/Solution.. or by choosing a recent project on the '''Start page''' in the middle;&lt;br /&gt;
*# If it's not expanded, click the + next to &amp;quot;Solution ''MySolutionName''&amp;quot;. Right-click ''MyProjectName'' (this could be the same as ''MySolutionName'' or different, depending on how you set up the solution);&lt;br /&gt;
*# Select Add -&amp;gt; New Item.. -&amp;gt; '''Categories:''' C# -&amp;gt; '''Templates:''' Class -&amp;gt; '''File Name:''' ''MyClassName''.cs,&lt;br /&gt;
&lt;br /&gt;
====Template====&lt;br /&gt;
&lt;br /&gt;
Let's go over the template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;/*&lt;br /&gt;
 * Created by SharpDevelop.&lt;br /&gt;
 * User: You&lt;br /&gt;
 * Date: 01-01-1970&lt;br /&gt;
 * Time: 00:00&lt;br /&gt;
 * &lt;br /&gt;
 * To change this template use Tools | Options | Coding | Edit Standard Headers.&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Description of MyClassName.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	public class MyClassName&lt;br /&gt;
	{&lt;br /&gt;
		public MyClassName()&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using====&lt;br /&gt;
&lt;br /&gt;
The first thing you notice is ''using System;'' which indicates this class can call anything from the namespace ''System'' without calling it like ''System.Class.SomeDataType'' but rather ''SomeDataType''. This is very useful because we don't have to worry about such calls anymore (for now).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next section shows which namespaces you could put in ''using''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Namespace====&lt;br /&gt;
&lt;br /&gt;
Next up is the ''namespace MyNameSpace'' part - in principle everything inside of a namespace knows everything else inside of that namespace. If you were to make a folder inside of your project (''MyProjectName'' not Solution ''MySolutionName''), any classes inside of that folder would have the namespace ''MyNameSpace.MyFolderName''. '''That's a different namespace''' and unless you tell other classes that it exists (''using MyNameSpace.MyFolderName;'') they won't accept calls to parts of that namespace without that namespace as a prefix.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anything inside of ''MyNameSpace.MyFolderName'' does however know of everything inside ''MyNameSpace'', just nothing about other subfolders of ''MyNameSpace''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default your project knows nothing. Adding DLL references to the ''References'' folder (as done in the previous tutorial) allows you to reference them with ''using'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
namespace MyNameSpace {}		/* Assuming MyNameSpace is your ROOT NAMESPACE (MyProjectName -&amp;gt;&lt;br /&gt;
					Properties -&amp;gt; Application -&amp;gt; Root namespace), this will compile. */&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace.MyFolderName {}	/* Assuming this class is inside of the folder MyFolderName inside of&lt;br /&gt;
					MyProjectName, this will compile. Other classes outside of the folder&lt;br /&gt;
					will have to reference this, this class will have to reference classes&lt;br /&gt;
					in different subfolders (but not the ones in the root folder). */&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld {}			/* Don't do this. It will compile if RimWorld is your root namespace&lt;br /&gt;
					but it's bad practice. */&lt;br /&gt;
&lt;br /&gt;
namespace System {}			/* No, just no. */&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can set your project's namespace by right-clicking MyProjectName -&amp;gt; Properties -&amp;gt; Application -&amp;gt; Root namespace. Please take some time to make it unique so no compatibility issues will arise with other mods, for your and everyone else's sanity.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some very useful namespaces in general are the following:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections.Generic || Makes it so you can use part of the IEnumerable interface, which is used for datatypes like List&amp;lt;&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| System.Linq || Allows for cool operations on the IEnumerable interface such as ''.Where()'' which accepts lambda operations (oh my!).&lt;br /&gt;
|-&lt;br /&gt;
| System.Text.RegularExpressions || Introduces Regular Expressions (RegEx) to C# which allows for intricate operations on strings.&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections || Holds other parts of the IEnumerable interface you will require when inheriting from that class.&lt;br /&gt;
|-&lt;br /&gt;
| System.Text || Contains the ''StringBuilder'' which accepts a list of strings and returns them in a specific way.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the namespaces for RimWorld in particular are these:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld || Many classes can be found in this namespace.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.Planet || Everything (almost everything) having to do with the planet savefile is in here.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.SquadAI || Holds the squad AI, clearly. You'll know it when you need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse || Sometimes more complex classes are found here.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.AI || You might never have to touch this either.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Grammar || Contains functionality for the Languages folder and other things having to do with text operations such as the art flavour text generator.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Noise || Something something you'll never need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Sound || Much like Verse.Noise except it's required to play sounds directly with your code.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Steam || Steam integration by Tynan - it's not active so you won't need it.&lt;br /&gt;
|-&lt;br /&gt;
| UnityEngine || Contains many more methods you most likely won't need.&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between RimWorld and Verse is not very clear and you might as well add both using statements whenever you want.&amp;lt;br/&amp;gt;&lt;br /&gt;
If you want to use the exact functionality of a base game class you're best off copying all its ''using'' statements, its ''namespace'' and the namespace of its parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Summary====&lt;br /&gt;
&lt;br /&gt;
This summary is part of the template but it's not required. It can help other people understand your code better when you provide the source but besides that you really don't need it.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class and Constructor====&lt;br /&gt;
&lt;br /&gt;
This is your class definition. To access anything inside of a ''public class'' you will need a reference to an instance of that class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
MyClassNamefoo = new MyClassName();&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brackets at ''new MyClassName()'' indicate you're creating this instance without ''parameters'' which is possible because your class contains a constructor (anything inside of ''class MyClassName'' which has parameters and isn't a method, often abbreviated '''.ctor''') which accepts a call without parameters:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class MyClassName&lt;br /&gt;
{&lt;br /&gt;
	public MyClassName()	/* No parameters */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo, int bar)	/* Required parameters of datatypes string and int */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo = &amp;quot;none supplied&amp;quot;, int bar = 42)	/* Default parameters &amp;quot; &amp;quot; &amp;quot; */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last implementation of the constructor (''MyNameSpace.MyClassName.MyClassName'' inside of ''MyNameSpace.MyClassName'') is capable of accepting zero to two parameters while the second implementation of the constructor will only accept calls with exactly two parameters.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing code=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/Decompiling source code|Decompile source code]] to take a look at the game's existing code;&lt;br /&gt;
## If you get stuck on anything, any modding questions can be asked on the [https://ludeon.com/forums/index.php?board=14.0 subforum],&lt;br /&gt;
# Compile your class into a .dll;&lt;br /&gt;
## Make sure your project's output type is &amp;quot;class library&amp;quot;;&lt;br /&gt;
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem,&lt;br /&gt;
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;&lt;br /&gt;
## '''Example:''' Create a new ThingDef with a &amp;lt;thingClass&amp;gt; that points to a class in your .dll,&lt;br /&gt;
# The game should load your class now;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod.&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38305</id>
		<title>Modding Tutorials/Writing custom code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38305"/>
		<updated>2015-11-23T14:46:14Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Namespace */ Made it more &amp;quot;interactive&amp;quot; with changing text into code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:TheTynan|TheTynan]]|extra=1}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial gives you a broad idea how to work on a C# solution.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a class=&lt;br /&gt;
&amp;lt;!--  ### THE FOLLOWING TEXT was stripped from the page because it's not in line with the tone of the article&lt;br /&gt;
&lt;br /&gt;
In addition to creating data for the game to use, you can also write code. You could probably write in any .NET language, but I’ve only tested C#.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
&lt;br /&gt;
When you start your software you'll see a '''Projects''' file explorer to the left, a '''Properties''' explorer to the right and currently opened files in the middle.&lt;br /&gt;
&lt;br /&gt;
* With your solution open, create a new class inside your '''Projects''' explorer;&lt;br /&gt;
*# If you don't have [[Modding Tutorials/Setting up a solution|your solution]] open you can do so by clicking File -&amp;gt; Open -&amp;gt; Project/Solution.. or by choosing a recent project on the '''Start page''' in the middle;&lt;br /&gt;
*# If it's not expanded, click the + next to &amp;quot;Solution ''MySolutionName''&amp;quot;. Right-click ''MyProjectName'' (this could be the same as ''MySolutionName'' or different, depending on how you set up the solution);&lt;br /&gt;
*# Select Add -&amp;gt; New Item.. -&amp;gt; '''Categories:''' C# -&amp;gt; '''Templates:''' Class -&amp;gt; '''File Name:''' ''MyClassName''.cs,&lt;br /&gt;
&lt;br /&gt;
====Template====&lt;br /&gt;
&lt;br /&gt;
Let's go over the template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;/*&lt;br /&gt;
 * Created by SharpDevelop.&lt;br /&gt;
 * User: You&lt;br /&gt;
 * Date: 01-01-1970&lt;br /&gt;
 * Time: 00:00&lt;br /&gt;
 * &lt;br /&gt;
 * To change this template use Tools | Options | Coding | Edit Standard Headers.&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Description of MyClassName.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	public class MyClassName&lt;br /&gt;
	{&lt;br /&gt;
		public MyClassName()&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using====&lt;br /&gt;
&lt;br /&gt;
The first thing you notice is ''using System;'' which indicates this class can call anything from the namespace ''System'' without calling it like ''System.Class.SomeDataType'' but rather ''SomeDataType''. This is very useful because we don't have to worry about such calls anymore (for now).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next section shows which namespaces you could put in ''using''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Namespace====&lt;br /&gt;
&lt;br /&gt;
Next up is the ''namespace MyNameSpace'' part - in principle everything inside of a namespace knows everything else inside of that namespace. If you were to make a folder inside of your project (''MyProjectName'' not Solution ''MySolutionName''), any classes inside of that folder would have the namespace ''MyNameSpace.MyFolderName''. '''That's a different namespace''' and unless you tell other classes that it exists (''using MyNameSpace.MyFolderName;'') they won't accept calls to parts of that namespace without that namespace as a prefix.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anything inside of ''MyNameSpace.MyFolderName'' does however know of everything inside ''MyNameSpace'', just nothing about other subfolders of ''MyNameSpace''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
By default your project knows nothing. Adding DLL references to the ''References'' folder (as done in the previous tutorial) allows you to reference them with ''using'':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
namespace MyNameSpace {}		/* Assuming MyNameSpace is your ROOT NAMESPACE (MyProjectName -&amp;gt;&lt;br /&gt;
					Properties -&amp;gt; Application -&amp;gt; Root namespace), this will compile. */&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace.MyFolderName {}	/* Assuming this class is inside of the folder MyFolderName inside of&lt;br /&gt;
					MyProjectName, this will compile. Other classes outside of the folder&lt;br /&gt;
					will have to reference this, this class will have to reference classes&lt;br /&gt;
					in different subfolders (but not the ones in the root folder). */&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld {}			/* Don't do this. It will compile if MyNameSpace is your root namespace&lt;br /&gt;
					but it's bad practice. */&lt;br /&gt;
&lt;br /&gt;
namespace System {}			/* No, just no. */&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can set your project's namespace by right-clicking MyProjectName -&amp;gt; Properties -&amp;gt; Application -&amp;gt; Root namespace. Please take some time to make it unique so no compatibility issues will arise with other mods, for your and everyone else's sanity.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some very useful namespaces in general are the following:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections.Generic || Makes it so you can use part of the IEnumerable interface, which is used for datatypes like List&amp;lt;&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| System.Linq || Allows for cool operations on the IEnumerable interface such as ''.Where()'' which accepts lambda operations (oh my!).&lt;br /&gt;
|-&lt;br /&gt;
| System.Text.RegularExpressions || Introduces Regular Expressions (RegEx) to C# which allows for intricate operations on strings.&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections || Holds other parts of the IEnumerable interface you will require when inheriting from that class.&lt;br /&gt;
|-&lt;br /&gt;
| System.Text || Contains the ''StringBuilder'' which accepts a list of strings and returns them in a specific way.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the namespaces for RimWorld in particular are these:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld || Many classes can be found in this namespace.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.Planet || Everything (almost everything) having to do with the planet savefile is in here.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.SquadAI || Holds the squad AI, clearly. You'll know it when you need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse || Sometimes more complex classes are found here.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.AI || You might never have to touch this either.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Grammar || Contains functionality for the Languages folder and other things having to do with text operations such as the art flavour text generator.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Noise || Something something you'll never need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Sound || Much like Verse.Noise except it's required to play sounds directly with your code.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Steam || Steam integration by Tynan - it's not active so you won't need it.&lt;br /&gt;
|-&lt;br /&gt;
| UnityEngine || Contains many more methods you most likely won't need.&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between RimWorld and Verse is not very clear and you might as well add both using statements whenever you want.&amp;lt;br/&amp;gt;&lt;br /&gt;
If you want to use the exact functionality of a base game class you're best off copying all its ''using'' statements, its ''namespace'' and the namespace of its parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Summary====&lt;br /&gt;
&lt;br /&gt;
This summary is part of the template but it's not required. It can help other people understand your code better when you provide the source but besides that you really don't need it.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class and Constructor====&lt;br /&gt;
&lt;br /&gt;
This is your class definition. To access anything inside of a ''public class'' you will need a reference to an instance of that class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
MyClassNamefoo = new MyClassName();&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brackets at ''new MyClassName()'' indicate you're creating this instance without ''parameters'' which is possible because your class contains a constructor (anything inside of ''class MyClassName'' which has parameters and isn't a method, often abbreviated '''.ctor''') which accepts a call without parameters:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class MyClassName&lt;br /&gt;
{&lt;br /&gt;
	public MyClassName()	/* No parameters */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo, int bar)	/* Required parameters of datatypes string and int */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo = &amp;quot;none supplied&amp;quot;, int bar = 42)	/* Default parameters &amp;quot; &amp;quot; &amp;quot; */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last implementation of the constructor (''MyNameSpace.MyClassName.MyClassName'' inside of ''MyNameSpace.MyClassName'') is capable of accepting zero to two parameters while the second implementation of the constructor will only accept calls with exactly two parameters.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing code=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/Decompiling source code|Decompile source code]] to take a look at the game's existing code;&lt;br /&gt;
## If you get stuck on anything, any modding questions can be asked on the [https://ludeon.com/forums/index.php?board=14.0 subforum],&lt;br /&gt;
# Compile your class into a .dll;&lt;br /&gt;
## Make sure your project's output type is &amp;quot;class library&amp;quot;;&lt;br /&gt;
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem,&lt;br /&gt;
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;&lt;br /&gt;
## '''Example:''' Create a new ThingDef with a &amp;lt;thingClass&amp;gt; that points to a class in your .dll,&lt;br /&gt;
# The game should load your class now;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod.&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38304</id>
		<title>Modding Tutorials/Writing custom code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Writing_custom_code&amp;diff=38304"/>
		<updated>2015-11-23T14:29:33Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Added lots of extra info on namespace, using etc.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:TheTynan|TheTynan]]|extra=1}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial gives you a broad idea how to work on a C# solution.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Creating a class=&lt;br /&gt;
&amp;lt;!--  ### THE FOLLOWING TEXT was stripped from the page because it's not in line with the tone of the article&lt;br /&gt;
&lt;br /&gt;
In addition to creating data for the game to use, you can also write code. You could probably write in any .NET language, but I’ve only tested C#.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
&lt;br /&gt;
When you start your software you'll see a '''Projects''' file explorer to the left, a '''Properties''' explorer to the right and currently opened files in the middle.&lt;br /&gt;
&lt;br /&gt;
* With your solution open, create a new class inside your '''Projects''' explorer;&lt;br /&gt;
*# If you don't have [[Modding Tutorials/Setting up a solution|your solution]] open you can do so by clicking File -&amp;gt; Open -&amp;gt; Project/Solution.. or by choosing a recent project on the '''Start page''' in the middle;&lt;br /&gt;
*# If it's not expanded, click the + next to &amp;quot;Solution ''MySolutionName''&amp;quot;. Right-click ''MyProjectName'' (this could be the same as ''MySolutionName'' or different, depending on how you set up the solution);&lt;br /&gt;
*# Select Add -&amp;gt; New Item.. -&amp;gt; '''Categories:''' C# -&amp;gt; '''Templates:''' Class -&amp;gt; '''File Name:''' ''MyClassName''.cs,&lt;br /&gt;
&lt;br /&gt;
====Template====&lt;br /&gt;
&lt;br /&gt;
Let's go over the template:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;/*&lt;br /&gt;
 * Created by SharpDevelop.&lt;br /&gt;
 * User: You&lt;br /&gt;
 * Date: 01-01-1970&lt;br /&gt;
 * Time: 00:00&lt;br /&gt;
 * &lt;br /&gt;
 * To change this template use Tools | Options | Coding | Edit Standard Headers.&lt;br /&gt;
 */&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace MyNameSpace&lt;br /&gt;
{&lt;br /&gt;
	/// &amp;lt;summary&amp;gt;&lt;br /&gt;
	/// Description of MyClassName.&lt;br /&gt;
	/// &amp;lt;/summary&amp;gt;&lt;br /&gt;
	public class MyClassName&lt;br /&gt;
	{&lt;br /&gt;
		public MyClassName()&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Using====&lt;br /&gt;
&lt;br /&gt;
The first thing you notice is ''using System;'' which indicates this class can call anything from the namespace ''System'' without calling it like ''System.Class.SomeDataType'' but rather ''SomeDataType''. This is very useful because we don't have to worry about such calls anymore (for now).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The next section shows which namespaces you could put in ''using''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Namespace====&lt;br /&gt;
&lt;br /&gt;
Next up is the ''namespace MyNameSpace'' part - in principle everything inside of a namespace knows everything else inside of that namespace. If you were to make a folder inside of your project (''MyProjectName'' not Solution ''MySolutionName''), any classes inside of that folder would have the namespace ''MyNameSpace.MyFolderName''. '''That's a different namespace''' and unless you tell other classes that it exists (''using MyNameSpace.MyFolderName;'') they won't accept calls to parts of that namespace without that namespace as a prefix.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Anything inside of ''MyNameSpace.MyFolderName'' does however know of everything inside ''MyNameSpace'', just nothing about other subfolders of ''MyNameSpace''.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some very useful namespaces in general are the following:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections.Generic || Makes it so you can use part of the IEnumerable interface, which is used for datatypes like List&amp;lt;&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| System.Linq || Allows for cool operations on the IEnumerable interface such as ''.Where()'' which accepts lambda operations (oh my!).&lt;br /&gt;
|-&lt;br /&gt;
| System.Text.RegularExpressions || Introduces Regular Expressions (RegEx) to C# which allows for intricate operations on strings.&lt;br /&gt;
|-&lt;br /&gt;
| System.Collections || Holds other parts of the IEnumerable interface you will require when inheriting from that class.&lt;br /&gt;
|-&lt;br /&gt;
| System.Text || Contains the ''StringBuilder'' which accepts a list of strings and returns them in a specific way.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the namespaces for RimWorld in particular are these:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
! Namespace !! What does it do?&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld || Many classes can be found in this namespace.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.Planet || Everything (almost everything) having to do with the planet savefile is in here.&lt;br /&gt;
|-&lt;br /&gt;
| RimWorld.SquadAI || Holds the squad AI, clearly. You'll know it when you need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse || Sometimes more complex classes are found here.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.AI || You might never have to touch this either.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Grammar || Contains functionality for the Languages folder and other things having to do with text operations such as the art flavour text generator.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Noise || Something something you'll never need this.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Sound || Much like Verse.Noise except it's required to play sounds directly with your code.&lt;br /&gt;
|-&lt;br /&gt;
| Verse.Steam || Steam integration by Tynan - it's not active so you won't need it.&lt;br /&gt;
|-&lt;br /&gt;
| UnityEngine || Contains many more methods you most likely won't need.&lt;br /&gt;
|-&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The difference between RimWorld and Verse is not very clear and you might as well add both using statements whenever you want.&amp;lt;br/&amp;gt;&lt;br /&gt;
If you want to use the exact functionality of a base game class you're best off copying all its ''using'' statements, its ''namespace'' and the namespace of its parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Summary====&lt;br /&gt;
&lt;br /&gt;
This summary is part of the template but it's not required. It can help other people understand your code better when you provide the source but besides that you really don't need it.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Class and Constructor====&lt;br /&gt;
&lt;br /&gt;
This is your class definition. To access anything inside of a ''public class'' you will need a reference to an instance of that class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
MyClassNamefoo = new MyClassName();&lt;br /&gt;
&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The brackets at ''new MyClassName()'' indicate you're creating this instance without ''parameters'' which is possible because your class contains a constructor (anything inside of ''class MyClassName'' which has parameters and isn't a method, often abbreviated '''.ctor''') which accepts a call without parameters:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
public class MyClassName&lt;br /&gt;
{&lt;br /&gt;
	public MyClassName()	/* No parameters */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo, int bar)	/* Required parameters of datatypes string and int */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public MyClassName(string foo = &amp;quot;none supplied&amp;quot;, int bar = 42)	/* Default parameters &amp;quot; &amp;quot; &amp;quot; */&lt;br /&gt;
	{&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last implementation of the constructor (''MyNameSpace.MyClassName.MyClassName'' inside of ''MyNameSpace.MyClassName'') is capable of accepting zero to two parameters while the second implementation of the constructor will only accept calls with exactly two parameters.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Writing code=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/Decompiling source code|Decompile source code]] to take a look at the game's existing code;&lt;br /&gt;
## If you get stuck on anything, any modding questions can be asked on the [https://ludeon.com/forums/index.php?board=14.0 subforum],&lt;br /&gt;
# Compile your class into a .dll;&lt;br /&gt;
## Make sure your project's output type is &amp;quot;class library&amp;quot;;&lt;br /&gt;
## '' '''Note:''' by default, Visual Studio will compile all the references of the project as well, so you’ll get a copy of UnityEngine.dll and Assembly-CSharp.dll and some others. Just take ''MyModName.dll'' and place it in the ''MyModName/Assemblies'' folder. If you have [[Modding Tutorials/Setting up a solution|set up a solution]] according to the tutorial you don't have this problem,&lt;br /&gt;
# Reference the classes in your .dll from the xml data in the MyModName/Defs folder;&lt;br /&gt;
## '''Example:''' Create a new ThingDef with a &amp;lt;thingClass&amp;gt; that points to a class in your .dll,&lt;br /&gt;
# The game should load your class now;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Distribution|Distribution]] details how to release your mod.&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly modding example]] contains a small modding example.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38239</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38239"/>
		<updated>2015-11-09T21:48:18Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]].&lt;br /&gt;
* You will want to have an IDE installed: [[Modding Tutorials/Recommended software#IDE's|Recommended IDE's]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## Copy these files:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/RimWorld_Data/Managed/Assembly-CSharp.dll&amp;amp;#10;(RimWorldInstallFolder)/RimWorld_Data/Managed/UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Place them in your project:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source/(YourSolutionName)/Source-DLLs&amp;lt;/pre&amp;gt;&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse&amp;quot;, go to the folder you placed the copied DLLs;&lt;br /&gt;
## Choose both DLLs and click OK,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;Solution (YourSolutionName)&amp;quot; or just &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Change the debug info to &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to out&amp;quot; to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38224</id>
		<title>Modding Tutorials/Mod folder structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38224"/>
		<updated>2015-11-02T20:08:54Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Fixed main page links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Modding Tutorials/Mod folder structure#Complete mod folder structure|Complete mod folder structure]] is a list of all folders you might find in your average mod directory. This includes /Core/.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Folder structure|Exploring the Folder Structure]] starts off explaining the folder structure. This is part two if you will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the following mod structure:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Defs/&lt;br /&gt;
      (..)&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
    Sounds/&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        ProjectName.sln&lt;br /&gt;
    Textures/&lt;br /&gt;
&lt;br /&gt;
.. Along with a few tips on how to keep your mod folder structure readable and functional.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Standard mod folder structure=&lt;br /&gt;
&lt;br /&gt;
Mod folders are located in the mods folder, which is located as such:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  RimWorld******/&lt;br /&gt;
    Mods/&lt;br /&gt;
&lt;br /&gt;
..relative to your RimWorld install directory. Each mod is a sub folder of this Mods folder and each mod has to follow the following structure precisely.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The About folder==&lt;br /&gt;
{{Main|Modding Tutorials/About folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making a mod starts with you making a folder structure. Some mods need textures and sounds, while others are XML or even C# only.&amp;lt;br/&amp;gt;&lt;br /&gt;
Every mod does however require the following structure to show up in the mods list:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
&lt;br /&gt;
Along with this vital information it's possible to add a preview image for your mod. This makes the structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
&lt;br /&gt;
The size of the base game Preview.png is 400x61 pixels, but some mods use higher preview images. The image is centered in the mod's description, and can be of any size.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Defs folders==&lt;br /&gt;
{{Main|Modding Tutorials/Defs folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your mod adds new content, chances are you're going to use XML files. These files are going to be stored in the folder structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      BiomeDefs/&lt;br /&gt;
        Biomes.xml&lt;br /&gt;
      BodyDefs/&lt;br /&gt;
        Bodies.xml&lt;br /&gt;
      BodyPartDefs/&lt;br /&gt;
        BodyParts.xml&lt;br /&gt;
      (..)&lt;br /&gt;
&lt;br /&gt;
The contents of a Def folder don't follow a clear naming convention, but the folder names are generally the same in every mod.&amp;lt;br/&amp;gt;&lt;br /&gt;
Using a non-standard name is going to make it harder for others to navigate your mod's folders, so it is advised to keep the folder names consistent with the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typically, the files inside these folders are named after their contents:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Apparel_Hats.xml&lt;br /&gt;
        Apparel_Shield.xml&lt;br /&gt;
        (..)&lt;br /&gt;
        Weapons_Melee.xml&lt;br /&gt;
        Weapons_RangedNeolithic.xml&lt;br /&gt;
&lt;br /&gt;
This makes it easier for people to navigate XML code. If your mod is going to add both apparel and weapons, or even both hats and shoes, you're best off separating the XML code in their respective files.&amp;lt;br/&amp;gt;&lt;br /&gt;
Some mod authors choose to make a separate file for each of their items. This makes it easier for others to remove only part of your mod and keep the rest of it, but with very large mods it makes it harder to navigate the folder.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Textures and Sounds folders==&lt;br /&gt;
{{Main|Modding Tutorials/Textures folder|Modding Tutorials/Sounds folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using Defs chances are you're creating a content mod. This type of mod is most likely very dull without its own custom graphics and sounds. Adding such content requires the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Textures/&lt;br /&gt;
    Sounds/&lt;br /&gt;
&lt;br /&gt;
The contents of the Textures and Sounds folder usually aren't the same between mods. The base game sorts these files in various folders and subfolders, but in the end it's very hard to navigate them based on the folder names.&amp;lt;br/&amp;gt;&lt;br /&gt;
It's possible to categorize this content by item (submachinegun#1, pistol#3) or item type (guns, buildings), as an example. Whatever you do it's best to keep the structure consistent throughout both folders.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Source and Assemblies folders==&lt;br /&gt;
&lt;br /&gt;
If you want to take a shot at [[Modding Tutorials/Writing custom code|C# modding]], you want an '''empty''' Source and an '''empty''' Assemblies folder. You'll want to [[Modding Tutorials/Setting up a solution|create the C# project]] inside your Source folder, and compile the class library into the Assemblies folder. These things are processed automatically by your [[Modding Tutorials/Recommended software#IDE's|IDE]], so you don't have to make these folder structures yourself:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      SolutionName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName/&lt;br /&gt;
          ProjectName.csproj&lt;br /&gt;
          (..)&lt;br /&gt;
&lt;br /&gt;
''Or:''&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName.csproj&lt;br /&gt;
        (..)&lt;br /&gt;
&lt;br /&gt;
'''Once again''', the structure of these folders is decided almost entirely by the author's editing software. Therefore the only things you have to set up are the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
    Source/&lt;br /&gt;
&lt;br /&gt;
.. And then once you create a solution starting in ../YourModName/Source/ everything else will be sorted out by the software. People don't navigate these folders, they open ProjectName.sln to navigate it using their software of choice.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Languages folder==&lt;br /&gt;
{{Main|Modding Tutorials/Languages folder}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unless you're on a translation team, you're unlikely to need this folder a lot. If you want to randomly generate names using your own words, you will however have to use this folder:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
&lt;br /&gt;
In this folder you put .txt files with a new word on every line. Using XML you will then be able to randomly pick one of the lines in the file.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the average mod the rest of the folder is quite useless. You are unlikely to translate your mod into tens of different languages.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Complete mod folder structure=&lt;br /&gt;
&lt;br /&gt;
  */&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png-&lt;br /&gt;
    Assemblies/-&lt;br /&gt;
      *.dll+&lt;br /&gt;
    Defs/-&lt;br /&gt;
      *Defs/+&lt;br /&gt;
        *.xml+&lt;br /&gt;
    Languages/-&lt;br /&gt;
      */*&lt;br /&gt;
        DefInjected/-&lt;br /&gt;
          *Defs/+&lt;br /&gt;
            *.xml+&lt;br /&gt;
        Keyed/-&lt;br /&gt;
          *.xml+&lt;br /&gt;
        Strings/-&lt;br /&gt;
          NameBanks/&lt;br /&gt;
            *.txt+&lt;br /&gt;
        FriendlyName.txt-&lt;br /&gt;
        LangIcon.png&lt;br /&gt;
        LanguageInfo.xml&lt;br /&gt;
    Sounds/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.wav+&lt;br /&gt;
    Source/-&lt;br /&gt;
      */*#&lt;br /&gt;
        bin/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        obj/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        Properties/-&lt;br /&gt;
          AssemblyInfo.cs&lt;br /&gt;
        Source-DLLs/-&lt;br /&gt;
          Assembly-CSharp.dll&lt;br /&gt;
          UnityEngine.dll&lt;br /&gt;
        *.csproj&lt;br /&gt;
        *.OpenCover.Settings&lt;br /&gt;
        *.sln&lt;br /&gt;
        */*#&lt;br /&gt;
          *.cs+&lt;br /&gt;
    Textures/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.psd*&lt;br /&gt;
        *.psd.meta*&lt;br /&gt;
        *.png*&lt;br /&gt;
&lt;br /&gt;
  Anything with a / at the end is a folder;&lt;br /&gt;
  Anything with a . in it is a file;&lt;br /&gt;
  The * in *.* and */ stands for any arbitrary string;&lt;br /&gt;
  The * after a file/folder stands for an occurence of &amp;gt;= 0;&lt;br /&gt;
  The + after a file/folder stands for an occurrence of &amp;gt; 0;&lt;br /&gt;
  The - after a file/folder stands for an occurrence of &amp;lt;= 1;&lt;br /&gt;
  The # after a folder stands for a folder depth of &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
* [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38223</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=38223"/>
		<updated>2015-11-02T20:07:45Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Introduction */ Added sub pages for mod folder structure links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
#* [[Modding Tutorials/About folder|About folder]]&lt;br /&gt;
#* [[Modding Tutorials/Defs folder|Defs folder]]&lt;br /&gt;
#* [[Modding Tutorials/Languages folder|Languages folder]]&lt;br /&gt;
#* [[Modding Tutorials/Textures folder|Textures folder]]&lt;br /&gt;
#* [[Modding Tutorials/Sounds folder|Sounds folder]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
* [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
# [[Modding Tutorials/XML Defs|Introduction to XML Defs]]&lt;br /&gt;
#* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]]&lt;br /&gt;
# In-depth XML Def tutorials&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38222</id>
		<title>Modding Tutorials/Mod folder structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38222"/>
		<updated>2015-11-02T20:03:22Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Added requirements&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Modding Tutorials/Mod folder structure#Complete mod folder structure|Complete mod folder structure]] is a list of all folders you might find in your average mod directory. This includes /Core/.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Folder structure|Exploring the Folder Structure]] starts off explaining the folder structure. This is part two if you will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the following mod structure:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Defs/&lt;br /&gt;
      (..)&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
    Sounds/&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        ProjectName.sln&lt;br /&gt;
    Textures/&lt;br /&gt;
&lt;br /&gt;
.. Along with a few tips on how to keep your mod folder structure readable and functional.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Standard mod folder structure=&lt;br /&gt;
&lt;br /&gt;
Mod folders are located in the mods folder, which is located as such:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  RimWorld******/&lt;br /&gt;
    Mods/&lt;br /&gt;
&lt;br /&gt;
..relative to your RimWorld install directory. Each mod is a sub folder of this Mods folder and each mod has to follow the following structure precisely.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The About folder==&lt;br /&gt;
{{Main|Modding Tutorials/About}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making a mod starts with you making a folder structure. Some mods need textures and sounds, while others are XML or even C# only.&amp;lt;br/&amp;gt;&lt;br /&gt;
Every mod does however require the following structure to show up in the mods list:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
&lt;br /&gt;
Along with this vital information it's possible to add a preview image for your mod. This makes the structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
&lt;br /&gt;
The size of the base game Preview.png is 400x61 pixels, but some mods use higher preview images. The image is centered in the mod's description, and can be of any size.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Defs folders==&lt;br /&gt;
{{Main|Modding Tutorials/Defs}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your mod adds new content, chances are you're going to use XML files. These files are going to be stored in the folder structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      BiomeDefs/&lt;br /&gt;
        Biomes.xml&lt;br /&gt;
      BodyDefs/&lt;br /&gt;
        Bodies.xml&lt;br /&gt;
      BodyPartDefs/&lt;br /&gt;
        BodyParts.xml&lt;br /&gt;
      (..)&lt;br /&gt;
&lt;br /&gt;
The contents of a Def folder don't follow a clear naming convention, but the folder names are generally the same in every mod.&amp;lt;br/&amp;gt;&lt;br /&gt;
Using a non-standard name is going to make it harder for others to navigate your mod's folders, so it is advised to keep the folder names consistent with the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typically, the files inside these folders are named after their contents:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Apparel_Hats.xml&lt;br /&gt;
        Apparel_Shield.xml&lt;br /&gt;
        (..)&lt;br /&gt;
        Weapons_Melee.xml&lt;br /&gt;
        Weapons_RangedNeolithic.xml&lt;br /&gt;
&lt;br /&gt;
This makes it easier for people to navigate XML code. If your mod is going to add both apparel and weapons, or even both hats and shoes, you're best off separating the XML code in their respective files.&amp;lt;br/&amp;gt;&lt;br /&gt;
Some mod authors choose to make a separate file for each of their items. This makes it easier for others to remove only part of your mod and keep the rest of it, but with very large mods it makes it harder to navigate the folder.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Textures and Sounds folders==&lt;br /&gt;
{{Main|Modding Tutorials/Textures|Modding Tutorials/Sounds}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using Defs chances are you're creating a content mod. This type of mod is most likely very dull without its own custom graphics and sounds. Adding such content requires the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Textures/&lt;br /&gt;
    Sounds/&lt;br /&gt;
&lt;br /&gt;
The contents of the Textures and Sounds folder usually aren't the same between mods. The base game sorts these files in various folders and subfolders, but in the end it's very hard to navigate them based on the folder names.&amp;lt;br/&amp;gt;&lt;br /&gt;
It's possible to categorize this content by item (submachinegun#1, pistol#3) or item type (guns, buildings), as an example. Whatever you do it's best to keep the structure consistent throughout both folders.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Source and Assemblies folders==&lt;br /&gt;
&lt;br /&gt;
If you want to take a shot at [[Modding Tutorials/Writing custom code|C# modding]], you want an '''empty''' Source and an '''empty''' Assemblies folder. You'll want to [[Modding Tutorials/Setting up a solution|create the C# project]] inside your Source folder, and compile the class library into the Assemblies folder. These things are processed automatically by your [[Modding Tutorials/Recommended software#IDE's|IDE]], so you don't have to make these folder structures yourself:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      SolutionName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName/&lt;br /&gt;
          ProjectName.csproj&lt;br /&gt;
          (..)&lt;br /&gt;
&lt;br /&gt;
''Or:''&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName.csproj&lt;br /&gt;
        (..)&lt;br /&gt;
&lt;br /&gt;
'''Once again''', the structure of these folders is decided almost entirely by the author's editing software. Therefore the only things you have to set up are the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
    Source/&lt;br /&gt;
&lt;br /&gt;
.. And then once you create a solution starting in ../YourModName/Source/ everything else will be sorted out by the software. People don't navigate these folders, they open ProjectName.sln to navigate it using their software of choice.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Languages folder==&lt;br /&gt;
&lt;br /&gt;
Unless you're on a translation team, you're unlikely to need this folder a lot. If you want to randomly generate names using your own words, you will however have to use this folder:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
&lt;br /&gt;
In this folder you put .txt files with a new word on every line. Using XML you will then be able to randomly pick one of the lines in the file.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the average mod the rest of the folder is quite useless. You are unlikely to translate your mod into tens of different languages.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Complete mod folder structure=&lt;br /&gt;
&lt;br /&gt;
  */&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png-&lt;br /&gt;
    Assemblies/-&lt;br /&gt;
      *.dll+&lt;br /&gt;
    Defs/-&lt;br /&gt;
      *Defs/+&lt;br /&gt;
        *.xml+&lt;br /&gt;
    Languages/-&lt;br /&gt;
      */*&lt;br /&gt;
        DefInjected/-&lt;br /&gt;
          *Defs/+&lt;br /&gt;
            *.xml+&lt;br /&gt;
        Keyed/-&lt;br /&gt;
          *.xml+&lt;br /&gt;
        Strings/-&lt;br /&gt;
          NameBanks/&lt;br /&gt;
            *.txt+&lt;br /&gt;
        FriendlyName.txt-&lt;br /&gt;
        LangIcon.png&lt;br /&gt;
        LanguageInfo.xml&lt;br /&gt;
    Sounds/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.wav+&lt;br /&gt;
    Source/-&lt;br /&gt;
      */*#&lt;br /&gt;
        bin/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        obj/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        Properties/-&lt;br /&gt;
          AssemblyInfo.cs&lt;br /&gt;
        Source-DLLs/-&lt;br /&gt;
          Assembly-CSharp.dll&lt;br /&gt;
          UnityEngine.dll&lt;br /&gt;
        *.csproj&lt;br /&gt;
        *.OpenCover.Settings&lt;br /&gt;
        *.sln&lt;br /&gt;
        */*#&lt;br /&gt;
          *.cs+&lt;br /&gt;
    Textures/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.psd*&lt;br /&gt;
        *.psd.meta*&lt;br /&gt;
        *.png*&lt;br /&gt;
&lt;br /&gt;
  Anything with a / at the end is a folder;&lt;br /&gt;
  Anything with a . in it is a file;&lt;br /&gt;
  The * in *.* and */ stands for any arbitrary string;&lt;br /&gt;
  The * after a file/folder stands for an occurence of &amp;gt;= 0;&lt;br /&gt;
  The + after a file/folder stands for an occurrence of &amp;gt; 0;&lt;br /&gt;
  The - after a file/folder stands for an occurrence of &amp;lt;= 1;&lt;br /&gt;
  The # after a folder stands for a folder depth of &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
* [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38221</id>
		<title>Modding Tutorials/Setting up a solution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&amp;diff=38221"/>
		<updated>2015-11-02T19:50:47Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Setting up a solution */ Note on the method being different for other IDEs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to have [[Modding_Tutorials/Mod_folder_structure#The Source and Assemblies folders|set up a Source and Assemblies folder]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Setting up a solution=&lt;br /&gt;
Setting up can be different for different IDE's. Feel free to add '''''complete''''' instructions for your IDE of choice.&lt;br /&gt;
&lt;br /&gt;
===Sharpdevelop===&lt;br /&gt;
# Create a new class library project in your [[Modding Tutorials/Recommended software#IDE.27s|IDE of choice]];&lt;br /&gt;
## Go to File -&amp;gt; New -&amp;gt; Solution;&lt;br /&gt;
## Go to C# or .NET -&amp;gt; Library or Class Library (NOT portable);&lt;br /&gt;
## Enter a project name (solution name automatically updated);&lt;br /&gt;
## Choose a location, preferably:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source&amp;lt;/pre&amp;gt;&lt;br /&gt;
## ''Optional'': Untick &amp;quot;Create a directory for solution&amp;quot;/&amp;quot;Create a project within the solution directory&amp;quot;,&lt;br /&gt;
# In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:&lt;br /&gt;
## Copy these files:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/RimWorld_Data/Managed/Assembly-CSharp.dll&amp;amp;#10;(RimWorldInstallFolder)/RimWorld_Data/Managed/UnityEngine.dll&amp;lt;/pre&amp;gt;&lt;br /&gt;
## Place them in your project:&amp;lt;br/&amp;gt;&amp;lt;pre&amp;gt;(RimWorldInstallFolder)/Mods/(YourModName)/Source/(YourSolutionName)/Source-DLLs&amp;lt;/pre&amp;gt;&lt;br /&gt;
## In your IDE project file browser, right-click the &amp;quot;References&amp;quot; folder and &amp;quot;Add reference&amp;quot;;&lt;br /&gt;
## Choose the &amp;quot;.NET Assembly Browser&amp;quot; tab and &amp;quot;Browse&amp;quot;, go to the folder you placed the copied DLLs;&lt;br /&gt;
## Choose both DLLs and click OK,&lt;br /&gt;
# In your project properties, change the target framework to .NET 3.5:&lt;br /&gt;
## In your IDE project file browser, right-click &amp;quot;Solution (YourSolutionName)&amp;quot; or just &amp;quot;(YourSolutionName)&amp;quot;;&lt;br /&gt;
## Choose Properties;&lt;br /&gt;
## Go to the &amp;quot;Compiling&amp;quot; tab, &amp;quot;Output&amp;quot;, &amp;quot;Target framework&amp;quot;, &amp;quot;Change&amp;quot; and choose &amp;quot;.NET Framework 3.5&amp;quot;,&lt;br /&gt;
# In your project properties, change the build events so only a single file is built:&lt;br /&gt;
## Change the debug info to &amp;quot;No debug information&amp;quot;;&lt;br /&gt;
## In the References folder, right-click Assembly-CSharp -&amp;gt; Properties and change &amp;quot;Local copy&amp;quot; to False. Do the same for UnityEngine;&lt;br /&gt;
## Right-click your .cs files -&amp;gt; Properties and change &amp;quot;Copy to out&amp;quot; to Never,&lt;br /&gt;
# In your project properties, fix the output location to put the DLL in the Assemblies folder:&lt;br /&gt;
## Change the output path to &amp;quot;..\..\Assemblies\&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] continues on setting up your solution.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Talk:Modding_Tutorials/Setting_up_a_solution/Specific_IDE_instructions/reply&amp;diff=38220</id>
		<title>Talk:Modding Tutorials/Setting up a solution/Specific IDE instructions/reply</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Talk:Modding_Tutorials/Setting_up_a_solution/Specific_IDE_instructions/reply&amp;diff=38220"/>
		<updated>2015-11-02T19:48:01Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Reply to Specific IDE instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Feel free to add subsections to &amp;quot;Setting up a solution&amp;quot; for MonoDevelop. I wrote the page for SharpDevelop and have no access to MonoDevelop myself.&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38219</id>
		<title>Modding Tutorials/Mod folder structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Mod_folder_structure&amp;diff=38219"/>
		<updated>2015-11-02T18:25:46Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Standard mod folder structure */ Added info regarding Mods folder&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial introduces you to the mod folder structure and shows you a standard folder structure setup to help you start out.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Modding Tutorials/Mod folder structure#Complete mod folder structure|Complete mod folder structure]] is a list of all folders you might find in your average mod directory. This includes /Core/.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the following mod structure:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Defs/&lt;br /&gt;
      (..)&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
    Sounds/&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        ProjectName.sln&lt;br /&gt;
    Textures/&lt;br /&gt;
&lt;br /&gt;
.. Along with a few tips on how to keep your mod folder structure readable and functional.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Standard mod folder structure=&lt;br /&gt;
&lt;br /&gt;
Mod folders are located in the mods folder, which is located as such:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  RimWorld******/&lt;br /&gt;
    Mods/&lt;br /&gt;
&lt;br /&gt;
..relative to your RimWorld install directory. Each mod is a sub folder of this Mods folder and each mod has to follow the following structure precisely.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The About folder==&lt;br /&gt;
{{Main|Modding Tutorials/About}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Making a mod starts with you making a folder structure. Some mods need textures and sounds, while others are XML or even C# only.&amp;lt;br/&amp;gt;&lt;br /&gt;
Every mod does however require the following structure to show up in the mods list:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
&lt;br /&gt;
Along with this vital information it's possible to add a preview image for your mod. This makes the structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png&lt;br /&gt;
&lt;br /&gt;
The size of the base game Preview.png is 400x61 pixels, but some mods use higher preview images. The image is centered in the mod's description, and can be of any size.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Defs folders==&lt;br /&gt;
{{Main|Modding Tutorials/Defs}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If your mod adds new content, chances are you're going to use XML files. These files are going to be stored in the folder structure as follows:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      BiomeDefs/&lt;br /&gt;
        Biomes.xml&lt;br /&gt;
      BodyDefs/&lt;br /&gt;
        Bodies.xml&lt;br /&gt;
      BodyPartDefs/&lt;br /&gt;
        BodyParts.xml&lt;br /&gt;
      (..)&lt;br /&gt;
&lt;br /&gt;
The contents of a Def folder don't follow a clear naming convention, but the folder names are generally the same in every mod.&amp;lt;br/&amp;gt;&lt;br /&gt;
Using a non-standard name is going to make it harder for others to navigate your mod's folders, so it is advised to keep the folder names consistent with the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Typically, the files inside these folders are named after their contents:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Apparel_Hats.xml&lt;br /&gt;
        Apparel_Shield.xml&lt;br /&gt;
        (..)&lt;br /&gt;
        Weapons_Melee.xml&lt;br /&gt;
        Weapons_RangedNeolithic.xml&lt;br /&gt;
&lt;br /&gt;
This makes it easier for people to navigate XML code. If your mod is going to add both apparel and weapons, or even both hats and shoes, you're best off separating the XML code in their respective files.&amp;lt;br/&amp;gt;&lt;br /&gt;
Some mod authors choose to make a separate file for each of their items. This makes it easier for others to remove only part of your mod and keep the rest of it, but with very large mods it makes it harder to navigate the folder.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Textures and Sounds folders==&lt;br /&gt;
{{Main|Modding Tutorials/Textures|Modding Tutorials/Sounds}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you're using Defs chances are you're creating a content mod. This type of mod is most likely very dull without its own custom graphics and sounds. Adding such content requires the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Textures/&lt;br /&gt;
    Sounds/&lt;br /&gt;
&lt;br /&gt;
The contents of the Textures and Sounds folder usually aren't the same between mods. The base game sorts these files in various folders and subfolders, but in the end it's very hard to navigate them based on the folder names.&amp;lt;br/&amp;gt;&lt;br /&gt;
It's possible to categorize this content by item (submachinegun#1, pistol#3) or item type (guns, buildings), as an example. Whatever you do it's best to keep the structure consistent throughout both folders.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Source and Assemblies folders==&lt;br /&gt;
&lt;br /&gt;
If you want to take a shot at [[Modding Tutorials/Writing custom code|C# modding]], you want an '''empty''' Source and an '''empty''' Assemblies folder. You'll want to [[Modding Tutorials/Setting up a solution|create the C# project]] inside your Source folder, and compile the class library into the Assemblies folder. These things are processed automatically by your [[Modding Tutorials/Recommended software#IDE's|IDE]], so you don't have to make these folder structures yourself:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      SolutionName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName/&lt;br /&gt;
          ProjectName.csproj&lt;br /&gt;
          (..)&lt;br /&gt;
&lt;br /&gt;
''Or:''&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
      ProjectName.dll&lt;br /&gt;
    Source/&lt;br /&gt;
      ProjectName/&lt;br /&gt;
        SolutionName.sln&lt;br /&gt;
        ProjectName.csproj&lt;br /&gt;
        (..)&lt;br /&gt;
&lt;br /&gt;
'''Once again''', the structure of these folders is decided almost entirely by the author's editing software. Therefore the only things you have to set up are the following folders:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Assemblies/&lt;br /&gt;
    Source/&lt;br /&gt;
&lt;br /&gt;
.. And then once you create a solution starting in ../YourModName/Source/ everything else will be sorted out by the software. People don't navigate these folders, they open ProjectName.sln to navigate it using their software of choice.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==The Languages folder==&lt;br /&gt;
&lt;br /&gt;
Unless you're on a translation team, you're unlikely to need this folder a lot. If you want to randomly generate names using your own words, you will however have to use this folder:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Languages/&lt;br /&gt;
      English/&lt;br /&gt;
        Strings/&lt;br /&gt;
          NameBanks/&lt;br /&gt;
&lt;br /&gt;
In this folder you put .txt files with a new word on every line. Using XML you will then be able to randomly pick one of the lines in the file.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the average mod the rest of the folder is quite useless. You are unlikely to translate your mod into tens of different languages.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Complete mod folder structure=&lt;br /&gt;
&lt;br /&gt;
  */&lt;br /&gt;
    About/&lt;br /&gt;
      About.xml&lt;br /&gt;
      Preview.png-&lt;br /&gt;
    Assemblies/-&lt;br /&gt;
      *.dll+&lt;br /&gt;
    Defs/-&lt;br /&gt;
      *Defs/+&lt;br /&gt;
        *.xml+&lt;br /&gt;
    Languages/-&lt;br /&gt;
      */*&lt;br /&gt;
        DefInjected/-&lt;br /&gt;
          *Defs/+&lt;br /&gt;
            *.xml+&lt;br /&gt;
        Keyed/-&lt;br /&gt;
          *.xml+&lt;br /&gt;
        Strings/-&lt;br /&gt;
          NameBanks/&lt;br /&gt;
            *.txt+&lt;br /&gt;
        FriendlyName.txt-&lt;br /&gt;
        LangIcon.png&lt;br /&gt;
        LanguageInfo.xml&lt;br /&gt;
    Sounds/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.wav+&lt;br /&gt;
    Source/-&lt;br /&gt;
      */*#&lt;br /&gt;
        bin/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        obj/&lt;br /&gt;
          Debug/&lt;br /&gt;
            *.**&lt;br /&gt;
        Properties/-&lt;br /&gt;
          AssemblyInfo.cs&lt;br /&gt;
        Source-DLLs/-&lt;br /&gt;
          Assembly-CSharp.dll&lt;br /&gt;
          UnityEngine.dll&lt;br /&gt;
        *.csproj&lt;br /&gt;
        *.OpenCover.Settings&lt;br /&gt;
        *.sln&lt;br /&gt;
        */*#&lt;br /&gt;
          *.cs+&lt;br /&gt;
    Textures/-&lt;br /&gt;
      */*#&lt;br /&gt;
        *.psd*&lt;br /&gt;
        *.psd.meta*&lt;br /&gt;
        *.png*&lt;br /&gt;
&lt;br /&gt;
  Anything with a / at the end is a folder;&lt;br /&gt;
  Anything with a . in it is a file;&lt;br /&gt;
  The * in *.* and */ stands for any arbitrary string;&lt;br /&gt;
  The * after a file/folder stands for an occurence of &amp;gt;= 0;&lt;br /&gt;
  The + after a file/folder stands for an occurrence of &amp;gt; 0;&lt;br /&gt;
  The - after a file/folder stands for an occurrence of &amp;lt;= 1;&lt;br /&gt;
  The # after a folder stands for a folder depth of &amp;gt;= 0.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
* [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37651</id>
		<title>Modding Tutorials/Compatibility with defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37651"/>
		<updated>2015-10-02T08:30:51Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Next up */ Added more compatibility guides&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn different ways to make XML mods compatible and how to link existing and modded recipes, facilities and buildings with eachother.&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn how to implement your mods into existing defs, how to fix compatibility between XML mods and how to make modded recipes, facilities and buildings interact with eachother without overwriting the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Overwriting defs=&lt;br /&gt;
===Core defs===&lt;br /&gt;
&lt;br /&gt;
The least elegant way to go about compatibility is to have a modified copy of a core def in your mod file. You have to rely on load order to make the mod work, let's say you want to change the damage of a pistol:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        YourFileName.xml&lt;br /&gt;
&lt;br /&gt;
.. and contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;!-- base parent &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;ThingDef ParentName=&amp;quot;BaseBullet&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;Bullet_Pistol&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;projectile&amp;gt;&lt;br /&gt;
			&amp;lt;DamageAmountBase&amp;gt;9&amp;lt;/DamageAmountBase&amp;gt;&lt;br /&gt;
		&amp;lt;/projectile&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code adds something that already exists on the /Core/ mod - to make it overwrite the core mod, this mod has to be loaded after it. Practically every mod is loaded after the core mod, so this shouldn't be a problem.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem arises when multiple mods edit ''Bullet_Pistol'', and as a rule of thumb the last loaded version of a defName is kept.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Mod defs===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!colspan=3| I modify.. !! What do?&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Core.. ||colspan=2| ..Def values || Add the defs you want to overwrite to your mod and load the mod after Core&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || Add the defs you want to overwrite to your mod and load the mod after Core, use C# to [[Modding Tutorials/Modifying defs|modify def classes]].&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=8| ..a mod's.. ||rowspan=3| ..Def changes.. || ..directly || Make a choice which value to keep (merge them if possible) - if it's the only difference in the core def overwrites between the mods, simply loading one after the other will fix the compatibility, if that's not possible make a merged patch&lt;br /&gt;
|-&lt;br /&gt;
| ..collaterally || The easiest way to fix this is by making a patch, including the same def with both modifications applied to them - this def can then be loaded after both of the mods&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| (both of the above) || Make a compatibility patch: take the def from both mods and try to merge as many values as you can, compare it to the core def, see if you can figure it out through XML only&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Class reference changes.. || ..directly || E.g &amp;lt;thingClass&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..not directly || E.g Mod A &amp;lt;ThingDef&amp;gt; and Mod B &amp;lt;projectile&amp;gt; Class changes: this will work fine with an XML patch&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Def values.. || ..intentionally || Add the defs you want to overwrite to your mod and load it after their mod&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..unintentionally || Rename your defs, try to figure the compatibility out through contacting the author, make a compatibility patch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || E.g &amp;lt;ThingDef Class=&amp;quot;namespace.class&amp;quot;&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If your mod requires another mod to function and you want to change something about their mod, let's say CustomShotgun should do 20 damage instead of 25, your mod has to include CustomShotgun's def and be loaded after their mod.&lt;br /&gt;
# Mod A changes CoreDef's label to &amp;quot;hunting shotgun&amp;quot;, mod B changes CoreDef's soundInteract to &amp;quot;InteractPistol&amp;quot;, patch AB does both to fix their compatibility issues.&lt;br /&gt;
# When mod A adds Class=&amp;quot;ModANamespace.ModAClass&amp;quot; to a defName's ThingDef and mod B adds Class=&amp;quot;ModBNamespace.ModBClass&amp;quot; this is a non XML-patchable incompatibility. This means that if A adds a Class to the &amp;lt;projectile&amp;gt; tag and B adds a Class to the &amp;lt;thingDef&amp;gt; tag you're perfectly fine. This tutorial won't cover creating DLL patches because it's more in-depth, but [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]] and [[Modding Tutorials/Injection|C# injection]] will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Referencing defs=&lt;br /&gt;
===RecipeDef===&lt;br /&gt;
&lt;br /&gt;
In case your mod adds a new recipe for the [[Cook stove]], you might think it's necessary to overwrite part of its thingDef. This is however completely unnecessary - the C# code base contains a tag which allows you to make your ''recipe'' choose which ''building'' to attach to (instead of the other way round):&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;RecipeDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeBread&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipeMaker&amp;gt;&lt;br /&gt;
			&amp;lt;recipeUsers&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;CookStove&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/recipeUsers&amp;gt;&lt;br /&gt;
			&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
		&amp;lt;/recipeMaker&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/RecipeDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want your ''building'' to choose which ''recipes'' to display, you do the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeryOven&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipes&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;BakeBread&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/recipes&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The BakeBread recipe will now show up in both the BakeryOven and CookStove, without the mod having to modify CookStove's &amp;lt;recipes&amp;gt; list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Facilities===&lt;br /&gt;
&lt;br /&gt;
Buildings with the &amp;quot;CompAffectedByFacilities&amp;quot; compClass can choose which facilities should link to them. In the base game it isn't used the other way round - facilities don't do this - but the C# code base has a tag for it:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BadIdeaShredder&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompFacility&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
					&amp;lt;ResearchSpeedFactor&amp;gt;0.05&amp;lt;/ResearchSpeedFactor&amp;gt;&lt;br /&gt;
				&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;linkableBuildings&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ResearchBench&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableBuildings&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linking existing facilities to modded buildings is also possible by doing what existing buildings already do:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;MyFirstWorkshop&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompAffectedByFacilities&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;linkableFacilities&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ToolCabinet&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableFacilities&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BadIdeaShredder can now be attached to the vanilla ResearchBench, and the vanilla ToolCabinet can now be attached to MyFirstWorkshop.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]] explains compatibility from the Def Class side of things.&lt;br /&gt;
* [[Modding Tutorials/Compatibility with DLLs|Create a DLL patch]] continues explanations on compatibility patching and referencing existing items.&lt;br /&gt;
* [[Modding Tutorials/Injection|C# injection]] is an in-depth guide on using C# injection to resolve compatibility issues.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Recommended_software&amp;diff=37650</id>
		<title>Modding Tutorials/Recommended software</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Recommended_software&amp;diff=37650"/>
		<updated>2015-10-02T08:28:24Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Added next up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
This tutorial lists a few programs you could use to edit XML and C# code.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=XML Code Editors=&lt;br /&gt;
&lt;br /&gt;
===Basic Editors===&lt;br /&gt;
&lt;br /&gt;
Just about any text editor can write XML code, but as a modder you will want to at the very least see when you forgot closing brackets, a closing tag and other syntax errors.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notepad doesn't do this, so if you're even somewhat serious about modding, the following software will help you immensely:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://notepad-plus-plus.org/download/ Notepad++] || Windows || Has well implemented auto-completion and a very customizable user interface. Can be used to write both XML and C# code, although C# software usually has its own text editor&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.sublimetext.com/ Sublime Text] || Mono || Natively supports many programming languages and markup languages, and its functionality can be extended by users with plugins - A brief overview of its functionality can be found [http://webdesign.tutsplus.com/tutorials/useful-shortcuts-for-a-faster-workflow-in-sublime-text-3--cms-22185 here] and a full course [http://code.tutsplus.com/courses/perfect-workflow-in-sublime-text-2 here]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.pnotepad.org/download/ Programmer's Notepad] || Windows || More lightweight with a less cluttered interface than Notepad++, also capable of editing both XML and C# code&lt;br /&gt;
|-&lt;br /&gt;
| [http://xmlnotepad.codeplex.com/releases/ XML Notepad] || Windows || XML-oriented editor with a lot of features you will most likely never use in Rimworld modding&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Advanced Editors===&lt;br /&gt;
&lt;br /&gt;
There's many editors out there specifically made for XML code. Because Rimworld uses XML in a very simple way, advanced code editors are rarely needed. In case you're ever in need of one, however, the following ones might help:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/xpontus/files/ XPontus] || Windows || Has a tree view and is capable of checking XML for errors, fixing tabs and creating schema's detailing every tag's data types&lt;br /&gt;
|-&lt;br /&gt;
| [http://xmlgrid.net/ XMLGrid] || - || Capable of validating XML and turning it into Excel Spreadsheets, XSD Charts and an online table detailing each tag of a certain type and its contents&lt;br /&gt;
|-&lt;br /&gt;
| [http://codebeautify.org/xmlviewer Codebeautify's xmlviewer] || - || Can display as a tree view, automatically format/indent your code and can validate and show errors too. Also have a function share code (like [http://codebeautify.org/xmlviewer/b39586 that])&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=IDE's=&lt;br /&gt;
&lt;br /&gt;
C# code is best edited in an IDE (Integrated Development Environment) to make the process of editing code, managing a solution's content and compiling its projects both easier and faster. Any IDE for C# will probably work just fine, so here's a list of suggested editors:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.visualstudio.com/ Visual Studio] || Windows || Very extensive IDE with paid, trial and free versions. Any of these versions will probably work, so you might as well take [https://www.visualstudio.com/products/visual-studio-community-vs Visual Studio Community 2013] which is free for individuals and small teams&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.icsharpcode.net/OpenSource/SD/Download/ SharpDevelop] || Windows || Free IDE specifically made for C#&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.monodevelop.com/download/ MonoDevelop] || Mono&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt; || Free, cross-platform IDE with customizable user interface. Has support for C# as well as some other languages you won't need for Rimworld&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
# Windows, Mac and Linux&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Whichever IDE you choose, make sure it's capable of compiling for .NET Framework 3.5. If you for whatever reason don't have this framework installed, you can download it [https://www.microsoft.com/en-us/download/details.aspx?id=21 here].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Additional C# Software=&lt;br /&gt;
&lt;br /&gt;
Besides your IDE it's strongly recommended to install the following software for decompiling:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://ilspy.net/ ILSpy] || Windows || Software which is capable of [[Modding Tutorials/Decompiling source code|decompiling source code]], which is very useful in Rimworld modding&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.monodevelop.com/download/ MonoDevelop] || Mono || The Linux version of the software has an integrated decompiler for .DLLs&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Graphics Software=&lt;br /&gt;
&lt;br /&gt;
For making textures you will need graphics software. Any image editing program should work, and if you have an alternative to the following links that's probably okay:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.photofiltre-studio.com/download-en.htm Photofiltre Studio] || Windows || Functional software with very little user interface clutter for its applications. Doesn't support pen tablet, and has a 100% free (non-trial) version called [http://photofiltre.free.fr/download_en.htm Photofiltre]&lt;br /&gt;
|-&lt;br /&gt;
| [http://inkscape.org/en/download/ Inkscape] || Mono || Free vector graphic program with a steeper learning curve due to the vector based image editing. Vector graphics can look better than bitmap graphics in Rimworld&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.photoshop.com/products Photoshop] || Windows/Mac || Paid software with a trial version. Rimworld's original graphics are made in Photoshop (they're .PSD files)&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gimp.org/ Gimp] || Mono || A free, open-source alternative to Photoshop that's been around since 1998. Gimp has a large user community, with great list of [http://www.gimp.org/tutorials/ tutorials] on the official sites&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Audio Software=&lt;br /&gt;
&lt;br /&gt;
Recording your own audio for mods might be too much to ask, but editing audio is always possible. This can be done with the following software or your own alternative:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Software !! OS !! Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/audacity/ Audacity] || Mono || Audio editing software with many tutorials online, lots of useful functionality and a relatively readable interface&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]] starts you off with the XML side of modding.&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]] starts you off with the C# side of modding. Knowledge of the XML part can and will be very useful.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37649</id>
		<title>Modding Tutorials/Compatibility with defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37649"/>
		<updated>2015-10-02T08:25:11Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Facilities */ Clarified which are modded and which are vanilla buildings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn different ways to make XML mods compatible and how to link existing and modded recipes, facilities and buildings with eachother.&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn how to implement your mods into existing defs, how to fix compatibility between XML mods and how to make modded recipes, facilities and buildings interact with eachother without overwriting the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Overwriting defs=&lt;br /&gt;
===Core defs===&lt;br /&gt;
&lt;br /&gt;
The least elegant way to go about compatibility is to have a modified copy of a core def in your mod file. You have to rely on load order to make the mod work, let's say you want to change the damage of a pistol:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        YourFileName.xml&lt;br /&gt;
&lt;br /&gt;
.. and contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;!-- base parent &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;ThingDef ParentName=&amp;quot;BaseBullet&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;Bullet_Pistol&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;projectile&amp;gt;&lt;br /&gt;
			&amp;lt;DamageAmountBase&amp;gt;9&amp;lt;/DamageAmountBase&amp;gt;&lt;br /&gt;
		&amp;lt;/projectile&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code adds something that already exists on the /Core/ mod - to make it overwrite the core mod, this mod has to be loaded after it. Practically every mod is loaded after the core mod, so this shouldn't be a problem.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem arises when multiple mods edit ''Bullet_Pistol'', and as a rule of thumb the last loaded version of a defName is kept.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Mod defs===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!colspan=3| I modify.. !! What do?&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Core.. ||colspan=2| ..Def values || Add the defs you want to overwrite to your mod and load the mod after Core&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || Add the defs you want to overwrite to your mod and load the mod after Core, use C# to [[Modding Tutorials/Modifying defs|modify def classes]].&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=8| ..a mod's.. ||rowspan=3| ..Def changes.. || ..directly || Make a choice which value to keep (merge them if possible) - if it's the only difference in the core def overwrites between the mods, simply loading one after the other will fix the compatibility, if that's not possible make a merged patch&lt;br /&gt;
|-&lt;br /&gt;
| ..collaterally || The easiest way to fix this is by making a patch, including the same def with both modifications applied to them - this def can then be loaded after both of the mods&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| (both of the above) || Make a compatibility patch: take the def from both mods and try to merge as many values as you can, compare it to the core def, see if you can figure it out through XML only&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Class reference changes.. || ..directly || E.g &amp;lt;thingClass&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..not directly || E.g Mod A &amp;lt;ThingDef&amp;gt; and Mod B &amp;lt;projectile&amp;gt; Class changes: this will work fine with an XML patch&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Def values.. || ..intentionally || Add the defs you want to overwrite to your mod and load it after their mod&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..unintentionally || Rename your defs, try to figure the compatibility out through contacting the author, make a compatibility patch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || E.g &amp;lt;ThingDef Class=&amp;quot;namespace.class&amp;quot;&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If your mod requires another mod to function and you want to change something about their mod, let's say CustomShotgun should do 20 damage instead of 25, your mod has to include CustomShotgun's def and be loaded after their mod.&lt;br /&gt;
# Mod A changes CoreDef's label to &amp;quot;hunting shotgun&amp;quot;, mod B changes CoreDef's soundInteract to &amp;quot;InteractPistol&amp;quot;, patch AB does both to fix their compatibility issues.&lt;br /&gt;
# When mod A adds Class=&amp;quot;ModANamespace.ModAClass&amp;quot; to a defName's ThingDef and mod B adds Class=&amp;quot;ModBNamespace.ModBClass&amp;quot; this is a non XML-patchable incompatibility. This means that if A adds a Class to the &amp;lt;projectile&amp;gt; tag and B adds a Class to the &amp;lt;thingDef&amp;gt; tag you're perfectly fine. This tutorial won't cover creating DLL patches because it's more in-depth, but [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]] and [[Modding Tutorials/Injection|C# injection]] will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Referencing defs=&lt;br /&gt;
===RecipeDef===&lt;br /&gt;
&lt;br /&gt;
In case your mod adds a new recipe for the [[Cook stove]], you might think it's necessary to overwrite part of its thingDef. This is however completely unnecessary - the C# code base contains a tag which allows you to make your ''recipe'' choose which ''building'' to attach to (instead of the other way round):&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;RecipeDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeBread&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipeMaker&amp;gt;&lt;br /&gt;
			&amp;lt;recipeUsers&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;CookStove&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/recipeUsers&amp;gt;&lt;br /&gt;
			&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
		&amp;lt;/recipeMaker&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/RecipeDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want your ''building'' to choose which ''recipes'' to display, you do the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeryOven&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipes&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;BakeBread&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/recipes&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The BakeBread recipe will now show up in both the BakeryOven and CookStove, without the mod having to modify CookStove's &amp;lt;recipes&amp;gt; list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Facilities===&lt;br /&gt;
&lt;br /&gt;
Buildings with the &amp;quot;CompAffectedByFacilities&amp;quot; compClass can choose which facilities should link to them. In the base game it isn't used the other way round - facilities don't do this - but the C# code base has a tag for it:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BadIdeaShredder&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompFacility&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
					&amp;lt;ResearchSpeedFactor&amp;gt;0.05&amp;lt;/ResearchSpeedFactor&amp;gt;&lt;br /&gt;
				&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;linkableBuildings&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ResearchBench&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableBuildings&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linking existing facilities to modded buildings is also possible by doing what existing buildings already do:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;MyFirstWorkshop&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompAffectedByFacilities&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;linkableFacilities&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ToolCabinet&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableFacilities&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BadIdeaShredder can now be attached to the vanilla ResearchBench, and the vanilla ToolCabinet can now be attached to MyFirstWorkshop.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with DLLs|Create a DLL patch]] continues explanations on compatibility patching and referencing existing items.&lt;br /&gt;
* [[Modding Tutorials/Injection|C# injection]] is an in-depth guide on using C# injection to resolve compatibility issues.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37648</id>
		<title>Modding Tutorials/Compatibility with defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37648"/>
		<updated>2015-10-02T08:21:42Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Referencing defs */ Changed Smithing bench to Cook stove to make sense for the example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn different ways to make XML mods compatible and how to link existing and modded recipes, facilities and buildings with eachother.&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn how to implement your mods into existing defs, how to fix compatibility between XML mods and how to make modded recipes, facilities and buildings interact with eachother without overwriting the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Overwriting defs=&lt;br /&gt;
===Core defs===&lt;br /&gt;
&lt;br /&gt;
The least elegant way to go about compatibility is to have a modified copy of a core def in your mod file. You have to rely on load order to make the mod work, let's say you want to change the damage of a pistol:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        YourFileName.xml&lt;br /&gt;
&lt;br /&gt;
.. and contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;!-- base parent &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;ThingDef ParentName=&amp;quot;BaseBullet&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;Bullet_Pistol&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;projectile&amp;gt;&lt;br /&gt;
			&amp;lt;DamageAmountBase&amp;gt;9&amp;lt;/DamageAmountBase&amp;gt;&lt;br /&gt;
		&amp;lt;/projectile&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code adds something that already exists on the /Core/ mod - to make it overwrite the core mod, this mod has to be loaded after it. Practically every mod is loaded after the core mod, so this shouldn't be a problem.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem arises when multiple mods edit ''Bullet_Pistol'', and as a rule of thumb the last loaded version of a defName is kept.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Mod defs===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!colspan=3| I modify.. !! What do?&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Core.. ||colspan=2| ..Def values || Add the defs you want to overwrite to your mod and load the mod after Core&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || Add the defs you want to overwrite to your mod and load the mod after Core, use C# to [[Modding Tutorials/Modifying defs|modify def classes]].&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=8| ..a mod's.. ||rowspan=3| ..Def changes.. || ..directly || Make a choice which value to keep (merge them if possible) - if it's the only difference in the core def overwrites between the mods, simply loading one after the other will fix the compatibility, if that's not possible make a merged patch&lt;br /&gt;
|-&lt;br /&gt;
| ..collaterally || The easiest way to fix this is by making a patch, including the same def with both modifications applied to them - this def can then be loaded after both of the mods&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| (both of the above) || Make a compatibility patch: take the def from both mods and try to merge as many values as you can, compare it to the core def, see if you can figure it out through XML only&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Class reference changes.. || ..directly || E.g &amp;lt;thingClass&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..not directly || E.g Mod A &amp;lt;ThingDef&amp;gt; and Mod B &amp;lt;projectile&amp;gt; Class changes: this will work fine with an XML patch&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Def values.. || ..intentionally || Add the defs you want to overwrite to your mod and load it after their mod&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..unintentionally || Rename your defs, try to figure the compatibility out through contacting the author, make a compatibility patch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || E.g &amp;lt;ThingDef Class=&amp;quot;namespace.class&amp;quot;&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If your mod requires another mod to function and you want to change something about their mod, let's say CustomShotgun should do 20 damage instead of 25, your mod has to include CustomShotgun's def and be loaded after their mod.&lt;br /&gt;
# Mod A changes CoreDef's label to &amp;quot;hunting shotgun&amp;quot;, mod B changes CoreDef's soundInteract to &amp;quot;InteractPistol&amp;quot;, patch AB does both to fix their compatibility issues.&lt;br /&gt;
# When mod A adds Class=&amp;quot;ModANamespace.ModAClass&amp;quot; to a defName's ThingDef and mod B adds Class=&amp;quot;ModBNamespace.ModBClass&amp;quot; this is a non XML-patchable incompatibility. This means that if A adds a Class to the &amp;lt;projectile&amp;gt; tag and B adds a Class to the &amp;lt;thingDef&amp;gt; tag you're perfectly fine. This tutorial won't cover creating DLL patches because it's more in-depth, but [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]] and [[Modding Tutorials/Injection|C# injection]] will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Referencing defs=&lt;br /&gt;
===RecipeDef===&lt;br /&gt;
&lt;br /&gt;
In case your mod adds a new recipe for the [[Cook stove]], you might think it's necessary to overwrite part of its thingDef. This is however completely unnecessary - the C# code base contains a tag which allows you to make your ''recipe'' choose which ''building'' to attach to (instead of the other way round):&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;RecipeDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeBread&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipeMaker&amp;gt;&lt;br /&gt;
			&amp;lt;recipeUsers&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;CookStove&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/recipeUsers&amp;gt;&lt;br /&gt;
			&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
		&amp;lt;/recipeMaker&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/RecipeDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want your ''building'' to choose which ''recipes'' to display, you do the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeryOven&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipes&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;BakeBread&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/recipes&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The BakeBread recipe will now show up in both the BakeryOven and CookStove, without the mod having to modify CookStove's &amp;lt;recipes&amp;gt; list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Facilities===&lt;br /&gt;
&lt;br /&gt;
Buildings with the &amp;quot;CompAffectedByFacilities&amp;quot; compClass can choose which facilities should link to them. In the base game it isn't used the other way round - facilities don't do this - but the C# code base has a tag for it:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BadIdeaShredder&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompFacility&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
					&amp;lt;ResearchSpeedFactor&amp;gt;0.05&amp;lt;/ResearchSpeedFactor&amp;gt;&lt;br /&gt;
				&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;linkableBuildings&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ResearchBench&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableBuildings&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linking existing facilities to modded buildings is also possible by doing what existing buildings already do:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;ToolWorkshop&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompAffectedByFacilities&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;linkableFacilities&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ToolCabinet&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableFacilities&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BadIdeaShredder can now be attached to ResearchBench, and ToolCabinet can now be attached to ToolWorkshop.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with DLLs|Create a DLL patch]] continues explanations on compatibility patching and referencing existing items.&lt;br /&gt;
* [[Modding Tutorials/Injection|C# injection]] is an in-depth guide on using C# injection to resolve compatibility issues.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37647</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37647"/>
		<updated>2015-10-02T08:15:32Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* General modding */ Added Testing Sounds link here&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
* [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
# [[Modding Tutorials/XML Defs|Introduction to XML Defs]]&lt;br /&gt;
#* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]]&lt;br /&gt;
# In-depth XML Def tutorials&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37646</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37646"/>
		<updated>2015-10-02T08:15:07Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* XML tutorials */ Changed list a bit&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
# [[Modding Tutorials/XML Defs|Introduction to XML Defs]]&lt;br /&gt;
#* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]]&lt;br /&gt;
# In-depth XML Def tutorials&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37645</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37645"/>
		<updated>2015-10-02T08:09:01Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* C# tutorials */ Added stripped part of Modifying Defs tutorial link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&lt;br /&gt;
# [[Modding Tutorials/Compatibility with defs|Compatibility with Existing Defs]]&lt;br /&gt;
# [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Def classes|Introduction to Def Classes]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Def Class Compatibility]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Def_classes&amp;diff=37644</id>
		<title>Modding Tutorials/Def classes</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Def_classes&amp;diff=37644"/>
		<updated>2015-10-02T08:08:11Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Created, ripped from the Modifying Defs tutorial&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
&lt;br /&gt;
This tutorial provides you with an introduction to Def Classes in C#. It shows what effects each part of the C# code has on the XML format.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to know [[Modding Tutorials/Writing custom code|how to write custom code]].&lt;br /&gt;
* [[Modding Tutorials/Decompiling source code|Decompiling source code]] is required.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Modifying defs=&lt;br /&gt;
&lt;br /&gt;
There's a few ways to modify existing def formats. We'll go over writing a ''custom defClass'', ''custom comp'' and other ways of integrating XML tags into C# for example through the use of ''weaponTags'' or ''apparelTags''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Vanilla defClasses==&lt;br /&gt;
&lt;br /&gt;
This chapter helps you develop a broad understanding of the def classes. First we take a look at tags inside &amp;lt;thingDef&amp;gt;, then we take a look at tags inside those tags and finally we take a look at &amp;amp;lt;li&amp;amp;gt; items.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
The structure of a base game defClass might look like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace SomeNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class SomeDef : Def&lt;br /&gt;
	{&lt;br /&gt;
		public SomeType someTagName;&lt;br /&gt;
		public SomeOtherType someOtherTagName;&lt;br /&gt;
&lt;br /&gt;
		public SomeType someGetClass&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return (SomeType)this.someOtherTagName;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few notes could be made about this code.&amp;lt;br/&amp;gt;&lt;br /&gt;
* Without the ''using'' part, you'd have to call for '''''Namespace'''.Class.Method()'' instead of ''Class.Method()'' or ''((Class)partOfClass).Method()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using ...;	/* this tells the compiler which namespaces to look for when searching for class and method calls. */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* The ''':''' is inheritance and means you can access all methods in the parent and you can call back to for example the ''Tick()'' method using '''''base'''.Tick()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public class SomeDef : Def	/* inherits &amp;quot;everything&amp;quot; from Def, !! except for privates !! */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Everything of the following format '''is an XML tag''':&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someTagName	/* shows up as &amp;lt;ThingDef&amp;gt;&amp;lt;someTagName&amp;gt;SomeType value&amp;lt;/someTagName&amp;gt;&amp;lt;/ThingDef&amp;gt; */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Besides these tags there's also script-only methods in the code:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someGetClass	/* this is only used in C#. XML doesn't change anything about this */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Specifically ''get'' methods are only there for easily accessing or calculating certain values:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;return ...;	/* example: &amp;quot;public bool IsApparel()&amp;quot; returns &amp;quot;this.apparel != null&amp;quot;. This could be checked easily but Thing.IsApparel() is more readable sometimes */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice one could find the following code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef : BuildableDef	/* BuildableDef inherits from Def */&lt;br /&gt;
	{&lt;br /&gt;
		public bool alwaysHaulable;&lt;br /&gt;
&lt;br /&gt;
		public bool designateHaulable;&lt;br /&gt;
&lt;br /&gt;
		public StuffProperties stuffProps;	/* the StuffProperties class defines what this might look like in XML */&lt;br /&gt;
&lt;br /&gt;
		public bool IsStuff&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.stuffProps != null;	/* with some types you can check whether they're defined by checking if they're not equal to null */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		public bool EverHaulable&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.alwaysHaulable || this.designateHaulable;	/* &amp;quot;return A || B&amp;quot; will return true if either A or B is true, and false if both are false. */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;alwaysHaulable&amp;gt;true&amp;lt;/alwaysHaulable&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;!-- whatever you'd find in StuffProperties --&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: these are snippets of Verse.ThingDef. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Subtags===&lt;br /&gt;
&lt;br /&gt;
To explain how subtags work we'll take a look at (parts of) StuffProperties. The contents of the StuffProperties class, formally called Verse.StuffProperties, are very similar to the ThingDef class. The structure is mostly the same.&amp;lt;br/&amp;gt;&lt;br /&gt;
In case you're wondering why we didn't have to add &amp;quot;using Verse;&amp;quot; to access Verse.StuffProperties, &amp;quot;namespace Verse {}&amp;quot; basically includes a ''using'' statement.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class StuffProperties&lt;br /&gt;
	{&lt;br /&gt;
		public bool smeltable;&lt;br /&gt;
&lt;br /&gt;
		public StuffAppearance appearance;&lt;br /&gt;
&lt;br /&gt;
		public SoundDef soundImpactStuff;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StatModifier&amp;gt; statOffsets;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StuffCategoryDef&amp;gt; categories = new List&amp;lt;StuffCategoryDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of Verse.StuffProperties. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because SomeDef defines which subtags it has you have to modify Verse.SomeDef to alter which subtags it has (this includes modified versions of existing subtags, you have to modify SomeDef at some point).&amp;lt;br/&amp;gt;&lt;br /&gt;
This is one of the reasons you might be better off [[Modding Tutorials/Modifying defs#Custom comp|writing a custom comp]]. These can be added to an XML overwrite or [[Modding Tutorials/Injection|injected through C#]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists===&lt;br /&gt;
&lt;br /&gt;
Some tags include a list (it contains &amp;amp;lt;li&amp;amp;gt; subtags). If you look at the subtags of StuffProperties you can see two List&amp;lt;SomeType&amp;gt; elements. If you look at the XML you can see a clear distinction between the two:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;categories&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Metallic&amp;lt;/li&amp;gt;	/* Metallic is a defName from a StuffCategoryDef */&lt;br /&gt;
			&amp;lt;/categories&amp;gt;&lt;br /&gt;
			&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;Beauty&amp;gt;6&amp;lt;/Beauty&amp;gt;	/* Beauty is a defName from a StatDef, but the list's type is StatModifier */&lt;br /&gt;
			&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A clear difference between the two is that one of them defines a list and the other one doesn't. If you look at RimWorld.StatModifier you can find another cause:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using Verse;&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld&lt;br /&gt;
{&lt;br /&gt;
	public class StatModifier&lt;br /&gt;
	{&lt;br /&gt;
		public StatDef stat;&lt;br /&gt;
&lt;br /&gt;
		public float value;&lt;br /&gt;
&lt;br /&gt;
		public void LoadDataFromXmlCustom(XmlNode xmlRoot)&lt;br /&gt;
		{&lt;br /&gt;
			CrossRefLoader.RegisterObjectWantsCrossRef(this, &amp;quot;stat&amp;quot;, xmlRoot.Name);&lt;br /&gt;
			this.value = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float));&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of RimWorld.StatModifier. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because of this code the two act completely differently. One is a list with integer keys and StuffCategoryDef values, the other is a list with StatDef keys and float values.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
	Would be nice to expand on this.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with defs|XML Def Compatibility]] explains compatibility from the XML side of things.&lt;br /&gt;
* [[Modding Tutorials/Modifying defs|Def Class Compatibility]] explains compatibility from the C# side of things.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37643</id>
		<title>Modding Tutorials/Modifying defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37643"/>
		<updated>2015-10-02T08:06:54Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Stripped part of it to be in the Introduction to Def Classes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
&lt;br /&gt;
This tutorial shows you several ways to modify defs' (ThingDef, PawnKindDef) C# classes and alternatives to changing the XML format for them.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There's several ways to achieve this goal. Three are listed here.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Decompiling source code|Decompiling source code]] is required.&lt;br /&gt;
* This tutorial requires you to know [[Modding Tutorials/Writing custom code|how to write custom code]].&lt;br /&gt;
* [[Modding Tutorials/Def classes|Introduction to Def Classes]] is highly recommended.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom def class==&lt;br /&gt;
&lt;br /&gt;
The use of def classes is very popular in small mods. As long as the defs in the mod aren't overwriting core defs, it's very compatible.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Def classes require a pretty hefty overhaul of XML code to work. First of all you will have to change anything in the inheritance to refer to the same class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseSpecificThing&amp;quot; ParentName=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseSpecificThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And in case you have more thingDefs which require the changes that come with myNamespace.myCustomClass you'll have to set all of their classes for it to work.&amp;lt;br/&amp;gt;&lt;br /&gt;
Applied to core defs this way of doing things introduces incompatibilities with other mods that modify the same def. Creating compatibility patches is inevitable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the plus side you make it possible to change the root thingDef tags. In most cases you don't need this but certain things such as Pawn code might have no alternatives.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&lt;br /&gt;
This example will simply add a new tag to the root thingDef. This is the best or even only way to implement new tags through custom def classes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseHumanGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
		&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
		&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create one C# class, namely myNamespace.ThingDef_CustomTag:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef_CustomTag : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And now that that exists you can call on it with any ThingDef as input like so:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;	ThingDef_CustomTag customThingDef = someThingDef as ThingDef_CustomTag;&lt;br /&gt;
	if (customThingDef != null)&lt;br /&gt;
	{&lt;br /&gt;
		if (2 * Rand.Value() &amp;gt; customThingDef.myNewFloat)&lt;br /&gt;
		{&lt;br /&gt;
			ThingDef_CustomTag customThingDef2 = customThingDef.myNewThingDefList.RandomElement() as ThingDef_Custom;&lt;br /&gt;
			if (customThingDef2 != null)&lt;br /&gt;
			{&lt;br /&gt;
				return customThingDef2 .myNewBool;&lt;br /&gt;
			}&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		return customThingDef.myNewBool;&lt;br /&gt;
	}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that any of the code might not work in a newer alpha. It's for demonstration purposes only.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counterexample===&lt;br /&gt;
''The following method shows you '''why not to use''' custom defs. In some cases you could attempt to use this method but it's generally considered the least favourable way to deal with things.''&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this example we're gonna '''try to''' change the &amp;lt;race&amp;gt; tag to contain more tags. The value of these tags isn't exactly important, as is explained in the first few sections:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseAnimalRace&amp;quot; ParentName=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseAnimalRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;race Class=&amp;quot;myNamespace.RacePropertiesCustom&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
			&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
			&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
		&amp;lt;/race&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create two C# classes, namely myNamespace.ThingDefWithCustomRaceProps and myNamespace.RacePropertiesCustom:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDefWithCustomRaceProps : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		new public RacePropertiesCustom race;	/* requires the new keyword to overwrite the existing race */&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And for the RacePropertiesCustom we make the following script:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class RacePropertiesCustom : RaceProperties&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One might think that's all required to make it work. However.&amp;lt;br/&amp;gt;&lt;br /&gt;
Since the race variable tag is called by several methods all around the game's script, and it's called like ((ThingDef)someVariable).race.someMethod(), this means it won't use YOUR ThingDefWithCustomRaceProps and to fix this the only thing you can do is modify '''all''' these classes to cast to ThingDefWithCustomRaceProps like (ThingDefWithCustomRaceProps)((ThingDef)someVariable).race.someMethod(), which is less than ideal in every single case. It means copying and rewriting large portions of code, finding out they're called by certain other methods that also require the same treatment to call the new custom method to fix the custom thingDef class you made.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this reason custom defs are advised against.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom comp class==&lt;br /&gt;
&lt;br /&gt;
Comp classes are a more advanced method of introducing compatibility to mods. Large mods might prefer comps to defs because it requires less XML editing in most cases. Along with that it's possible to inject comps into almost everything (because almost everything inherits from ThingWithComps) without having to change the comp while defs require a new class for each SomeDef they overwrite (E.g PawnKindDef and ThingDef require different classes)&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Comps are easier to add than defClasses and can be injected by C# code. It's lighter on the XML code (doesn't require inheritance to be consistent) and C# code in most cases because it's more of a contained system. There's many hooks implemented which call for C# comp classes, such as CompTick() and PostDestroy(). Just like defs they can introduce incompatibilities. Adding another mod's comps requires the game to have both mods loaded, which can be a problem. Implementing smarter injection might fix this&amp;lt;sup&amp;gt;[?]&amp;lt;/sup&amp;gt; in case a mod isn't loaded, but it's not possible to guarantee that the comp is actually added.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
==Checking for tags==&lt;br /&gt;
&lt;br /&gt;
Instead of using custom defClasses and comps you could also use tags. This is especially useful for lightweight features and simple compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Some tags are never used by a certain Thing such as ApparelTag on a Building. If a tag is never used it doesn't throw an error and therefore you could introduce as many useless tags as you want to a mod without the game complaining. When other mods check for these tags they can also do it without a problem. This way you could add tags of whatever name you want and let others check for this tag for compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with defs|Compatibility with defs]] explains compatibility from the XML side of things.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Installing_mods&amp;diff=37641</id>
		<title>Installing mods</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Installing_mods&amp;diff=37641"/>
		<updated>2015-10-02T06:18:05Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Fixed ludeonthread template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn where to install your downloaded mods and how to activate them, along with some notes on compatibility and backups.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Finding mods=&lt;br /&gt;
&lt;br /&gt;
Look online and find a mod that you want to try out. The main source for finding mods is the {{LudeonThread|15|mod release section|board}} on the forums.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you find a mod you like that is '''compatible''' with the version of RimWorld you have, you can download them from their individual threads.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Installation=&lt;br /&gt;
&lt;br /&gt;
# Open the downloaded ZIP archive;&lt;br /&gt;
# Go to your [[save file#Save file locations|RimWorld download location]];&lt;br /&gt;
# '''Windows''':&lt;br /&gt;
## Drag and drop the extracted ModName folder into your RimWorld***Win/Mods/ folder (not in Core);&lt;br /&gt;
# '''Mac''':&lt;br /&gt;
## Right-click the RimWorld application and ''show package contents'';&lt;br /&gt;
## Drag and drop the ZIP archive's ModName folder into your Mods folder (not in Core) in the application package;&lt;br /&gt;
# Start up your game;&lt;br /&gt;
# Click the Mods button and activate your mods.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some mods require a fresh world generation to work.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Editing mods folder===&lt;br /&gt;
&lt;br /&gt;
In case your game stops running after you installed a mod, it's useful to have a backup of the mods folder somewhere. This way, you will always be able to undo a mistake that may occur.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- I have no idea whether this is at all useful info --&amp;gt;It is also very important to never delete the ThingCategories.xml file in your mod pack; doing this will result in a black screen when trying to start the game up.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Compatibility===&lt;br /&gt;
&lt;br /&gt;
Not all mods are compatible with eachother:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Many content mods; such as Weapon, Apparel, Faction or even Hair mods; are compatible with eachother;&lt;br /&gt;
* Mods that change the same base game files, such as combat overhaul mods, are usually incompatible;&lt;br /&gt;
* Mods that add functionality to base game things are compatible but usually won't include the things from content mods;&lt;br /&gt;
* Modpack authors try to make mods in their pack compatible with eachother. Adding or updating mods might break the pack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will know if you have incompatible mods if you are having serious gameplay issues, such as unplaceable items, graphical issues, colonists getting stuck, etc.&amp;lt;br/&amp;gt;&lt;br /&gt;
Having a console error might point to incompatibility as well, but some mods are expected to have console errors on start up.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
*[[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding]][[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=37640</id>
		<title>Template:LudeonThread</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=37640"/>
		<updated>2015-10-02T06:17:06Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Fixed brackets&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;[{{{link|http://ludeon.com/forums/index.php?{{{3|topic}}}={{{1|{{{number|}}}}}}}}} {{{2|Thread}}}]&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=37639</id>
		<title>Template:LudeonThread</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Template:LudeonThread&amp;diff=37639"/>
		<updated>2015-10-02T06:15:35Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Changed alt to {{{2}}}, {{{2}}} to {{{3}}}&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{Documentation}}&amp;lt;/noinclude&amp;gt;&amp;lt;includeonly&amp;gt;[{{{link|http://ludeon.com/forums/index.php?{{{3|topic}}}={{{1|{{{number|}}}}}}}}} {{{{{{2|Thread}}}]&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37400</id>
		<title>Modding Tutorials/Compatibility with defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Compatibility_with_defs&amp;diff=37400"/>
		<updated>2015-09-20T18:57:29Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Mod defs */ Changed a few links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial you will learn different ways to make XML mods compatible and how to link existing and modded recipes, facilities and buildings with eachother.&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn how to implement your mods into existing defs, how to fix compatibility between XML mods and how to make modded recipes, facilities and buildings interact with eachother without overwriting the base game.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Overwriting defs=&lt;br /&gt;
===Core defs===&lt;br /&gt;
&lt;br /&gt;
The least elegant way to go about compatibility is to have a modified copy of a core def in your mod file. You have to rely on load order to make the mod work, let's say you want to change the damage of a pistol:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
  YourModName/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        YourFileName.xml&lt;br /&gt;
&lt;br /&gt;
.. and contents:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;!-- base parent &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;ThingDef ParentName=&amp;quot;BaseBullet&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;Bullet_Pistol&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;projectile&amp;gt;&lt;br /&gt;
			&amp;lt;DamageAmountBase&amp;gt;9&amp;lt;/DamageAmountBase&amp;gt;&lt;br /&gt;
		&amp;lt;/projectile&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above code adds something that already exists on the /Core/ mod - to make it overwrite the core mod, this mod has to be loaded after it. Practically every mod is loaded after the core mod, so this shouldn't be a problem.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The problem arises when multiple mods edit ''Bullet_Pistol'', and as a rule of thumb the last loaded version of a defName is kept.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Mod defs===&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
!colspan=3| I modify.. !! What do?&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Core.. ||colspan=2| ..Def values || Add the defs you want to overwrite to your mod and load the mod after Core&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || Add the defs you want to overwrite to your mod and load the mod after Core, use C# to [[Modding Tutorials/Modifying defs|modify def classes]].&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=8| ..a mod's.. ||rowspan=3| ..Def changes.. || ..directly || Make a choice which value to keep (merge them if possible) - if it's the only difference in the core def overwrites between the mods, simply loading one after the other will fix the compatibility, if that's not possible make a merged patch&lt;br /&gt;
|-&lt;br /&gt;
| ..collaterally || The easiest way to fix this is by making a patch, including the same def with both modifications applied to them - this def can then be loaded after both of the mods&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| (both of the above) || Make a compatibility patch: take the def from both mods and try to merge as many values as you can, compare it to the core def, see if you can figure it out through XML only&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Class reference changes.. || ..directly || E.g &amp;lt;thingClass&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..not directly || E.g Mod A &amp;lt;ThingDef&amp;gt; and Mod B &amp;lt;projectile&amp;gt; Class changes: this will work fine with an XML patch&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|rowspan=2| ..Def values.. || ..intentionally || Add the defs you want to overwrite to your mod and load it after their mod&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ..unintentionally || Rename your defs, try to figure the compatibility out through contacting the author, make a compatibility patch&lt;br /&gt;
|-&lt;br /&gt;
|colspan=2| ..Class references || E.g &amp;lt;ThingDef Class=&amp;quot;namespace.class&amp;quot;&amp;gt; added twice: [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]]&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt;&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# If your mod requires another mod to function and you want to change something about their mod, let's say CustomShotgun should do 20 damage instead of 25, your mod has to include CustomShotgun's def and be loaded after their mod.&lt;br /&gt;
# Mod A changes CoreDef's label to &amp;quot;hunting shotgun&amp;quot;, mod B changes CoreDef's soundInteract to &amp;quot;InteractPistol&amp;quot;, patch AB does both to fix their compatibility issues.&lt;br /&gt;
# When mod A adds Class=&amp;quot;ModANamespace.ModAClass&amp;quot; to a defName's ThingDef and mod B adds Class=&amp;quot;ModBNamespace.ModBClass&amp;quot; this is a non XML-patchable incompatibility. This means that if A adds a Class to the &amp;lt;projectile&amp;gt; tag and B adds a Class to the &amp;lt;thingDef&amp;gt; tag you're perfectly fine. This tutorial won't cover creating DLL patches because it's more in-depth, but [[Modding Tutorials/Compatibility with DLLs|create a DLL patch]] and [[Modding Tutorials/Injection|C# injection]] will.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Referencing defs=&lt;br /&gt;
===RecipeDef===&lt;br /&gt;
&lt;br /&gt;
In case your mod adds a new recipe for the [[Smithing bench|smithing bench]], you might think it's necessary to overwrite part of its thingDef. This is however completely unnecessary - the C# code base contains a tag which allows you to make your ''recipe'' choose which ''building'' to attach to (instead of the other way round):&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;RecipeDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeBread&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipeMaker&amp;gt;&lt;br /&gt;
			&amp;lt;recipeUsers&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;CookStove&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/recipeUsers&amp;gt;&lt;br /&gt;
			&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
		&amp;lt;/recipeMaker&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/RecipeDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want your ''building'' to choose which ''recipes'' to display, you do the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BakeryOven&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;recipes&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;BakeBread&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/recipes&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The BakeBread recipe will now show up in both the BakeryOven and CookStove, without the mod having to modify CookStove's &amp;lt;recipes&amp;gt; list.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Facilities===&lt;br /&gt;
&lt;br /&gt;
Buildings with the &amp;quot;CompAffectedByFacilities&amp;quot; compClass can choose which facilities should link to them. In the base game it isn't used the other way round - facilities don't do this - but the C# code base has a tag for it:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;BadIdeaShredder&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompFacility&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
					&amp;lt;ResearchSpeedFactor&amp;gt;0.05&amp;lt;/ResearchSpeedFactor&amp;gt;&lt;br /&gt;
				&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;linkableBuildings&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ResearchBench&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableBuildings&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Linking existing facilities to modded buildings is also possible by doing what existing buildings already do:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;ThingDef&amp;gt;&lt;br /&gt;
		&amp;lt;defName&amp;gt;ToolWorkshop&amp;lt;/defName&amp;gt;&lt;br /&gt;
		&amp;lt;comps&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;&lt;br /&gt;
				&amp;lt;compClass&amp;gt;CompAffectedByFacilities&amp;lt;/compClass&amp;gt;&lt;br /&gt;
				&amp;lt;linkableFacilities&amp;gt;&lt;br /&gt;
					&amp;lt;li&amp;gt;ToolCabinet&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;/linkableFacilities&amp;gt;&lt;br /&gt;
			&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/comps&amp;gt;&lt;br /&gt;
		&amp;lt;!-- more tags --&amp;gt;&lt;br /&gt;
	&amp;lt;/ThingDef&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BadIdeaShredder can now be attached to ResearchBench, and ToolCabinet can now be attached to ToolWorkshop.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with DLLs|Create a DLL patch]] continues explanations on compatibility patching and referencing existing items.&lt;br /&gt;
* [[Modding Tutorials/Injection|C# injection]] is an in-depth guide on using C# injection to resolve compatibility issues.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37399</id>
		<title>Modding Tutorials/Modifying defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37399"/>
		<updated>2015-09-20T18:45:26Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Custom def class */ Fixed namespaces&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
&lt;br /&gt;
This tutorial shows you several ways to modify defs' (ThingDef, PawnKindDef) C# classes and alternatives to changing the XML format for them.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to know [[Modding Tutorials/Writing custom code|how to write custom code]].&lt;br /&gt;
* [[Modding Tutorials/Decompiling source code|Decompiling source code]] is required.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Modifying defs=&lt;br /&gt;
&lt;br /&gt;
There's a few ways to modify existing def formats. We'll go over writing a ''custom defClass'', ''custom comp'' and other ways of integrating XML tags into C# for example through the use of ''weaponTags'' or ''apparelTags''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Vanilla defClasses==&lt;br /&gt;
&lt;br /&gt;
This chapter helps you develop a broad understanding of the def classes. First we take a look at tags inside &amp;lt;thingDef&amp;gt;, then we take a look at tags inside those tags and finally we take a look at &amp;amp;lt;li&amp;amp;gt; items.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
The structure of a base game defClass might look like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace SomeNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class SomeDef : Def&lt;br /&gt;
	{&lt;br /&gt;
		public SomeType someTagName;&lt;br /&gt;
		public SomeOtherType someOtherTagName;&lt;br /&gt;
&lt;br /&gt;
		public SomeType someGetClass&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return (SomeType)this.someOtherTagName;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few notes could be made about this code.&amp;lt;br/&amp;gt;&lt;br /&gt;
* Without the ''using'' part, you'd have to call for '''''Namespace'''.Class.Method()'' instead of ''Class.Method()'' or ''((Class)partOfClass).Method()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using ...;	/* this tells the compiler which namespaces to look for when searching for class and method calls. */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* The ''':''' is inheritance and means you can access all methods in the parent and you can call back to for example the ''Tick()'' method using '''''base'''.Tick()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public class SomeDef : Def	/* inherits &amp;quot;everything&amp;quot; from Def, !! except for privates !! */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Everything of the following format '''is an XML tag''':&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someTagName	/* shows up as &amp;lt;ThingDef&amp;gt;&amp;lt;someTagName&amp;gt;SomeType value&amp;lt;/someTagName&amp;gt;&amp;lt;/ThingDef&amp;gt; */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Besides these tags there's also script-only methods in the code:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someGetClass	/* this is only used in C#. XML doesn't change anything about this */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Specifically ''get'' methods are only there for easily accessing or calculating certain values:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;return ...;	/* example: &amp;quot;public bool IsApparel()&amp;quot; returns &amp;quot;this.apparel != null&amp;quot;. This could be checked easily but Thing.IsApparel() is more readable sometimes */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice one could find the following code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef : BuildableDef	/* BuildableDef inherits from Def */&lt;br /&gt;
	{&lt;br /&gt;
		public bool alwaysHaulable;&lt;br /&gt;
&lt;br /&gt;
		public bool designateHaulable;&lt;br /&gt;
&lt;br /&gt;
		public StuffProperties stuffProps;	/* the StuffProperties class defines what this might look like in XML */&lt;br /&gt;
&lt;br /&gt;
		public bool IsStuff&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.stuffProps != null;	/* with some types you can check whether they're defined by checking if they're not equal to null */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		public bool EverHaulable&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.alwaysHaulable || this.designateHaulable;	/* &amp;quot;return A || B&amp;quot; will return true if either A or B is true, and false if both are false. */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;alwaysHaulable&amp;gt;true&amp;lt;/alwaysHaulable&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;!-- whatever you'd find in StuffProperties --&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: these are snippets of Verse.ThingDef. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Subtags===&lt;br /&gt;
&lt;br /&gt;
To explain how subtags work we'll take a look at (parts of) StuffProperties. The contents of the StuffProperties class, formally called Verse.StuffProperties, are very similar to the ThingDef class. The structure is mostly the same.&amp;lt;br/&amp;gt;&lt;br /&gt;
In case you're wondering why we didn't have to add &amp;quot;using Verse;&amp;quot; to access Verse.StuffProperties, &amp;quot;namespace Verse {}&amp;quot; basically includes a ''using'' statement.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class StuffProperties&lt;br /&gt;
	{&lt;br /&gt;
		public bool smeltable;&lt;br /&gt;
&lt;br /&gt;
		public StuffAppearance appearance;&lt;br /&gt;
&lt;br /&gt;
		public SoundDef soundImpactStuff;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StatModifier&amp;gt; statOffsets;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StuffCategoryDef&amp;gt; categories = new List&amp;lt;StuffCategoryDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of Verse.StuffProperties. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because SomeDef defines which subtags it has you have to modify Verse.SomeDef to alter which subtags it has (this includes modified versions of existing subtags, you have to modify SomeDef at some point).&amp;lt;br/&amp;gt;&lt;br /&gt;
This is one of the reasons you might be better off [[Modding Tutorials/Modifying defs#Custom comp|writing a custom comp]]. These can be added to an XML overwrite or [[Modding Tutorials/Injection|injected through C#]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists===&lt;br /&gt;
&lt;br /&gt;
Some tags include a list (it contains &amp;amp;lt;li&amp;amp;gt; subtags). If you look at the subtags of StuffProperties you can see two List&amp;lt;SomeType&amp;gt; elements. If you look at the XML you can see a clear distinction between the two:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;categories&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Metallic&amp;lt;/li&amp;gt;	/* Metallic is a defName from a StuffCategoryDef */&lt;br /&gt;
			&amp;lt;/categories&amp;gt;&lt;br /&gt;
			&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;Beauty&amp;gt;6&amp;lt;/Beauty&amp;gt;	/* Beauty is a defName from a StatDef, but the list's type is StatModifier */&lt;br /&gt;
			&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A clear difference between the two is that one of them defines a list and the other one doesn't. If you look at RimWorld.StatModifier you can find another cause:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using Verse;&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld&lt;br /&gt;
{&lt;br /&gt;
	public class StatModifier&lt;br /&gt;
	{&lt;br /&gt;
		public StatDef stat;&lt;br /&gt;
&lt;br /&gt;
		public float value;&lt;br /&gt;
&lt;br /&gt;
		public void LoadDataFromXmlCustom(XmlNode xmlRoot)&lt;br /&gt;
		{&lt;br /&gt;
			CrossRefLoader.RegisterObjectWantsCrossRef(this, &amp;quot;stat&amp;quot;, xmlRoot.Name);&lt;br /&gt;
			this.value = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float));&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of RimWorld.StatModifier. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because of this code the two act completely differently. One is a list with integer keys and StuffCategoryDef values, the other is a list with StatDef keys and float values.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
	Would be nice to expand on this.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom def class==&lt;br /&gt;
&lt;br /&gt;
The use of def classes is very popular in small mods. As long as the defs in the mod aren't overwriting core defs, it's very compatible.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Def classes require a pretty hefty overhaul of XML code to work. First of all you will have to change anything in the inheritance to refer to the same class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseSpecificThing&amp;quot; ParentName=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseSpecificThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And in case you have more thingDefs which require the changes that come with myNamespace.myCustomClass you'll have to set all of their classes for it to work.&amp;lt;br/&amp;gt;&lt;br /&gt;
Applied to core defs this way of doing things introduces incompatibilities with other mods that modify the same def. Creating compatibility patches is inevitable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the plus side you make it possible to change the root thingDef tags. In most cases you don't need this but certain things such as Pawn code might have no alternatives.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&lt;br /&gt;
This example will simply add a new tag to the root thingDef. This is the best or even only way to implement new tags through custom def classes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseHumanGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
		&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
		&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create one C# class, namely myNamespace.ThingDef_CustomTag:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef_CustomTag : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And now that that exists you can call on it with any ThingDef as input like so:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;	ThingDef_CustomTag customThingDef = someThingDef as ThingDef_CustomTag;&lt;br /&gt;
	if (customThingDef != null)&lt;br /&gt;
	{&lt;br /&gt;
		if (2 * Rand.Value() &amp;gt; customThingDef.myNewFloat)&lt;br /&gt;
		{&lt;br /&gt;
			ThingDef_CustomTag customThingDef2 = customThingDef.myNewThingDefList.RandomElement() as ThingDef_Custom;&lt;br /&gt;
			if (customThingDef2 != null)&lt;br /&gt;
			{&lt;br /&gt;
				return customThingDef2 .myNewBool;&lt;br /&gt;
			}&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		return customThingDef.myNewBool;&lt;br /&gt;
	}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that any of the code might not work in a newer alpha. It's for demonstration purposes only.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counterexample===&lt;br /&gt;
''The following method shows you '''why not to use''' custom defs. In some cases you could attempt to use this method but it's generally considered the least favourable way to deal with things.''&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this example we're gonna '''try to''' change the &amp;lt;race&amp;gt; tag to contain more tags. The value of these tags isn't exactly important, as is explained in the first few sections:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseAnimalRace&amp;quot; ParentName=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseAnimalRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;race Class=&amp;quot;myNamespace.RacePropertiesCustom&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
			&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
			&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
		&amp;lt;/race&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create two C# classes, namely myNamespace.ThingDefWithCustomRaceProps and myNamespace.RacePropertiesCustom:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDefWithCustomRaceProps : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		new public RacePropertiesCustom race;	/* requires the new keyword to overwrite the existing race */&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And for the RacePropertiesCustom we make the following script:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace myNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class RacePropertiesCustom : RaceProperties&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One might think that's all required to make it work. However.&amp;lt;br/&amp;gt;&lt;br /&gt;
Since the race variable tag is called by several methods all around the game's script, and it's called like ((ThingDef)someVariable).race.someMethod(), this means it won't use YOUR ThingDefWithCustomRaceProps and to fix this the only thing you can do is modify '''all''' these classes to cast to ThingDefWithCustomRaceProps like (ThingDefWithCustomRaceProps)((ThingDef)someVariable).race.someMethod(), which is less than ideal in every single case. It means copying and rewriting large portions of code, finding out they're called by certain other methods that also require the same treatment to call the new custom method to fix the custom thingDef class you made.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this reason custom defs are advised against.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom comp class==&lt;br /&gt;
&lt;br /&gt;
Comp classes are a more advanced method of introducing compatibility to mods. Large mods might prefer comps to defs because it requires less XML editing in most cases. Along with that it's possible to inject comps into almost everything (because almost everything inherits from ThingWithComps) without having to change the comp while defs require a new class for each SomeDef they overwrite (E.g PawnKindDef and ThingDef require different classes)&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Comps are easier to add than defClasses and can be injected by C# code. It's lighter on the XML code (doesn't require inheritance to be consistent) and C# code in most cases because it's more of a contained system. There's many hooks implemented which call for C# comp classes, such as CompTick() and PostDestroy(). Just like defs they can introduce incompatibilities. Adding another mod's comps requires the game to have both mods loaded, which can be a problem. Implementing smarter injection might fix this&amp;lt;sup&amp;gt;[?]&amp;lt;/sup&amp;gt; in case a mod isn't loaded, but it's not possible to guarantee that the comp is actually added.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
==Checking for tags==&lt;br /&gt;
&lt;br /&gt;
Instead of using custom defClasses and comps you could also use tags. This is especially useful for lightweight features and simple compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Some tags are never used by a certain Thing such as ApparelTag on a Building. If a tag is never used it doesn't throw an error and therefore you could introduce as many useless tags as you want to a mod without the game complaining. When other mods check for these tags they can also do it without a problem. This way you could add tags of whatever name you want and let others check for this tag for compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with defs|Compatibility with defs]] explains compatibility from the XML side of things.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37398</id>
		<title>Modding Tutorials/Modifying defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37398"/>
		<updated>2015-09-20T18:29:58Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Custom def class */ Finished custom def class&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
&lt;br /&gt;
This tutorial shows you several ways to modify defs' (ThingDef, PawnKindDef) C# classes and alternatives to changing the XML format for them.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to know [[Modding Tutorials/Writing custom code|how to write custom code]].&lt;br /&gt;
* [[Modding Tutorials/Decompiling source code|Decompiling source code]] is required.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Modifying defs=&lt;br /&gt;
&lt;br /&gt;
There's a few ways to modify existing def formats. We'll go over writing a ''custom defClass'', ''custom comp'' and other ways of integrating XML tags into C# for example through the use of ''weaponTags'' or ''apparelTags''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Vanilla defClasses==&lt;br /&gt;
&lt;br /&gt;
This chapter helps you develop a broad understanding of the def classes. First we take a look at tags inside &amp;lt;thingDef&amp;gt;, then we take a look at tags inside those tags and finally we take a look at &amp;amp;lt;li&amp;amp;gt; items.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
The structure of a base game defClass might look like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace SomeNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class SomeDef : Def&lt;br /&gt;
	{&lt;br /&gt;
		public SomeType someTagName;&lt;br /&gt;
		public SomeOtherType someOtherTagName;&lt;br /&gt;
&lt;br /&gt;
		public SomeType someGetClass&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return (SomeType)this.someOtherTagName;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few notes could be made about this code.&amp;lt;br/&amp;gt;&lt;br /&gt;
* Without the ''using'' part, you'd have to call for '''''Namespace'''.Class.Method()'' instead of ''Class.Method()'' or ''((Class)partOfClass).Method()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using ...;	/* this tells the compiler which namespaces to look for when searching for class and method calls. */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* The ''':''' is inheritance and means you can access all methods in the parent and you can call back to for example the ''Tick()'' method using '''''base'''.Tick()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public class SomeDef : Def	/* inherits &amp;quot;everything&amp;quot; from Def, !! except for privates !! */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Everything of the following format '''is an XML tag''':&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someTagName	/* shows up as &amp;lt;ThingDef&amp;gt;&amp;lt;someTagName&amp;gt;SomeType value&amp;lt;/someTagName&amp;gt;&amp;lt;/ThingDef&amp;gt; */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Besides these tags there's also script-only methods in the code:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someGetClass	/* this is only used in C#. XML doesn't change anything about this */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Specifically ''get'' methods are only there for easily accessing or calculating certain values:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;return ...;	/* example: &amp;quot;public bool IsApparel()&amp;quot; returns &amp;quot;this.apparel != null&amp;quot;. This could be checked easily but Thing.IsApparel() is more readable sometimes */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice one could find the following code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef : BuildableDef	/* BuildableDef inherits from Def */&lt;br /&gt;
	{&lt;br /&gt;
		public bool alwaysHaulable;&lt;br /&gt;
&lt;br /&gt;
		public bool designateHaulable;&lt;br /&gt;
&lt;br /&gt;
		public StuffProperties stuffProps;	/* the StuffProperties class defines what this might look like in XML */&lt;br /&gt;
&lt;br /&gt;
		public bool IsStuff&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.stuffProps != null;	/* with some types you can check whether they're defined by checking if they're not equal to null */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		public bool EverHaulable&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.alwaysHaulable || this.designateHaulable;	/* &amp;quot;return A || B&amp;quot; will return true if either A or B is true, and false if both are false. */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;alwaysHaulable&amp;gt;true&amp;lt;/alwaysHaulable&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;!-- whatever you'd find in StuffProperties --&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: these are snippets of Verse.ThingDef. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Subtags===&lt;br /&gt;
&lt;br /&gt;
To explain how subtags work we'll take a look at (parts of) StuffProperties. The contents of the StuffProperties class, formally called Verse.StuffProperties, are very similar to the ThingDef class. The structure is mostly the same.&amp;lt;br/&amp;gt;&lt;br /&gt;
In case you're wondering why we didn't have to add &amp;quot;using Verse;&amp;quot; to access Verse.StuffProperties, &amp;quot;namespace Verse {}&amp;quot; basically includes a ''using'' statement.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class StuffProperties&lt;br /&gt;
	{&lt;br /&gt;
		public bool smeltable;&lt;br /&gt;
&lt;br /&gt;
		public StuffAppearance appearance;&lt;br /&gt;
&lt;br /&gt;
		public SoundDef soundImpactStuff;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StatModifier&amp;gt; statOffsets;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StuffCategoryDef&amp;gt; categories = new List&amp;lt;StuffCategoryDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of Verse.StuffProperties. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because SomeDef defines which subtags it has you have to modify Verse.SomeDef to alter which subtags it has (this includes modified versions of existing subtags, you have to modify SomeDef at some point).&amp;lt;br/&amp;gt;&lt;br /&gt;
This is one of the reasons you might be better off [[Modding Tutorials/Modifying defs#Custom comp|writing a custom comp]]. These can be added to an XML overwrite or [[Modding Tutorials/Injection|injected through C#]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists===&lt;br /&gt;
&lt;br /&gt;
Some tags include a list (it contains &amp;amp;lt;li&amp;amp;gt; subtags). If you look at the subtags of StuffProperties you can see two List&amp;lt;SomeType&amp;gt; elements. If you look at the XML you can see a clear distinction between the two:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;categories&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Metallic&amp;lt;/li&amp;gt;	/* Metallic is a defName from a StuffCategoryDef */&lt;br /&gt;
			&amp;lt;/categories&amp;gt;&lt;br /&gt;
			&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;Beauty&amp;gt;6&amp;lt;/Beauty&amp;gt;	/* Beauty is a defName from a StatDef, but the list's type is StatModifier */&lt;br /&gt;
			&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A clear difference between the two is that one of them defines a list and the other one doesn't. If you look at RimWorld.StatModifier you can find another cause:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using Verse;&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld&lt;br /&gt;
{&lt;br /&gt;
	public class StatModifier&lt;br /&gt;
	{&lt;br /&gt;
		public StatDef stat;&lt;br /&gt;
&lt;br /&gt;
		public float value;&lt;br /&gt;
&lt;br /&gt;
		public void LoadDataFromXmlCustom(XmlNode xmlRoot)&lt;br /&gt;
		{&lt;br /&gt;
			CrossRefLoader.RegisterObjectWantsCrossRef(this, &amp;quot;stat&amp;quot;, xmlRoot.Name);&lt;br /&gt;
			this.value = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float));&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of RimWorld.StatModifier. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because of this code the two act completely differently. One is a list with integer keys and StuffCategoryDef values, the other is a list with StatDef keys and float values.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
	Would be nice to expand on this.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom def class==&lt;br /&gt;
&lt;br /&gt;
The use of def classes is very popular in small mods. As long as the defs in the mod aren't overwriting core defs, it's very compatible.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Def classes require a pretty hefty overhaul of XML code to work. First of all you will have to change anything in the inheritance to refer to the same class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseSpecificThing&amp;quot; ParentName=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseSpecificThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And in case you have more thingDefs which require the changes that come with myNamespace.myCustomClass you'll have to set all of their classes for it to work.&amp;lt;br/&amp;gt;&lt;br /&gt;
Applied to core defs this way of doing things introduces incompatibilities with other mods that modify the same def. Creating compatibility patches is inevitable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the plus side you make it possible to change the root thingDef tags. In most cases you don't need this but certain things such as Pawn code might have no alternatives.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
&lt;br /&gt;
This example will simply add a new tag to the root thingDef. This is the best or even only way to implement new tags through custom def classes:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseHumanGun&amp;quot; Class=&amp;quot;myNamespace.ThingDef_CustomTag&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
		&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
		&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
		&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create one C# class, namely myNamespace.ThingDef_CustomTag:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef_CustomTag : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And now that that exists you can call on it with any ThingDef as input like so:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;	ThingDef_CustomTag customThingDef = someThingDef as ThingDef_CustomTag;&lt;br /&gt;
	if (customThingDef != null)&lt;br /&gt;
	{&lt;br /&gt;
		if (2 * Rand.Value() &amp;gt; customThingDef.myNewFloat)&lt;br /&gt;
		{&lt;br /&gt;
			ThingDef_CustomTag customThingDef2 = customThingDef.myNewThingDefList.RandomElement() as ThingDef_Custom;&lt;br /&gt;
			if (customThingDef2 != null)&lt;br /&gt;
			{&lt;br /&gt;
				return customThingDef2 .myNewBool;&lt;br /&gt;
			}&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		return customThingDef.myNewBool;&lt;br /&gt;
	}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Please note that any of the code might not work in a newer alpha. It's for demonstration purposes only.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Counterexample===&lt;br /&gt;
''The following method shows you '''why not to use''' custom defs. In some cases you could attempt to use this method but it's generally considered the least favourable way to deal with things.''&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this example we're gonna '''try to''' change the &amp;lt;race&amp;gt; tag to contain more tags. The value of these tags isn't exactly important, as is explained in the first few sections:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseAnimalRace&amp;quot; ParentName=&amp;quot;BaseRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseAnimalRace&amp;quot; Class=&amp;quot;myNamespace.ThingDefWithCustomRaceProps&amp;quot;&amp;gt;&lt;br /&gt;
		&amp;lt;race Class=&amp;quot;myNamespace.RacePropertiesCustom&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;myNewFloat&amp;gt;1.1&amp;lt;/myNewFloat&amp;gt;&lt;br /&gt;
			&amp;lt;myNewBool&amp;gt;true&amp;lt;/myNewBool&amp;gt;&lt;br /&gt;
			&amp;lt;myNewThingDefList&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Silver&amp;lt;/li&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Pistol&amp;lt;/li&amp;gt;&lt;br /&gt;
			&amp;lt;/myNewThingDefList&amp;gt;&lt;br /&gt;
		&amp;lt;/race&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Without assigning the Class to each thingDef inheriting from and being inherited by a certain thingDef with a certain Class, '''the mod will cause errors'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
Now for the code we will have to create two C# classes, namely myNamespace.ThingDefWithCustomRaceProps and myNamespace.RacePropertiesCustom:&amp;lt;/br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDefWithCustomRaceProps : ThingDef&lt;br /&gt;
	{&lt;br /&gt;
		new public RacePropertiesCustom race;	/* requires the new keyword to overwrite the existing race */&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And for the RacePropertiesCustom we make the following script:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class RacePropertiesCustom : RaceProperties&lt;br /&gt;
	{&lt;br /&gt;
		public float myNewFloat;&lt;br /&gt;
&lt;br /&gt;
		public bool myNewBool;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;ThingDef&amp;gt; myNewThingDefList = new List&amp;lt;ThingDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
One might think that's all required to make it work. However.&amp;lt;br/&amp;gt;&lt;br /&gt;
Since the race variable tag is called by several methods all around the game's script, and it's called like ((ThingDef)someVariable).race.someMethod(), this means it won't use YOUR ThingDefWithCustomRaceProps and to fix this the only thing you can do is modify '''all''' these classes to cast to ThingDefWithCustomRaceProps like (ThingDefWithCustomRaceProps)((ThingDef)someVariable).race.someMethod(), which is less than ideal in every single case. It means copying and rewriting large portions of code, finding out they're called by certain other methods that also require the same treatment to call the new custom method to fix the custom thingDef class you made.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For this reason custom defs are advised against.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom comp class==&lt;br /&gt;
&lt;br /&gt;
Comp classes are a more advanced method of introducing compatibility to mods. Large mods might prefer comps to defs because it requires less XML editing in most cases. Along with that it's possible to inject comps into almost everything (because almost everything inherits from ThingWithComps) without having to change the comp while defs require a new class for each SomeDef they overwrite (E.g PawnKindDef and ThingDef require different classes)&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Comps are easier to add than defClasses and can be injected by C# code. It's lighter on the XML code (doesn't require inheritance to be consistent) and C# code in most cases because it's more of a contained system. There's many hooks implemented which call for C# comp classes, such as CompTick() and PostDestroy(). Just like defs they can introduce incompatibilities. Adding another mod's comps requires the game to have both mods loaded, which can be a problem. Implementing smarter injection might fix this&amp;lt;sup&amp;gt;[?]&amp;lt;/sup&amp;gt; in case a mod isn't loaded, but it's not possible to guarantee that the comp is actually added.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
==Checking for tags==&lt;br /&gt;
&lt;br /&gt;
Instead of using custom defClasses and comps you could also use tags. This is especially useful for lightweight features and simple compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Some tags are never used by a certain Thing such as ApparelTag on a Building. If a tag is never used it doesn't throw an error and therefore you could introduce as many useless tags as you want to a mod without the game complaining. When other mods check for these tags they can also do it without a problem. This way you could add tags of whatever name you want and let others check for this tag for compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with defs|Compatibility with defs]] explains compatibility from the XML side of things.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37394</id>
		<title>Modding Tutorials/Modifying defs</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Modifying_defs&amp;diff=37394"/>
		<updated>2015-09-20T16:29:14Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Created, WIP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
&lt;br /&gt;
This tutorial shows you several ways to modify defs' (ThingDef, PawnKindDef) C# classes and alternatives to changing the XML format for them.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* This tutorial requires you to know [[Modding Tutorials/Writing custom code|how to write custom code]].&lt;br /&gt;
* [[Modding Tutorials/Decompiling source code|Decompiling source code]] is required.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Modifying defs=&lt;br /&gt;
&lt;br /&gt;
There's a few ways to modify existing def formats. We'll go over writing a ''custom defClass'', ''custom comp'' and other ways of integrating XML tags into C# for example through the use of ''weaponTags'' or ''apparelTags''.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Vanilla defClasses==&lt;br /&gt;
&lt;br /&gt;
This chapter helps you develop a broad understanding of the def classes. First we take a look at tags inside &amp;lt;thingDef&amp;gt;, then we take a look at tags inside those tags and finally we take a look at &amp;amp;lt;li&amp;amp;gt; items.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
The structure of a base game defClass might look like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace SomeNameSpace&lt;br /&gt;
{&lt;br /&gt;
	public class SomeDef : Def&lt;br /&gt;
	{&lt;br /&gt;
		public SomeType someTagName;&lt;br /&gt;
		public SomeOtherType someOtherTagName;&lt;br /&gt;
&lt;br /&gt;
		public SomeType someGetClass&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return (SomeType)this.someOtherTagName;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A few notes could be made about this code.&amp;lt;br/&amp;gt;&lt;br /&gt;
* Without the ''using'' part, you'd have to call for '''''Namespace'''.Class.Method()'' instead of ''Class.Method()'' or ''((Class)partOfClass).Method()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using ...;	/* this tells the compiler which namespaces to look for when searching for class and method calls. */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* The ''':''' is inheritance and means you can access all methods in the parent and you can call back to for example the ''Tick()'' method using '''''base'''.Tick()'',&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public class SomeDef : Def	/* inherits &amp;quot;everything&amp;quot; from Def, !! except for privates !! */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Everything of the following format '''is an XML tag''':&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someTagName	/* shows up as &amp;lt;ThingDef&amp;gt;&amp;lt;someTagName&amp;gt;SomeType value&amp;lt;/someTagName&amp;gt;&amp;lt;/ThingDef&amp;gt; */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Besides these tags there's also script-only methods in the code:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;public SomeType someGetClass	/* this is only used in C#. XML doesn't change anything about this */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
* Specifically ''get'' methods are only there for easily accessing or calculating certain values:&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;return ...;	/* example: &amp;quot;public bool IsApparel()&amp;quot; returns &amp;quot;this.apparel != null&amp;quot;. This could be checked easily but Thing.IsApparel() is more readable sometimes */&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In practice one could find the following code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class ThingDef : BuildableDef	/* BuildableDef inherits from Def */&lt;br /&gt;
	{&lt;br /&gt;
		public bool alwaysHaulable;&lt;br /&gt;
&lt;br /&gt;
		public bool designateHaulable;&lt;br /&gt;
&lt;br /&gt;
		public StuffProperties stuffProps;	/* the StuffProperties class defines what this might look like in XML */&lt;br /&gt;
&lt;br /&gt;
		public bool IsStuff&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.stuffProps != null;	/* with some types you can check whether they're defined by checking if they're not equal to null */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		public bool EverHaulable&lt;br /&gt;
		{&lt;br /&gt;
			get&lt;br /&gt;
			{&lt;br /&gt;
				return this.alwaysHaulable || this.designateHaulable;	/* &amp;quot;return A || B&amp;quot; will return true if either A or B is true, and false if both are false. */&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;alwaysHaulable&amp;gt;true&amp;lt;/alwaysHaulable&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;!-- whatever you'd find in StuffProperties --&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: these are snippets of Verse.ThingDef. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Subtags===&lt;br /&gt;
&lt;br /&gt;
To explain how subtags work we'll take a look at (parts of) StuffProperties. The contents of the StuffProperties class, formally called Verse.StuffProperties, are very similar to the ThingDef class. The structure is mostly the same.&amp;lt;br/&amp;gt;&lt;br /&gt;
In case you're wondering why we didn't have to add &amp;quot;using Verse;&amp;quot; to access Verse.StuffProperties, &amp;quot;namespace Verse {}&amp;quot; basically includes a ''using'' statement.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using RimWorld;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
namespace Verse&lt;br /&gt;
{&lt;br /&gt;
	public class StuffProperties&lt;br /&gt;
	{&lt;br /&gt;
		public bool smeltable;&lt;br /&gt;
&lt;br /&gt;
		public StuffAppearance appearance;&lt;br /&gt;
&lt;br /&gt;
		public SoundDef soundImpactStuff;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StatModifier&amp;gt; statOffsets;&lt;br /&gt;
&lt;br /&gt;
		public List&amp;lt;StuffCategoryDef&amp;gt; categories = new List&amp;lt;StuffCategoryDef&amp;gt;();&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of Verse.StuffProperties. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because SomeDef defines which subtags it has you have to modify Verse.SomeDef to alter which subtags it has (this includes modified versions of existing subtags, you have to modify SomeDef at some point).&amp;lt;br/&amp;gt;&lt;br /&gt;
This is one of the reasons you might be better off [[Modding Tutorials/Modifying defs#Custom comp|writing a custom comp]]. These can be added to an XML overwrite or [[Modding Tutorials/Injection|injected through C#]].&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Lists===&lt;br /&gt;
&lt;br /&gt;
Some tags include a list (it contains &amp;amp;lt;li&amp;amp;gt; subtags). If you look at the subtags of StuffProperties you can see two List&amp;lt;SomeType&amp;gt; elements. If you look at the XML you can see a clear distinction between the two:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef&amp;gt;&lt;br /&gt;
		&amp;lt;stuffProps&amp;gt;&lt;br /&gt;
			&amp;lt;categories&amp;gt;&lt;br /&gt;
				&amp;lt;li&amp;gt;Metallic&amp;lt;/li&amp;gt;	/* Metallic is a defName from a StuffCategoryDef */&lt;br /&gt;
			&amp;lt;/categories&amp;gt;&lt;br /&gt;
			&amp;lt;statOffsets&amp;gt;&lt;br /&gt;
				&amp;lt;Beauty&amp;gt;6&amp;lt;/Beauty&amp;gt;	/* Beauty is a defName from a StatDef, but the list's type is StatModifier */&lt;br /&gt;
			&amp;lt;/statOffsets&amp;gt;&lt;br /&gt;
		&amp;lt;/stuffProps&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A clear difference between the two is that one of them defines a list and the other one doesn't. If you look at RimWorld.StatModifier you can find another cause:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;using System;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using Verse;&lt;br /&gt;
&lt;br /&gt;
namespace RimWorld&lt;br /&gt;
{&lt;br /&gt;
	public class StatModifier&lt;br /&gt;
	{&lt;br /&gt;
		public StatDef stat;&lt;br /&gt;
&lt;br /&gt;
		public float value;&lt;br /&gt;
&lt;br /&gt;
		public void LoadDataFromXmlCustom(XmlNode xmlRoot)&lt;br /&gt;
		{&lt;br /&gt;
			CrossRefLoader.RegisterObjectWantsCrossRef(this, &amp;quot;stat&amp;quot;, xmlRoot.Name);&lt;br /&gt;
			this.value = (float)ParseHelper.FromString(xmlRoot.FirstChild.Value, typeof(float));&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
*Note: These are snippets of RimWorld.StatModifier. To find the full source please [[Modding Tutorials/Decompiling source code|decompile the source code]] yourself.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Because of this code the two act completely differently. One is a list with integer keys and StuffCategoryDef values, the other is a list with StatDef keys and float values.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
	Would be nice to expand on this.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Custom def class==&lt;br /&gt;
&lt;br /&gt;
The use of def classes is very popular in small mods. As long as the defs in the mod aren't overwriting core defs, it's very compatible.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Def classes require a pretty hefty overhaul of XML code to work. First of all you will have to change anything in the inheritance to refer to the same class:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;ThingDefs&amp;gt;&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef Name=&amp;quot;BaseSpecificThing&amp;quot; ParentName=&amp;quot;BaseThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;thingDef ParentName=&amp;quot;BaseSpecificThing&amp;quot; Class=&amp;quot;myNamespace.myCustomClass&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&amp;lt;/ThingDefs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And in case you have more thingDefs which require the changes that come with myNamespace.myCustomClass you'll have to set all of their classes for it to work.&amp;lt;br/&amp;gt;&lt;br /&gt;
Applied to core defs this way of doing things introduces incompatibilities with other mods that modify the same def. Creating compatibility patches is inevitable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
On the plus side you make it possible to change the root thingDef tags. In most cases you don't need this but certain things such as Pawn code might have no alternatives.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
==Custom comp class==&lt;br /&gt;
&lt;br /&gt;
Comp classes are a more advanced method of introducing compatibility to mods. Large mods might prefer comps to defs because it requires less XML editing in most cases. Along with that it's possible to inject comps into almost everything (because almost everything inherits from ThingWithComps) without having to change the comp while defs require a new class for each SomeDef they overwrite (E.g PawnKindDef and ThingDef require different classes)&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Comps are easier to add than defClasses and can be injected by C# code. It's lighter on the XML code (doesn't require inheritance to be consistent) and C# code in most cases because it's more of a contained system. There's many hooks implemented which call for C# comp classes, such as CompTick() and PostDestroy(). Just like defs they can introduce incompatibilities. Adding another mod's comps requires the game to have both mods loaded, which can be a problem. Implementing smarter injection might fix this&amp;lt;sup&amp;gt;[?]&amp;lt;/sup&amp;gt; in case a mod isn't loaded, but it's not possible to guarantee that the comp is actually added.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
==Checking for tags==&lt;br /&gt;
&lt;br /&gt;
Instead of using custom defClasses and comps you could also use tags. This is especially useful for lightweight features and simple compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Pros and cons===&lt;br /&gt;
&lt;br /&gt;
Some tags are never used by a certain Thing such as ApparelTag on a Building. If a tag is never used it doesn't throw an error and therefore you could introduce as many useless tags as you want to a mod without the game complaining. When other mods check for these tags they can also do it without a problem. This way you could add tags of whatever name you want and let others check for this tag for compatibility.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Method===&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Compatibility with defs|Compatibility with defs]] explains compatibility from the XML side of things.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=37371</id>
		<title>Modding Tutorials/Decompiling source code</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Decompiling_source_code&amp;diff=37371"/>
		<updated>2015-09-20T14:08:24Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Added See Also, made somewhat more like the other tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The base game provides a bunch of code snippets in ''../Source/'', relative to your Rimworld installation. Since this isn't a lot, one might want to take a look at the game's full source code:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Decompiling source code=&lt;br /&gt;
&lt;br /&gt;
===ILSpy===&lt;br /&gt;
&lt;br /&gt;
One method is to use ILSpy. This software is recommended because its settings are correct on a clean install. It is Windows only, though.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://ilspy.net/ ILSpy] (Download Binaries) and extract it to a directory of your choosing. Optionally create a desktop shortcut;&lt;br /&gt;
# '''Either''': associate the .dll extension with ILSpy:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select a standard program. Navigate to your ILSpy installation and double-click ''ILSpy.exe'', tick the checkbox and accept;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open ILSpy and open a .dll:&lt;br /&gt;
## Open ILSpy;&lt;br /&gt;
## Go to File -&amp;gt; Open or press Ctrl+O, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ILSpy again.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===MonoDevelop===&lt;br /&gt;
&lt;br /&gt;
MonoDevelop is capable of decompiling DLLs, albeit using clumsy initial settings. It is Linux only, otherwise you have to download Xamarin Studio which doesn't have a decompiler.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Download [http://www.monodevelop.com/download/ MonoDevelop] and install it;&lt;br /&gt;
# '''Either''': associate the .dll extension with MonoDevelop:&lt;br /&gt;
## Navigate to ''Assembly-CSharp.dll'' in ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Right-click &amp;quot;Open with&amp;quot; and select MonoDevelop as standard program;&lt;br /&gt;
## Double-click ''Assembly-CSharp.dll'',&lt;br /&gt;
# '''Or''': open MonoDevelop and open a .dll:&lt;br /&gt;
## Open MonoDevelop;&lt;br /&gt;
## Go to File -&amp;gt; Open, navigate to ''../Rimworld***_Data/Managed/'', relative to your Rimworld installation and with *** being a version number;&lt;br /&gt;
## Select ''Assembly-CSharp.dll'' and confirm,&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Visibility&amp;quot; and change it from &amp;quot;Only public members&amp;quot; to &amp;quot;All members&amp;quot;;&lt;br /&gt;
# '''Very important''': search for a dropdown called &amp;quot;Language&amp;quot; and change it from &amp;quot;Summary&amp;quot; to &amp;quot;C#&amp;quot;;&lt;br /&gt;
# Click the &amp;quot;+&amp;quot; next to ''Assembly-CSharp (***)'', you will now see a list including the items ''Rimworld'' and ''Verse'';&lt;br /&gt;
# Take your time to look through the source code, to make yourself familiar. If you ever need the source code, open ''Assembly-CSharp.dll'' again.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See also=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Writing custom code|Writing custom code]] shows a broad overview of C# coding.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37370</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=37370"/>
		<updated>2015-09-20T14:04:10Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* C# tutorials */ Added Modifying defs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&lt;br /&gt;
# [[Modding Tutorials/Compatibility with defs|Compatibility with Existing Defs]]&lt;br /&gt;
# [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
#* [[Modding_Tutorials/Modifying defs|Modifying Defs]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/XML_file_structure&amp;diff=36954</id>
		<title>Modding Tutorials/XML file structure</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/XML_file_structure&amp;diff=36954"/>
		<updated>2015-08-26T18:38:11Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Inheritance */ Summary added&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this tutorial we will start learning the XML syntax, why the base game uses it and what everything about it does.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=What you'll learn=&lt;br /&gt;
&lt;br /&gt;
You'll learn the default structure of def files:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def Name=&amp;quot;Parent&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def ParentName=&amp;quot;Parent&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.. Along with how inheritance using Name, ParentName and Abstract works.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Default Def structure=&lt;br /&gt;
===Standard defs===&lt;br /&gt;
&lt;br /&gt;
Find a Def .xml file in the Core folder, for example thingDefs/Weapons_Guns.xml:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Core/&lt;br /&gt;
    Defs/&lt;br /&gt;
      ThingDefs/&lt;br /&gt;
        Weapons_Guns.xml&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;../Mods/Core/Defs/ThingDefs/Weapons_Guns.xml&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first thing in this file is the following line:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which tells us this .xml files uses UTF-8 encoding and XML version 1.0, which are the default values for these fields - some XML editors choose to hide this line on editing and then save it on top of the document without ever asking the user about it.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After that, the structure of the file consists of '''&amp;lt;Defs&amp;gt;''' and '''&amp;lt;Def&amp;gt;''' tags:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each '''&amp;lt;Def&amp;gt;''' contains something's ''def'' (or definition), which can be used to specify each and every modifiable property, e.g for a certain ''thing'' (thingDef).&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Differences in defs===&lt;br /&gt;
&lt;br /&gt;
If you look through some .xml files, you'll find the code is inconsistent in the use of some defs;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several ''Buildings_**.xml'' files use the '''&amp;lt;Buildings&amp;gt;''' tag instead of the '''&amp;lt;Defs&amp;gt;''' one. They then proceed to use '''&amp;lt;thingDef&amp;gt;''''s inside the '''&amp;lt;Buildings&amp;gt;''' tag.&amp;lt;br/&amp;gt;&lt;br /&gt;
Other ''Buildings_**.xml'' files use '''&amp;lt;Defs&amp;gt;''' instead of '''&amp;lt;ThingDefs&amp;gt;''', and some even use '''&amp;lt;GameData&amp;gt;''' instead of '''&amp;lt;ThingDefs&amp;gt;'''.&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This implies that the name of the beginning and ending tags isn't important. Rimworld doesn't read their names, it just looks whether they exist.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This '''doesn't''' mean that '''&amp;lt;Def&amp;gt;''' tags are interchangeable. Using &amp;quot;&amp;lt;Def&amp;gt;&amp;quot; will break the game; you will have to specify what C# class will be loaded to parse its contents.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full code===&lt;br /&gt;
&lt;br /&gt;
'''It is important that your file follows this structure to the point where mods won't work with multiple &amp;lt;Defs&amp;gt;, or a &amp;lt;Def&amp;gt; outside of &amp;lt;Defs&amp;gt;:'''&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Inheritance=&lt;br /&gt;
&lt;br /&gt;
'''Summary''': In XML, inheritance is used to decrease redundancy. If something has a ParentName=&amp;quot;YourParentName&amp;quot;, it takes all contents from Name=&amp;quot;YourParentName&amp;quot;. In case this ParentName is incomplete this will crash the game, and you stop it from being loaded into the game with Abstract=&amp;quot;True&amp;quot;.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Basegun thingDef===&lt;br /&gt;
&lt;br /&gt;
The first thing in ''Weapons_Guns.xml'' is a '''&amp;lt;thingDef&amp;gt;''' with a Name and Abstract ''type'':&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Abstract type means that contents of this '''&amp;lt;thingDef&amp;gt;''' will not be loaded into the game, that after reading and processing the information in this tag it (the game) will finish reading the XML file and '''discard''' this tag and its contents, leaving alone (not discarding) anything that might have copied (taken, inherited) the contents of it. All of this is done with this tag:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Name type means the contents of this '''&amp;lt;thingDef&amp;gt;''' can be ''inherited'' by (read: copied by) another '''&amp;lt;thingDef&amp;gt;'''. This way you can write everything you're going to repeat a lot throughout the file in a single location, such as the following:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;category&amp;gt;Item&amp;lt;/category&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which notifies that this '''&amp;lt;thingDef&amp;gt;''' is of the ''Item'' category, as opposed to those of the ''Building'' category. Because there's a lot of ''tags'' repeated throughout every thing, this greatly compacts the XML file.&amp;lt;br/&amp;gt;&lt;br /&gt;
The full BaseGun parent only has to be defined once in a file, and can then be inherited (copied) with:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef ParentName=&amp;quot;BaseGun&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;thingDef ParentName=&amp;quot;Parent&amp;quot;&amp;gt;''' inherits all contents from '''&amp;lt;thingDef Name=&amp;quot;Parent&amp;quot;&amp;gt;'''. It is common practice to copy the vanilla BaseGun parent and paste it on top of a mod's Weapons_Guns.xml file.&amp;lt;br/&amp;gt;&lt;br /&gt;
Another parent is BaseBullet which holds every standard bullet's commonly repeated properties, such as the property that bullets don't use hitpoints:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;useHitPoints&amp;gt;False&amp;lt;/useHitPoints&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The last '''&amp;lt;thingDef&amp;gt;''' on top of the file is one with the Name type ''BaseHumanGun'' and the ParentName type ''BaseGun''. It inherits the contents of BaseGun and is inherited by everything with '''&amp;lt;thingDef ParentName=&amp;quot;BaseHumanGun&amp;quot;&amp;gt;''':&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;ThingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A list representation of how inheritance works in Rimworld's XML might help you out, either early on or to collect your thoughts after reading the above.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
# Game launches&lt;br /&gt;
# Game loads XML files:&lt;br /&gt;
## Inheritance information is taken from each tag&lt;br /&gt;
## Anything with a PARENTNAME type inherits (read: copies) and applies all content from its associated NAME type&lt;br /&gt;
##* Anything that gets content is a child&lt;br /&gt;
##* Anything that sends it is a parent&lt;br /&gt;
##* It's possible to be both of these&lt;br /&gt;
## Content information (read: everything between the &amp;lt;thingDef&amp;gt;) is taken and applied for each tag&lt;br /&gt;
##* All interfering content from parents is now overwritten&lt;br /&gt;
## Now that all &amp;lt;Def&amp;gt;s know their contents, ABSTRACT type defs are discarded and therefore ignored by the game&lt;br /&gt;
## All &amp;lt;Def&amp;gt;s and their contents  finish loading&lt;br /&gt;
# Game finishes loading XML files&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Breakdown===&lt;br /&gt;
&lt;br /&gt;
Let's break down the inheritance chunks of the BaseGun code:&amp;lt;br/&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;thingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;thingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;thingDef Name=&amp;quot;BaseBullet&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/thingDef&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|&amp;lt;ThingDef Name=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;amp;lt;thingDef&amp;amp;gt; || The name of this ''tag'', which is read by the game and processed into a correct definition based on this name.&amp;lt;br/&amp;gt;All tags in ''../Mods/Core/Defs/ThingDefs/'' use the '''&amp;lt;thingDef&amp;gt;''' tag.&lt;br /&gt;
|-&lt;br /&gt;
| Name=&amp;quot;BaseGun&amp;quot; || The Name ''type'' of this tag. This tag is a parent with the Name value of &amp;quot;BaseGun&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| Abstract=&amp;quot;True&amp;quot; || The [https://en.wikipedia.org/wiki/Abstract_type Abstract type] of this tag is True.&amp;lt;br/&amp;gt;This makes it so that the contents of this tag aren't ''instantiated'', which in practice means the contents of it can only be inherited by other tags and won't be loaded into the game because its only purpose is in inheritance, in being a parent.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;quot;Is the only use of this '''&amp;lt;thingDef&amp;gt;''' to be inherited from? Yes: add Abstract=&amp;quot;True&amp;quot;. No: don't.&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!colspan=&amp;quot;2&amp;quot;|&amp;lt;ThingDef Name=&amp;quot;BaseHumanGun&amp;quot; ParentName=&amp;quot;BaseGun&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| ParentName=&amp;quot;BaseGun&amp;quot; || The ParentName type of this tag. This tag inherits from a parent with the Name value of &amp;quot;BaseGun&amp;quot;.&lt;br /&gt;
|}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Full code===&lt;br /&gt;
&lt;br /&gt;
After the addition of inheritance, our XML file structure looks like this:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;Defs&amp;gt;&lt;br /&gt;
	&amp;lt;Def Name=&amp;quot;Parent&amp;quot; Abstract=&amp;quot;True&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;Def ParentName=&amp;quot;Parent&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;/Def&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;!-- more &amp;lt;Def&amp;gt;'s --&amp;gt;&lt;br /&gt;
&amp;lt;/Defs&amp;gt;&amp;lt;/source&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* '''&amp;lt;Defs&amp;gt;''' can have any name you want;&lt;br /&gt;
* '''&amp;lt;Def&amp;gt;''' has to have a specific name.&lt;br /&gt;
&lt;br /&gt;
=Next up=&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml]] continues explanations on the BaseGun parent, the tags inside its '''&amp;lt;thingDef&amp;gt;''''s and further information on modding in weaponry.&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=36941</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=36941"/>
		<updated>2015-08-25T10:50:53Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* Table of contents */ Added uniform capitalization on the links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing Mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development Mode]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&lt;br /&gt;
# [[Modding Tutorials/Compatibility with defs|Compatibility with Existing Defs]]&lt;br /&gt;
# [[Modding Tutorials/Sounds|Adding and Testing Sounds]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling Source Code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL Compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# Injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=36940</id>
		<title>Modding Tutorials</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials&amp;diff=36940"/>
		<updated>2015-08-25T10:48:54Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: /* General modding */ Added red link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!--Top Nav Box--&amp;gt;&lt;br /&gt;
{| align=center&lt;br /&gt;
! {{MainSection_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
{| align=center&lt;br /&gt;
| {{Mods_Nav}}&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;hr&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the table of contents for the modding tutorial. Here, you'll learn step by step how to create mods of gradually increasing complexity.&lt;br /&gt;
&lt;br /&gt;
In light of little official documentation, this collection of tutorials has been written in hopes that more players will know how to modify RimWorld and make mods that further broaden horizons and make the game appealing to more audiences despite its early state.&lt;br /&gt;
&lt;br /&gt;
==Table of contents==&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
&lt;br /&gt;
# [[Installing mods|Installing Mods]]&lt;br /&gt;
# [[Modding Tutorials/Folder structure|Exploring the Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Mod folder structure|Mod Folder Structure]]&lt;br /&gt;
# [[Modding Tutorials/Recommended software|Recommended Software]]&lt;br /&gt;
&lt;br /&gt;
===General modding===&lt;br /&gt;
&lt;br /&gt;
* [[Modding Tutorials/Testing mods|Testing mods]]&lt;br /&gt;
** [[Modding Tutorials/Development mode|Development mode]]&lt;br /&gt;
&lt;br /&gt;
===XML tutorials===&lt;br /&gt;
&lt;br /&gt;
# [[Modding Tutorials/XML file structure|XML File Structure]]&lt;br /&gt;
#* [[Modding Tutorials/Weapons Guns|Weapons_Guns.xml Explained]]&lt;br /&gt;
# [[Modding Tutorials/Compatibility with defs|Compatibility with existing defs]]&lt;br /&gt;
# [[Modding Tutorials/Sounds|Adding and testing sounds]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
''The following tutorials are likely outdated''&lt;br /&gt;
* [[Modding Tutorials/Getting Started|Getting Started]]&lt;br /&gt;
* [[Modding Tutorials/Items|Items]]&lt;br /&gt;
* [[Modding Tutorials/Flooring|Flooring]]&lt;br /&gt;
* [[Modding Tutorials/Weapons|Weapons]]&lt;br /&gt;
* [[Modding Tutorials/Furniture|Buildings and Furniture]]&lt;br /&gt;
* [[Modding Tutorials/Plants|Plants]]&lt;br /&gt;
* [[Modding Tutorials/Food|Food]]&lt;br /&gt;
* [[Modding Tutorials/Races and Pawns|Races and Pawns]]&lt;br /&gt;
* [[Modding_Tutorials/Smelter|Buildings and Furniture: Creating a Smelter]]&lt;br /&gt;
&lt;br /&gt;
===C# tutorials===&lt;br /&gt;
# [[Modding_Tutorials/Setting up a solution|Setting up]]&lt;br /&gt;
# [[Modding_Tutorials/Decompiling source code|Decompiling source code]]&lt;br /&gt;
# [[Modding_Tutorials/Writing custom code|Writing Custom Code]]&lt;br /&gt;
# [[Modding_Tutorials/Compatibility_with_DLLs|Mod DLL compatibility]]&lt;br /&gt;
#* [[Modding_Tutorials/Injection|C# injection]]&lt;br /&gt;
# [[Modding_Tutorials/Distribution|Distribution]]&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
''Examples:''&lt;br /&gt;
* [[Modding Tutorials/Assembly Modding Example|Assembly Modding]]&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
&lt;br /&gt;
* [[:Category:Defs|List of Defs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
	<entry>
		<id>https://rimworldwiki.com/index.php?title=Modding_Tutorials/Distribution&amp;diff=36939</id>
		<title>Modding Tutorials/Distribution</title>
		<link rel="alternate" type="text/html" href="https://rimworldwiki.com/index.php?title=Modding_Tutorials/Distribution&amp;diff=36939"/>
		<updated>2015-08-25T10:48:02Z</updated>

		<summary type="html">&lt;p&gt;Alistaire: Made more in line with other tutorials&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{BackToTutorials}}&lt;br /&gt;
{{Credit|[[User:Alistaire|Alistaire]]}}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tutorial suggests steps to take when releasing your mod.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Requirements=&lt;br /&gt;
&lt;br /&gt;
* (Optional): This tutorial requires you to have [[Modding Tutorials/Setting up a solution|set up a solution]].&lt;br /&gt;
* (Optional): You will have to [[Modding Tutorials/Writing custom code|have written code]] (there's no use in an empty project).&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Distribution=&lt;br /&gt;
&lt;br /&gt;
# Compile all your DLLs and make sure they're in the Assemblies folder;&lt;br /&gt;
# Make a copy of your mod and call it (YourModName)-DEV or something along those lines. Strip all files standard users won't need out of the standard version:&lt;br /&gt;
## The Source folder is mostly useless for standard mod users;&lt;br /&gt;
## Backups of older versions of textures and such can be removed from the standard version;&lt;br /&gt;
## Make sure to remove as many XML comments as you want, don't leave spoilers in there for your upcoming updates!&lt;br /&gt;
# Update your About folder, that thing was made in a hurry anyways. Add a nice Preview.png to showcase your mod:&lt;br /&gt;
## Make sure you've updated the targetVersion tag,&lt;br /&gt;
# '''Optional:''' Release your source code.&lt;br /&gt;
## Some mods include the Source folder with the full C# project in it for other modders to check out;&lt;br /&gt;
## Some mods include a Dropbox download link to their source code in the mod's topic. This is also a possibility,&lt;br /&gt;
# Take a look at the &amp;quot;Mod release rules&amp;quot; {{LudeonThread|10561}};&lt;br /&gt;
# Along with that, this {{LudeonThread|7037}} has tips on host sites and further naming conventions.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Modding tutorials]]&lt;/div&gt;</summary>
		<author><name>Alistaire</name></author>
	</entry>
</feed>