RenderPreOffset - originalfoo/Prison-Architect-API GitHub Wiki
##Overview
The RenderPreOffset setting determines the z-index of the second sprite associated with an object.
##Syntax
This optional setting is used in materials.txt and must be within a BEGIN Object ... definition block. It can be used only once per definition block.
RenderPreOffset <number>
Where <number> is an integer (positive or negative). This is added to the object's RenderDepth setting to determine the z-index (render depth) of the second sprite.
##Example
RenderPreOffset 3
##Scripting
Scripts cannot currently access this setting.
##Notes
To try and explain this setting, we'll refer to a base game object that uses it - the RoadGate door. It consists of two sprites:
-
RoadGate- the big door that slides sideways when the door opens -
RoadGatePosts- the pillars either side of the gate that don't move
Here are some pertinent settings from the definition of RoadGate in materials.txt:
-
RenderPreOffset-2 -
RenderDepth2 -
SpriteRoadGate-- main sprite
You notice two things - the RoadGatePosts and their render depth aren't defined.
The render depth is determined as follows:
RoadGatePosts RenderDepth = RoadGate RenderDepth + RenderPreOffset
The z-indexes (render depths) are therefore:
-
2-RoadGateand Vehicles -
0-RoadGatePosts
Because RoadGate is on same z-index as the vehicles it will block their movement when closed, while the RoadGatePosts which are on a lower z-index will not block movement.
And how is the second sprite defined to be RenderGatePosts? We don't know - assumption is that it's hard-coded in game.
We also don't know what the difference is between RenderPreOffset and RenderPostOffset.
It's not yet known if you can use
RenderPostOffsetin conjunction withsprites.pngformat [Sprite](Sprite (sprites.png)) settings which allow you to define multiple sprites in the object's definition block.
##See Also