Consumables - originalfoo/Prison-Architect-API GitHub Wiki
To avoid confusion with actual Materials (terrain, floor and building materials, etc.), we refer to Objects that use
PropertiesMaterialas "Consumables" throughout the entirety of this wiki.
##Overview
##Modding
The following modding options are available...
###Menus & Menu Icons
Consumables generally don't appear on any menu; however as the Utility consumables (see sidebar) illustrate, it's possible to put consumables on a menu (most likely the Objects or Utilities menus).
For more details on the required settings for various menus, see Menus.
###Sprites
The Sprite of a consumable defines what it looks like on the map. There are two approaches to defining sprites (keep reading before choosing one):
Sprite(usingobjects.png)- [
Sprite(usingsprites.png)](Sprite (sprites.png))
If you're using a sprite that's already part of the base game, use the first approach (objects.png). All you'll need to do is refer to the existing sprite by its name.
Note: Many consumable sprites, especially the stack sprites, spill over in to people.png, which is silently merged with objects.png when the game loads. For more information on that weirdness, see objects.spritebank.
If you want to use a custom sprite, use the second approach (sprites.png). There's even an [online sprite editor](Chad's Sprite Editor) you can use.
###Consumable Definitions
Add or replace consumables using BEGIN Object... definition blocks within data/materials.txt, and make sure to add the Properties Material setting to denote that the object is a consumable.
A list of known settings is shown below. Bullet points are just for aesthetics (don't include them in your definition). Bold settings are mandatory, the others are optional.
BEGIN Object
Name<consumableId>-
MadeOf<id> -
MaxStackSize<number>- must also defineStackSpritesetting (see below) -
MoveSpeedFactor<number> -
Price<number> -
PropertiesMaterial- required to identify object as a consumable -
PropertiesSellable -
PropertiesSlowDelivery -
RenderDepth1 -
Sprite<spriteId>- usingobjects.png - [
Sprite ... *](Sprite (sprites.png)) - usingsprites.pngx <offset> y <offset>w <offset> h <offset>-
RotateType<mode> Marker ... *
-
SpriteScale<number> -
StackSprite<spriteId>- required if you definedMaxStackSize -
Teleportabletrue|false -
Toughness<number>
END
#####Utility consumables
There is a special collection of consumables relating to Utilities. Uniquely, this collection appears on the Utilities menu and can be placed in-game by the player, and as a result these specific consumables have a bunch of extra settings:
-
BlockedByLargePipe- only forSmallPipeconsumable -
BlockedByUtilityStation -
ConstructionTime1.00000- required for menu inclusion -
GroupLargePipe- only forLargePipeconsumable -
GroupSmallPipe- only forSmallPipeconsumable -
Price<number>- required for menu inclusion -
PropertiesUtility- required for menu inclusion -
PropertiesCanPlaceOnRoad -
RenderDepth1(for pipes) or2(forElectricalCable)
###Scripting
While all consumables can be scripted using data/scripts/, it's generally best to avoid scripting the consumables themselves due to the vast quantities of them that can appear on the map (which would grind the game to a halt with all those events being triggered every frame).
Instead, script some other object and have that centrally iterate the consumable as applicable.
todo: grants.lua
todo: campaign scripting
##Notes
##See Also