Difference between revisions of "Modding Tutorials/Furniture"

From RimWorld Wiki
Jump to navigation Jump to search
(return link (very helpful))
Line 1: Line 1:
 +
'''[[Modding Tutorials|Back to tutorial index]]'''
 +
 
Buildings and Furniture are distinct mainly by how tall they are defined. Otherwise, both types of objects are usually usable by colonists. For example, both the Comms Console and the Kitchen Stove are used to perform tasks. But the Comms Console is considered a building because it is taller than a colonist while the Kitchen Stove has a counter that is not as tall as the colonist.
 
Buildings and Furniture are distinct mainly by how tall they are defined. Otherwise, both types of objects are usually usable by colonists. For example, both the Comms Console and the Kitchen Stove are used to perform tasks. But the Comms Console is considered a building because it is taller than a colonist while the Kitchen Stove has a counter that is not as tall as the colonist.
  

Revision as of 23:55, 28 April 2014

Back to tutorial index

Buildings and Furniture are distinct mainly by how tall they are defined. Otherwise, both types of objects are usually usable by colonists. For example, both the Comms Console and the Kitchen Stove are used to perform tasks. But the Comms Console is considered a building because it is taller than a colonist while the Kitchen Stove has a counter that is not as tall as the colonist.

Making Furniture Interactive

The first thing most modders want to do when they create new furniture or buildings is to make the object interactive. Interactive objects have a yellow circle indicator that shows where the colonist stands when using the object. If you have completed the Simple Block tutorial open this file again and do the following:

First change the .xml "size" tag to: "(3,2)". This will make your Simple Block the same size as the Comms Console. Don't worry, the texture files don't need to be updated. The image stretch to the new proportion.

Next add a new .xml tag named "hasInteractionSquare" and give it the value "true". This tells the game that the object has a position where colonists can stand to interact with it. Pretty self-explanatory.

Finally add a new .xml tag named "interactionSquareOffset". Give it the value "(0,0,2)". Note that there are three coordinates. This is necessary for the Unity game engine used by Rimworld. The object's center is defined as 0, 0, 0 in the x, y, z coordinate system. Although this may be a bit confusing, for now just remember to ignore the middle value and think of the third value as "y". So the value "(0,0,2)" tells the game that the interaction square is offset from the object's center by two squares on the y-axis.

This is what the three new lines should look like in .xml:

<ThingDef ParentName="BuildingBase">
 ...
 <size>(3,2)</size>
 <hasInteractionSquare>true</hasInteractionSquare>
 <interactionSquareOffset>(0,0,2)</interactionSquareOffset>
 ...
</ThingDef>