Skip to content

LocType

Overview

A LocType config contains the descriptive data necessary for the game to construct a LocEntity.

These config types can be found within the config.Loc table:

config.Loc.TRAWLER_GANGPLANK
config.Loc["PERCY_SACKS"]
config.Loc.FromID(456) -- config.Loc.BASALT_FLOOR_DETAIL_1

Info

A LocType is a Proxy usertype, which means it is safe to copy and store in your scripts.
It cannot, however, be used with any persistent storage.

Information available within an LocType includes:

  • Display name
  • MultiLoc configuration

MultiLoc

MultiLocs are special LocType configs which allow an LocEntity to select one of many child LocTypes based on a variable value.

For example, an LocEntity could swap between several LocTypes, with different appearances and/or minimenu options, based on a variable value.
It could also be made invisible, if no LocType is assigned to the current variable value.

Examples

-- Access a LocType config directly by using its name
local winchCfg = config.Loc.WINCHLADDER1
-- or by ID lookup
local winchCfg = config.Loc.FromID(id.Loc.WINCHLADDER1)

Enumerations

LocShapeType

A LocShapeType is a usage hint found in all LocType configs.
A config can have multiple of these LocShapeTypes, each of which having its own set of models to display.

Only one type can be active at a time in a LocEntity, and the current LocShapeType being used is available through the property LocEntity.shapeType.

Name Value
WALL_STRAIGHT 0
WALL_DIAGONALCORNER 1
WALL_L 2
WALL_SQUARECORNER 3
WALLDECOR_STRAIGHT_NOOFFSET 4
WALLDECOR_STRAIGHT_OFFSET 5
WALLDECOR_DIAGONAL_OFFSET 6
WALLDECOR_DIAGONAL_NOOFFSET 7
WALLDECOR_DIAGONAL_BOTH 8
WALL_DIAGONAL 9
CENTREPIECE_STRAIGHT 10
CENTREPIECE_DIAGONAL 11
ROOF_STRAIGHT 12
ROOF_DIAGONAL_WITH_ROOFEDGE 13
ROOF_DIAGONAL 14
ROOF_L_CONCAVE 15
ROOF_L_CONVEX 16
ROOF_FLAT 17
ROOFEDGE_STRAIGHT 18
ROOFEDGE_DIAGONALCORNER 19
ROOFEDGE_L 20
ROOFEDGE_SQUARECORNER 21
GROUNDDECOR 22
WALL_L_ALT 23
WALLDECOR_DIAGONAL_BOTH_ALT 24

Constructors

Info

This usertype has no constructor, and you cannot create your own.

Methods

GetOpCursor

function Loc:GetOpCursor(opIndex : Integer) -> Cursor?

Returns the custom CursorType, if any, used for the given op index.

Parameter Type Description
opIndex Integer The op index.
Valid values are 1 -> 6
Returns Description
CursorType? The cursor type to display.
Returns nil if no op exists for this index, or no custom CursorType is set on an existing op.

Example

-- Get the cursor
local cursor = config.Loc.PLAYER_FORT_TOWNHALL_LVLMID_STAIRS_ORNATE:GetOpCursor(3) -- config.Cursor.CURSOR_CLIMB_DOWN(53)

GetModelIDs

function Loc:GetModelIDs(locShapeType : LocShapeType) -> [ Integer ]

Returns the model IDs associated with the given LocShapeType.

Parameter Type Description
locShapeType LocShapeType The LocShapeType to gather model IDs with.
Returns Description
[ Integer ] The list of model IDs.
Returns an empty list if the LocShapeType is not supported by this config.

Example

-- Get the cursor
local cursor = config.Loc.PLAYER_FORT_TOWNHALL_LVLMID_STAIRS_ORNATE:GetOpCursor(3) -- config.Cursor.CURSOR_CLIMB_DOWN(53)

GetParamValue

function Loc:GetParamValue(param : ParamType) -> ?

Returns the corresponding output value for the given input ParamType.

Parameter Type Description
param ParamType The input param value.
Returns Description
? The corresponding output value.
Returns param.defaultValue if the param is not found in the data structure.

Example

-- Get a value
local value = config.Loc.ELR1_INTERACT_CONSTRUCTION:GetParamValue(config.Param.ELR1_NAME_PLURAL) -- "wooden tortems"

HasParam

function Loc:HasParam(param : ParamType) -> Boolean

Returns whether this config contains output data for the given input ParamType.

Parameter Type Description
param ParamType The input param value.
Returns Description
Boolean Whether a corresponding value exists in this config for ParamType.

Example

-- Get a value, if a param for it exists
if config.Loc.ELR1_INTERACT_CONSTRUCTION:HasParam(config.Param.ELR1_NAME_PLURAL) then
    -- Get the param value
    local value = config.Loc.ELR1_INTERACT_CONSTRUCTION:GetParamValue(config.Param.ELR1_NAME_PLURAL)
end

Properties

Info

All properties are read-only.

Name Type Description
id Integer The ID of this config type.
configName String The name of this config, i.e. "WINCHLADDER1".
typeName String The type of this config. Will always be "Loc".
name String The display name of this config type.
fastPicking Boolean Whether a LocEntity using this config uses a lower accuracy, but faster, picking test on triangles.
width Integer The width of this config on the X axis, in grid units.
length Integer The length of this config on the Z axis, in grid units.
modelOffset Vector3 A positional transform applied to the models of this config.
This is applied before modelScale.
modelScale Vector3 A scaling transform applied to the models of this config.
This is applied after modelOffset and before modelPostOffset.
modelPostOffset Vector3 A final positional transform applied to the models of this config.
This is applied after modelScale.
groundDecorOffset Integer Returns the height offset applied to World.GetGroundHeight() by an entity using this config, if also using LocShapeType.GROUNDDECOR.
hasCustomBounding Boolean Whether a LocEntity using this config uses an overriding AABB bounds for picking tests.
Often used by Locs which have geometry or animations that make them tricky to click.
customBounding AABB? The AABB which describes this configs custom bounds.
Returns nil if none is set.
IsActive Boolean Indicates whether a LocEntity using this config can be modified by the server.
isExamineOnly Boolean Shorthand check for whether this config type contains only an Examine op.
opNames [ String ] A list of names shown for the available ops in this config.
Use pairs() to iterate this list, which will provide both the op index and name as opIndex,opName.
blockWalk Boolean Whether a LocEntity using this config will block route pathing through the tile(s) it is placed on.
quests [ QuestType ] A list of all quests related to this config.
mapElement MapElementType The map element to display for this config.
Returns nil if none is set.
useRandomAnimationFrame Boolean Whether the animation played by LocEntities using this config should start on a random frame.
animations [ SeqType ] A list of animations this config can play.
defaultAnimation SeqType The default animation played by this config.
Returns nil if none is set.
isMultiLoc Boolean Whether this config contains a sub-list of LocTypes and a multiVar variable to use in selecting one.
An LocEntity which uses a multiLoc config will expose it through LocEntity.parentConfig, while the selected LocType sub-list config is exposed through LocEntity.config.
multiVar VarType The variable which controls the currently displayed LocType.
locShapeTypes [ LocShapeType ] Returns a list of all LocShapeTypes supported by this config.
Use these along with Loc:GetModelIDs() to get the model IDs used by this config.
params [ ParamType ] Returns a list of all the ParamTypes stored in this config.