Editing Modding Tutorials/Smelter

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
{{BackToTutorials}}
+
<small>< [[Modding Tutorials]]</small>
 
 
 
 
== '''This tutorial is out of date, however there is still some useful information here.
 
''' ==
 
  
 
This tutorial introduces how to make an interactive building. Currently, only work benches can be fully modified using .xml. The Comms console and Nutrient paste dispenser have hard-coded elements. So here we will set out to make a building that follows the work bench pattern.
 
This tutorial introduces how to make an interactive building. Currently, only work benches can be fully modified using .xml. The Comms console and Nutrient paste dispenser have hard-coded elements. So here we will set out to make a building that follows the work bench pattern.
Line 28: Line 24:
 
<author>Your Name Here!</author>
 
<author>Your Name Here!</author>
 
<url>http://rimworldwiki.com/Modding_Tutorials/Smelter</url>
 
<url>http://rimworldwiki.com/Modding_Tutorials/Smelter</url>
<targetVersion>Alpha 6</targetVersion>
+
<targetVersion>Alpha 3</targetVersion>
 
<description>Tutorial mod for recipes and interactive buildings.</description>
 
<description>Tutorial mod for recipes and interactive buildings.</description>
 
</ModMetaData>
 
</ModMetaData>
Line 61: Line 57:
 
     <ThingClass>Building</ThingClass>
 
     <ThingClass>Building</ThingClass>
 
     <Description>A large, hot furnace used to produce metal from ore.</Description>
 
     <Description>A large, hot furnace used to produce metal from ore.</Description>
     <TexturePath>Things/Building/Production/TableStonecutter</TexturePath>
+
     <TexturePath>Things/Building/TableStonecutter</TexturePath>
 
     <CostList>
 
     <CostList>
 
       <li>
 
       <li>
Line 73: Line 69:
 
     <Size>(3,2)</Size>
 
     <Size>(3,2)</Size>
 
     <surfaceNeeded>Heavy</surfaceNeeded>
 
     <surfaceNeeded>Heavy</surfaceNeeded>
     <DesignationCategory>Production</DesignationCategory>
+
     <DesignationCategory>Building</DesignationCategory>
 
     <Passability>Impassable</Passability>
 
     <Passability>Impassable</Passability>
 
   </ThingDef>
 
   </ThingDef>
Line 88: Line 84:
 
</source>
 
</source>
  
The first tag, "hasInteractionSquare" tells the game that this building has an interaction square. It's phrased sort of like a question: "The Smelter has an interaction square?" and then answers the question "Yes, that's true." The second tag, "interactionSquareOffset" tells the game where that square is. The three values refer to the x, y, and z coordinates in the game. This is a bit confusing unless you are intimately aware of how the Unity engine works. Basically, since Unity is used for 3d games, x, y, and z are mandatory. But Rimworld is 2d so only the x and z coordinates matter. Wait, x and z?! Yes, because in Unity, the y coordinate refers to the vertical space. This value is always 0 because Rimworld is flat. It may be easier to just ignore all this and think of the value as "x, 0, y" instead. The offset is measured as distance from the origin of the object. The smelter is 3 units wide by 2 units tall. It's interaction square will be 2 units above its origin.
+
The first tag, "hasInteractionSquare" tells the game that this building has an interaction square. It's phrased sort of like a question: "The Smelter has an interaction square?" and then answers the question "Yes, that's true." The second tag, "interactionSquareOffset" tells the game where that square is. The three values refer to the x, y, and z coordinates in the game. This is a bit confusing unless you are are intimately aware of how the Unity engine works. Basically, since Unity is used for 3d games, x, y, and z are mandatory. But Rimworld is 2d so only the x and z coordinates matter. Wait, x and z?! Yes, because in Unity, the y coordinate refers to the vertical space. This value is always 0 because Rimworld is flat. It may be easier to just ignore all this and think of the value as "x, 0, y" instead. The offset is measured as distance from the origin of the object. The smelter is 3 units wide by 2 units tall. It's interaction square will be 2 units above its origin.
  
 
<source lang="xml">
 
<source lang="xml">
[ ][x][ ] x = the interaction space (2 spaces above the origin)
+
[ ][x][ ] x = the offset space (2 spaces above the origin)
 
[■][■][■]  
 
[■][■][■]  
 
[■][□][■]  
 
[■][□][■]  
Line 112: Line 108:
 
<source lang="xml">
 
<source lang="xml">
 
  <inspectorTabs>
 
  <inspectorTabs>
   <li>ITab_Bills</li>
+
   <li>UI.ITab_Bills</li>
 
  </inspectorTabs>
 
  </inspectorTabs>
 
</source>
 
</source>
Line 162: Line 158:
 
We could add even more things to be produced by adding addition li entries. But for now metal is enough. We set the count value to 5. This may not seem like much, but remember this is slag that we are smelting, which by definition shouldn't have any metal in it at all. But since slag is left in game from crashed shuttles and destroyed buildings, it's ok if we get a little out of it. But it shouldn't be more than the original metal used to make the building that blew up creating the slag. That would be an exploit. It's important to think about how your mod will affect the game's balance if you expect other people to try it out.
 
We could add even more things to be produced by adding addition li entries. But for now metal is enough. We set the count value to 5. This may not seem like much, but remember this is slag that we are smelting, which by definition shouldn't have any metal in it at all. But since slag is left in game from crashed shuttles and destroyed buildings, it's ok if we get a little out of it. But it shouldn't be more than the original metal used to make the building that blew up creating the slag. That would be an exploit. It's important to think about how your mod will affect the game's balance if you expect other people to try it out.
  
Next we will specify the ingredients. This step is just a little more complicated. Insert the following into your recipe:
+
Next we will specify the ingredients. This requires quite a bit more boilerplate. While the recipe product only requires one tag, ingredients require three tags: Ingredients, ParentIngredientFilter, and DefaultIngredientFilter. The exact function of these three tags in an advanced concept and beyond the scope of this tutorial. For now, just remember to define all three and give it the same value, in this case "DebrisSlag". Insert the following into your recipe:
 
<source lang="xml">
 
<source lang="xml">
 
     <ingredients>
 
     <ingredients>
Line 174: Line 170:
 
       </li>
 
       </li>
 
     </ingredients>
 
     </ingredients>
 +
   
 +
    <parentIngredientFilter>
 +
      <thingDefs>
 +
        <li>DebrisSlag</li>
 +
      </thingDefs>
 +
    </parentIngredientFilter>
 +
   
 +
    <defaultIngredientFilter>
 +
      <thingDefs>
 +
        <li>DebrisSlag</li>
 +
      </thingDefs>
 +
    </defaultIngredientFilter>
 
</source>
 
</source>
  
You will notice that the ingredients tag is almost identical in structure to the products tag but has one extra tier called "filter". Basically, the filter tag is a way to select what ingredients your colonists are allowed to use to do a recipe. For example, the cooking recipe bills default to disallow the use of human meat. There are actually more options for affecting the way ingredients are display in the user interface using the "ParentIngredientFilter" and the "DefaultIngredientFilter", both of which are not strictly necessary, so let's ignore them for now. Refer to [[RecipeDef]] if you are curious.
+
Wow. We had to write "DebrisSlag" in three different places just to get the recipe to take slag as its sole ingredient. This may seem overly complex for such a simple task, but it actually makes implementing more complex recipes much easier in the future. For now, just know that not only are we telling the recipe what to take as its ingredient but how to show and filter those ingredients in the user interface.
  
 
Launch the game and see what happens. Everything looks good, right? We added a bill and we can configure it in the bills menu. Wait... there's no slag on the screen. Activate God Mode and then choose "Tool: Spawn thing" from the menu (it's near the bottom of the second column). Then click "Slag debris" from the next menu (it's about the middle of the second column). Click around on screen and drop some slag. Right click when you've finished. Now that there's some slag lying about and a bill to melt it down at the smelter, colonists should start getting to work! Except... they aren't. They're just standing about. Selecting a colonist and right clicking on the smelter also doesn't do anything. That's because our colonists aren't aware that actually completing the bill at the smelter is, well, their job. And that is the third step in making our smelter.
 
Launch the game and see what happens. Everything looks good, right? We added a bill and we can configure it in the bills menu. Wait... there's no slag on the screen. Activate God Mode and then choose "Tool: Spawn thing" from the menu (it's near the bottom of the second column). Then click "Slag debris" from the next menu (it's about the middle of the second column). Click around on screen and drop some slag. Right click when you've finished. Now that there's some slag lying about and a bill to melt it down at the smelter, colonists should start getting to work! Except... they aren't. They're just standing about. Selecting a colonist and right clicking on the smelter also doesn't do anything. That's because our colonists aren't aware that actually completing the bill at the smelter is, well, their job. And that is the third step in making our smelter.
Line 218: Line 226:
 
<author>Your Name</author>
 
<author>Your Name</author>
 
<url>http://http://rimworldwiki.com/</url>
 
<url>http://http://rimworldwiki.com/</url>
<targetVersion>Alpha 6</targetVersion>
+
<targetVersion>Alpha 3</targetVersion>
 
<description>Tutorial mod for recipes and interactive buildings.</description>
 
<description>Tutorial mod for recipes and interactive buildings.</description>
 
</ModMetaData>
 
</ModMetaData>
Line 248: Line 256:
 
     <ThingClass>Building_WorkTable</ThingClass>
 
     <ThingClass>Building_WorkTable</ThingClass>
 
     <Description>A large, hot furnace used to produce metal from ore. The heat required consumes a great deal of electricity so it's best to turn it off when not in use.</Description>
 
     <Description>A large, hot furnace used to produce metal from ore. The heat required consumes a great deal of electricity so it's best to turn it off when not in use.</Description>
     <TexturePath>Things/Building/Production/TableStonecutter</TexturePath>
+
     <TexturePath>Things/Building/TableStonecutter</TexturePath>
 
     <CostList>
 
     <CostList>
 
       <li>
 
       <li>
Line 260: Line 268:
 
     <Size>(3,2)</Size>
 
     <Size>(3,2)</Size>
 
     <surfaceNeeded>Heavy</surfaceNeeded>
 
     <surfaceNeeded>Heavy</surfaceNeeded>
     <DesignationCategory>Production</DesignationCategory>
+
     <DesignationCategory>Building</DesignationCategory>
 
     <Passability>Impassable</Passability>
 
     <Passability>Impassable</Passability>
 
     <hasInteractionSquare>True</hasInteractionSquare>
 
     <hasInteractionSquare>True</hasInteractionSquare>
Line 269: Line 277:
 
     <recipes>
 
     <recipes>
 
       <li>SmeltDebrisSlag</li>
 
       <li>SmeltDebrisSlag</li>
 +
      <!--li>SmeltDebrisRock</li-->
 
     </recipes>
 
     </recipes>
 
   </ThingDef>
 
   </ThingDef>
Line 300: Line 309:
 
       </li>
 
       </li>
 
     </ingredients>
 
     </ingredients>
 +
    <parentIngredientFilter>
 +
      <thingDefs>
 +
        <li>DebrisSlag</li>
 +
      </thingDefs>
 +
    </parentIngredientFilter>
 +
    <defaultIngredientFilter>
 +
      <thingDefs>
 +
        <li>DebrisSlag</li>
 +
      </thingDefs>
 +
    </defaultIngredientFilter>
 
   </RecipeDef>
 
   </RecipeDef>
 
</RecipeDefs>
 
</RecipeDefs>
Line 331: Line 350:
 
* '''Add skill.''' Award experience points to your colonists for smelting and have their skill affect their performance by writing a SkillNeedDef.
 
* '''Add skill.''' Award experience points to your colonists for smelting and have their skill affect their performance by writing a SkillNeedDef.
 
* '''Add art.''' Make your own image to use in the game for the smelter. Add special effects to the colonists as they work. Add a shadow to the building.
 
* '''Add art.''' Make your own image to use in the game for the smelter. Add special effects to the colonists as they work. Add a shadow to the building.
 
[[Category:Modding tutorials]]
 

Please note that all contributions to RimWorld Wiki are considered to be released under the CC BY-SA 3.0 (see RimWorld Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Template used on this page:

This page is a member of 1 hidden category: