Prison Architect

Prison Architect

30 ratings
Materials.txt – Overview – Prison Architect
By leftbehind
The mateials.txt file defines almost everything that appears on the map. This guide is a basic introduction, provides quick reference charts and links to more detailed guides.
   
Award
Favorite
Favorited
Unfavorite
What does it do?
Almost everything that appears on the map is defined by materials.txt. If you want to add a new object, person, vehicle, consumable, tool, weapon, ground texture or just about anything else, this is the place to do it. You can also override definitions of stuff that comes with the game.

What can be defined?

Pretty much everything that appears on the map is defined by materials.txt:
  • Callout – emergency service call outs
  • Equipment – contraband, tools and weapons
  • Material – ground textures, building foundations and walls
  • Object – there are several flavours of object (all of which can be scripted):
    • Entities – people such as guards, dogs, prisoners, staff, etc.
    • Vehicles – trucks, cars, etc.
    • Objects & Utilities – stuff you can build in your prison (desks, showers, CCTV, etc)
    • Consumables – stuff like food, mail and clothes
  • Room – uhm, rooms :)
How does it work?
As it's name suggests, materials.txt is just a text file. It needs to be in the right location and contain the right information for it to actually do anything...

File location

To add or update materials, you'll first need to create a materials.txt file in the 'data' folder of your mod.

For example, if your mod is called "Your Mod", the path to materials.txt would be something like this:

..../Prison Architect/mods/YourMod/data/materials.txt

Note that the filename 'materials.txt' is in lowercase; it won't work any other way.

Example definition

Once you've made a materials.txt, you can start defining things.

Each type of thing that you can define in materials.txt has it's own set of properties. For example, here's what an Object definition might look like:

BEGIN Object Name WarningLight ConstructionTime 4.00000 Toughness 10.00000 Price -50 RenderDepth 2 AttachToWall true Group StaticObject BlockedBy StaticObject BlockedBy UtilityStation MadeOf Composite Properties Scripted Properties SlowDelivery Properties StaticObject Properties Electrical Properties Wired Properties DontAvoid Width 1 Height 1 BEGIN Sprite x 6 y 2 h 2 w 2 RotateType 4 END END

Structure of a definition

Each thing is wrapped in a BEGIN .. END statement like this:

BEGIN Object .... END

After "BEGIN" is a word that defines what sort of thing it is. The properties that follow on the following lines (....) until the "END" statement are the properties defining that thing.

Property types

Most properties are in the form of a "name value" pairs, like this:

Name WarningLight ConstructionTime 4.00000 Toughness 10.00000

The first word is the property name, then there's at least one space, then the value. In the example above we've defined the "Name" property to have a value of "WarningLight", the "ConstructionTime" property to have a value of 4.00000 and the "Toughness" property to have a value of 10.00000.

It doesn't matter how many spaces (if any) appear at the start of the line, or how many spaces are between the property name and it's value (as long as there is at least one space). It's convention to use spaces to indent all the property names and to align all their values.

Some properties, like Name, can only be used once per definition. Others, like "BlockedBy" or "Properties", can be used multiple times to specify multiple values for the same property.

There are some special properties that have their own BEGIN .. END wrapper, for example:

BEGIN Sprite x 6 y 2 h 2 w 2 RotateType 4 END

In this example, we're defining a property called "Sprite" that itself has child properties (x, y, etc). It's more obvious if we separate things on to separate lines (both formats will work, it's personal preference as to which you use):

BEGIN Sprite x 6 y 2 h 2 w 2 RotateType 4 END
Name & Localisation
Name

Every definition in materials.txt must have a Name property that defines it's unique ID in the game.
  • Mandatory: Must be specified for every definition
  • Value type: String (should be TitleCase with no spaces)
  • Singleton: Can appear only once per definition
  • Lua Scripts: Name property is available on all items
Although it doesn't matter where the name appears in the definition, everyone always puts it as the first item immediately after the "BEGIN <thing>" line.

Example of a correclty defined name, in this case for an Object definition:
BEGIN Object Name WarningLight

Examples of incorrectly defined names:
Name Warning Light -- spaces in name (causes errors) Name warninglight -- lowercase (breaks naming convention)

If you specify a name of something that already exists then your definition will replace the existing definition.

If you specify a name that doesn't exist, you'll create a new type of thing with the specified name.

Localisation

To ensure the name is correctly displayed in the game (eg. on the menu, tooltips, etc) you should define it's translation in ..../YourMod/data/Language/base-language.txt.

In the case of the WarningLight example above, which is an Object that appears on the Utilities menu, the language strings were defined as follows:

object_warninglight Warning Light buildtoolbar_popup_uts_warninglight A visual indicator triggered by wired connection

The format of the name locale key depends on what type of thing you're defining:
  • ?? – any definition starting with BEGIN Callout
  • equipment_<name> – any definition starting with BEGIN Equipment
  • material_<name> – any definition starting with BEGIN Material
  • object_<name> – any definition starting with BEGIN Object
  • room_<name> – any definition starting with BEGIN Room
You can also add a description to the menu button tooltips:
  • buildtoolbar_popup_obj_<name> – for Objects menu
  • buildtoolbar_popup_room_<name> – for Rooms menu
  • buildtoolbar_popup_staff_<name> – for Staff menu
  • buildtoolbar_popup_uts_<name> – for Utilities menu
  • todo: find out what keys are used for the materials menu
In addition, you can usually define custom descriptions in tooltips when you hover over your item on the map. To do this you'll have to use a Lua script – see the "Tooltip property" section in Object Scripting with Lua. I've only tested this with "Object" type things, but assume it will work with other items too so long as they can be scripted.

For details on adding additional languages, see the Localisation Guide.
To be continued...
I want to get the detailed guides finished first, then I'll add the quick reference tables.

Links to the currently completed guides are at the top of this guide, I'm hoping to finish all of them within the next few weeks.
7 Comments
Razzula 2 May, 2016 @ 4:29am 
Would it be possible to remove a material - e.g, say if I wanted to remove the option to place dirt.
WissX 23 Jan, 2016 @ 7:32am 
So I can make it so stuff can get me money? cause I am doing sandbox and I would like money wasier so have like a guard pay me 500 per day
Ankle Biter 16 Jan, 2016 @ 1:45am 
Hey, maybe you could help me out. I have tried to modify materials.txt so logs would be unsellable. It works, halfly; they are not exported, but they are still moved to Exports-area and left there. Even when the Workshop runs out of wood, they are not moved away from Exports. Also, even though there is a line in production.txt that tells that rule "storage" will be used on item "logs" in the room "storage", they never take the logs to the Storage Room. Only way I get them to take the logs away from the Export and to the Workshop is removing the Export-area entirely, waiting logs to be moved, and then making a new one. Any idea what I'm doing wrong?
leftbehind  [author] 6 Dec, 2015 @ 5:06pm 
Yes, you can add rooms, objects, contraband, weapons, etc., and also alter existing ones, via modding materials.txt.
crzyp 5 Dec, 2015 @ 8:31pm 
also, you could get this to remove all contraband, right?
crzyp 5 Dec, 2015 @ 8:30pm 
would this add items to prison architect?
BetterBite 24 Oct, 2015 @ 9:27am 
You must print this out create a book about it or a manual and sell it. Cus I would buy it