Portal 2 Puzzle Maker/editoritems.txt: Difference between revisions
(Add Properties documentation) |
No edit summary |
||
Line 107: | Line 107: | ||
:* <code>SOUND_EDITING_DEACTIVATE</code>: Played when the item's context menu is closed. | :* <code>SOUND_EDITING_DEACTIVATE</code>: Played when the item's context menu is closed. | ||
:* <code>SOUND_DELETED</code>: Played when the item is deleted. | :* <code>SOUND_DELETED</code>: Played when the item is deleted. | ||
; <code>Animations</code> | ; <code>Animations</code> | ||
Line 134: | Line 132: | ||
:* <code>HANDLE_4_DIRECTIONS</code>: Gives a quarter-circle handle to allow pointing in 4 directions. | :* <code>HANDLE_4_DIRECTIONS</code>: Gives a quarter-circle handle to allow pointing in 4 directions. | ||
:* <code>HANDLE_5_POSITIONS</code>: Allows center-positioning, and 4 side positions. This is done by rotating the item, and switching between two different items when centered/offset. The item types to swap between are hard-coded, so this handle only works with <code>ITEM_LASER_CATCHER</code>, <code>ITEM_LASER_RELAY</code> and <code>ITEM_LASER_EMITTER</code> (<code>_CENTER</code> / <code>_OFFSET</code>). | :* <code>HANDLE_5_POSITIONS</code>: Allows center-positioning, and 4 side positions. This is done by rotating the item, and switching between two different items when centered/offset. The item types to swap between are hard-coded, so this handle only works with <code>ITEM_LASER_CATCHER</code>, <code>ITEM_LASER_RELAY</code> and <code>ITEM_LASER_EMITTER</code> (<code>_CENTER</code> / <code>_OFFSET</code>). | ||
:* <code>HANDLE_6_POSITIONS</code>: Allows centering in two orientations, and offset on the 4 sides. The instance should be centered, with the sides in the <code>y</code> axis. When offset, the <code>+x</code> side faces toward the center of the voxel. {{ | :* <code>HANDLE_6_POSITIONS</code>: Allows centering in two orientations, and offset on the 4 sides. The instance should be centered, with the sides in the <code>y</code> axis. When offset, the <code>+x</code> side faces toward the center of the voxel. {{bug|Combining this with <code>CanAnchorOnBarriers</code> will cause the item to reset to the center of the voxel whenever the chamber geometry is changed.}} | ||
:* <code>HANDLE_8_POSITIONS</code>: Allows placement on the inner and outer quarter tiles in each direction. Instances should be centered 32 units wide. The <code>-x</code> side is placed flush with the voxel border. {{bug|Combining this with <code>CanAnchorOnBarriers</code> will cause the item to reset to the center of the voxel whenever the chamber geometry is changed.}} | :* <code>HANDLE_8_POSITIONS</code>: Allows placement on the inner and outer quarter tiles in each direction. Instances should be centered 32 units wide. The <code>-x</code> side is placed flush with the voxel border. {{bug|Combining this with <code>CanAnchorOnBarriers</code> will cause the item to reset to the center of the voxel whenever the chamber geometry is changed.}} | ||
:* <code>HANDLE_36_DIRECTIONS</code>: Allows rotation on the floor in increments of 10°. {{bug|This handle does not function properly on wall- or ceiling-placed items. <code>InvalidSurface</code> should be used.}} | :* <code>HANDLE_36_DIRECTIONS</code>: Allows rotation on the floor in increments of 10°. {{bug|This handle does not function properly on wall- or ceiling-placed items. <code>InvalidSurface</code> should be used.}} | ||
:* <code>HANDLE_CATAPULT</code>: | :* <code>HANDLE_CATAPULT</code>: Used for Faith Plate items and their targets. Does not appear to have any special functionality. | ||
; <code>DesiredFacing</code> | ; <code>DesiredFacing</code> | ||
: Allows defaulting to a specific orientation on walls: | : Allows defaulting to a specific orientation on walls: | ||
Line 173: | Line 171: | ||
: The default setting for this property. This can be set to invalid values, but will usually crash the game when attempting to switch to a valid option. The only use this has is to make custom cube/gel variants, since they are hardcoded to use the default dropper items. | : The default setting for this property. This can be set to invalid values, but will usually crash the game when attempting to switch to a valid option. The only use this has is to make custom cube/gel variants, since they are hardcoded to use the default dropper items. | ||
; <code>Index</code> | ; <code>Index</code> | ||
: | : Every property on an item must have a unique index in order to export properly. | ||
==== Unclassed Properties ==== | ==== Unclassed Properties ==== | ||
Line 182: | Line 180: | ||
: Required for all items accepting an input. The fixup will be set to the number of items connected to the input. This is usually passed to the "Max Value" option in a {{ent|math_counter}}. | : Required for all items accepting an input. The fixup will be set to the number of items connected to the input. This is usually passed to the "Max Value" option in a {{ent|math_counter}}. | ||
; <code>Start...</code> | ; <code>Start...</code> | ||
: These properties add a checkbox with the given name. The associated fixup variable will be set to <code>0</code> or <code>1</code> as appropriate. | : These properties add a checkbox with the given name. The associated fixup variable will be set to <code>0</code> or <code>1</code> as appropriate. | ||
: | : | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 205: | Line 203: | ||
|} | |} | ||
: {{note|<code>AutoDrop</code> and <code>AutoRespawn</code> will not be inverted on non-cube items, despite the $fixup name. On droppers, they behave normally.}} | : {{note|<code>AutoDrop</code> and <code>AutoRespawn</code> will not be inverted on non-cube items, despite the $fixup name. On droppers, they behave normally.}} | ||
; | ; <code>TimerDelay</code> (<code>$timer_delay</code>) | ||
: Adds a timer widget which allows selecting numbers from <code>3</code>-<code>30</code>, and "infinite". When infinite, it will be set to either <code>0</code> or <code>99999999999</code>. ({{todo|Which?}}) <code>1</code> or <code>2</code> values can be set as the <code>DefaultValue</code>, but cannot be chosen in the editor. | : Adds a timer widget which allows selecting numbers from <code>3</code>-<code>30</code>, and "infinite". When infinite, it will be set to either <code>0</code> or <code>99999999999</code>. ({{todo|Which?}}) <code>1</code> or <code>2</code> values can be set as the <code>DefaultValue</code>, but cannot be chosen in the editor. | ||
; | ; <code>TimerSound</code> (<code>$timersound</code>) | ||
: Set to <code>0</code> when <code>TimerDelay</code> is infinite, and <code>1</code> when finite. Always set to <code>0</code> when no outputs are connected. | : Set to <code>0</code> when <code>TimerDelay</code> is infinite, and <code>1</code> when finite. Always set to <code>0</code> when no outputs are connected. | ||
; <code>CubeType</code> (<code>$cube_type</code>) | |||
: While "type" dropdowns can be used on any item class, most of them require a specific one to function. <code>CubeType</code> is the one exception to this, as it produces a fixup variable that can be used to change an item's behavior regardless of the class. It also provides the most options (5), and should be usable to switch between variants on most items. | |||
; <code>AngledPanelType</code>/<code>AngledPanelAnimation</code> (<code>$animation</code>) | |||
: These two properties add the Angle dropdown normally used for Angled/Glass Panels. The fixup variable is set to <code>ramp_x_degree_open</code>, with <code>x</code> being the angle. | |||
==== Specialized Properties ==== | ==== Specialized Properties ==== | ||
Line 215: | Line 217: | ||
; <code>IndicatorName</code> (<code>$indicator_name</code>) | ; <code>IndicatorName</code> (<code>$indicator_name</code>) | ||
: Used on <code>ITEM_INDICATOR_TOGGLE</code>. | : Used on <code>ITEM_INDICATOR_TOGGLE</code>. The fixup is set to the name of the antline overlays. | ||
; <code>IsTimer</code> (<code>$is_timer</code>) | ; <code>IsTimer</code> (<code>$is_timer</code>) | ||
: Used on <code>ITEM_INDICATOR_PANEL</code> and <code>ITEM_INDICATOR_PANEL_TIMER</code>. Sets the | : Used on <code>ITEM_INDICATOR_PANEL</code> and <code>ITEM_INDICATOR_PANEL_TIMER</code>. Sets the fixup based on the item type. This is not used for Pedestal Buttons. | ||
; <code>HelperRadius</code> (<code>$helper_radius</code>) | ; <code>HelperRadius</code> (<code>$helper_radius</code>) | ||
: Used on <code>ITEM_PLACEMENT_HELPER</code>, appears to always be set to <code>64</code>. | : Used on <code>ITEM_PLACEMENT_HELPER</code>, appears to always be set to <code>64</code>. |
Revision as of 19:20, 6 September 2019
editoritems.txt is the configuration file which defines the items available in the Puzzle Maker. It is located at Portal 2/portal2_dlc2/scripts/editoritems.txt
.

Basic Layout
"ItemData" { "Item" { ... } "Item" { ... } "Renderables" { "Item" { ... } } }
editoritems.txt
is mainly composed of a large number of Item
blocks. These are contained within a top-level ItemData
block. Renderables
defines the models used for the placement error icon and the connection heart, and should not need to be altered.
Item Format
"Item" { "Type" "UNIQUE_ITEM_ID" "ItemClass" "ItemBase" "Editor" { ... } "Properties" { ... } "Exporting" { ... } }
Type
- The ID for this item, which must be unique. Must be present.
ItemClass
- Set to predefined values, providing item-specific behaviors. See below for a list of valid classes and their functionality. This property is optional. The default class is
ItemBase
, and is used if no class is specified.
Following the item type and class, each Item
block is split into 3 sections:
Editor
defines how the item should appear and behave within the Puzzlemaker itself.Properties
defines what properties should appear in the item's context menu, and be exported to the instance as$fixup
variables.Exporting
defines how the item should be exported into compiled maps, along with the item's collisions and embed space in the editor.
Editor
The Editor
block contains one or more SubType
s. Most items will only need one of these, but more can be used to give the item multiple variants if necessary.
"Editor" { "SubTypeProperty" "ButtonType" "SubType" { "Name" "Item Name" "Model" { "ModelName" "model_name.3ds" "TextureName" "texture_name.png" } "Palette" { "Tooltip" "ITEM NAME" "Image" "palette/icon.png" "Position" "0 0 0" } "Sounds" { "SOUND_CREATED" "P2Editor.PlaceOther" "SOUND_EDITING_ACTIVATE" "P2Editor.ExpandOther" "SOUND_EDITING_DEACTIVATE" "P2Editor.CollapseOther" "SOUND_DELETED" "P2Editor.RemoveOther" } } "MovementHandle" "HANDLE_NONE" "DesiredFacing" "DESIRES_UP" "InvalidSurface" "CEILING WALL" "CanAnchorOnBarriers" "1" "CanAnchorOnGoo" "1" }
SubTypeProperty
- If this item has multiple
SubType
s, the property specified here will be used to switch between them. Valve's items only use the "type" dropdowns for this, but any property can be set here, including the pedestal button timer widget. Name
- The name displayed for this item in the Remove Connections dropdown. Valve's items set this to a localization token, but this is not necessary for custom items unless you intend to translate the name. See
Tooltip
for the name displayed in the palette.
ModelName
- The name of the model to display in the editor, with the extension
.3ds
. This is not the name of an actual file, but is used as a base; the visible model is loaded from a.mdl
file relative tomodels/props_map_editor
, and the selection mesh is loaded from a.3ds
file relative tomodels/puzzlemaker
, withselection_
added at the start of the path.Bug:
selection_
is added at the start of the path, rather than the filename. So ifModelName
is set tosubfolder/model.3ds
, the selection mesh would be loaded fromselection_subfolder/model.3ds
, notsubfolder/selection_model.3ds
[todo tested in ?]Note:Some item classes require multiple models. These are set by having multiple
Model
blocks, and can be duplicates. The required models for each class are listed below.Warning:If the required number of models are not specified, the game will crash upon placing the item, regardless of which model would actually be used.
TextureName
- Does not appear to be used, and can be omitted without causing issues. In all of Valve's items, this contains a PNG image to be applied to the model. The actual used textures are materials and their paths are specified within the model itself, so it's unknown what this was used for.
Tooltip
- The name displayed for this item when mousing over it in the palette. Generally written in all uppercase, though this is not required. Valve's items set this to a localization token, but this is not necessary for custom items unless you intend to translate the name.
Image
- The name of the icon to display in the palette, relative to
materials/models/props_map_editor
. The texture itself needs to be a VTF, although it is specified here with a.png
extension. Note that a VMT is not needed for palette icons, unless you also intend to use them elsewhere (such as on a model). Position
- The item's position on the palette.
0 0 0
is the top-left corner, and3 7 0
is the bottom-right.
Sounds
- The names of soundscripts to play when performing certain actions on the item.
SOUND_CREATED
: Played when the item is first placed on a surface.SOUND_EDITING_ACTIVATE
: Played when the item's context menu is opened.SOUND_EDITING_DEACTIVATE
: Played when the item's context menu is closed.SOUND_DELETED
: Played when the item is deleted.
Animations
- Animations to play when performing actions on this item. Note that this is not needed for the standard explode/collapse animations, which will work without this provided they exist in the model.
ANIM_IDLE
: Default animation/pose, when the properties menu is closed. For cubes, this is only used when the dropper is disabled.ANIM_EDITING_ACTIVATE
: Played when the properties menu is opened. If multiple subtypes are present, the new model switches to the last frame of this animation instantly.ANIM_EDITING_DEACTIVATE
: Played when the properties menu is closed.
- Specific to
ItemCubeDropper
:ANIM_REAPPEAR
: Played when the dropper is re-enabled. The first frame should start the dropper far above the origin.ANIM_DISAPPEAR
: Played when the dropper is disabled or deleted. The last frame should end with the dropper far above the origin.
- Specific to
ItemCube
:ANIM_GROUND_TO_FALLING_EDITING
: Played when the dropper is re-enabled, and the properties menu is open.ANIM_FALLING_TO_GROUND_EDITING
: Played when the dropper is disabled, and the properties menu is open.ANIM_GROUND_TO_FALLING
: Played when the dropper is enabled, and the properties menu is closed. This only occurs when the item is first placed.ANIM_FALLING_TO_GROUND
: Played when the dropper is deleted while the properties menu is closed.ANIM_FALLING_EDITING_DEACTIVATE
: Played when the properties menu is closed, and the dropper is enabled.ANIM_FALLING_EDITING_ACTIVATE
: Played when the properties menu is opened, and the dropper is enabled.ANIM_FALLING_IDLE
: Idle animation used when the dropper is enabled.
MovementHandle
- Sets the type of rotation the item will have. The default is
HANDLE_NONE
. The-x
side of the instance is generally the "front" of the item.HANDLE_NONE
: Does not give a handle. The item can still be rotated in 4 directions byDesiredFacing
, or by moving it around the corner of a chamber.HANDLE_4_DIRECTIONS
: Gives a quarter-circle handle to allow pointing in 4 directions.HANDLE_5_POSITIONS
: Allows center-positioning, and 4 side positions. This is done by rotating the item, and switching between two different items when centered/offset. The item types to swap between are hard-coded, so this handle only works withITEM_LASER_CATCHER
,ITEM_LASER_RELAY
andITEM_LASER_EMITTER
(_CENTER
/_OFFSET
).HANDLE_6_POSITIONS
: Allows centering in two orientations, and offset on the 4 sides. The instance should be centered, with the sides in they
axis. When offset, the+x
side faces toward the center of the voxel.Bug:Combining this with
CanAnchorOnBarriers
will cause the item to reset to the center of the voxel whenever the chamber geometry is changed. [todo tested in ?]HANDLE_8_POSITIONS
: Allows placement on the inner and outer quarter tiles in each direction. Instances should be centered 32 units wide. The-x
side is placed flush with the voxel border.Bug:Combining this with
CanAnchorOnBarriers
will cause the item to reset to the center of the voxel whenever the chamber geometry is changed. [todo tested in ?]HANDLE_36_DIRECTIONS
: Allows rotation on the floor in increments of 10°.Bug:This handle does not function properly on wall- or ceiling-placed items.
InvalidSurface
should be used. [todo tested in ?]HANDLE_CATAPULT
: Used for Faith Plate items and their targets. Does not appear to have any special functionality.
DesiredFacing
- Allows defaulting to a specific orientation on walls:
DESIRES_ANYTHING
: default, performing no rotation.DESIRES_UP
: Rotate so+x
is facing upright, and the rotation handle points down.DESIRES_DOWN
: Rotate so-x
is facing upright, and the rotation handle points up.DESIRES_HORIZONTAL
: Rotate so they
axis is vertical. Which side is upright varies depending on which wall it is placed on.
InvalidSurface
- Allows prohibiting placement of the item on a surface. Defaults to none, but can be set to any combination of
WALLS
,FLOOR
, andCEILING
to disallow placement on that surface. CanAnchorOnGoo
- If enabled, the top surface of goo pits will be treated as a surface to attach to.
CanAnchorOnBarriers
- If enabled, several surfaces will be treated as attachment points: the side of Glass/Grating, tops of 90° Angled/Glass Panels, the top of Track Platforms, and the surface of Piston Platforms. Eligibility for placement is defined by the relevant item classes (
ItemBarrier
,ItemAngledPanel
,ItemRailLift
andItemPistonPlatform
).Todo: Is this based on item classes or item types?Bug:Combining this with
HANDLE_8_POSITIONS
will cause the item to reset to the center of the voxel whenever the chamber geometry is changed. [todo tested in ?]
Properties
"Properties" { "PropertyName" { "DefaultValue" "0" "Index" "1" } "StartEnabled" { "DefaultValue" "1" "Index" "2" } . . . }
PropertyName
- Replace with the name of the property, such as
StartEnabled
. Property names can be found below. DefaultValue
- The default setting for this property. This can be set to invalid values, but will usually crash the game when attempting to switch to a valid option. The only use this has is to make custom cube/gel variants, since they are hardcoded to use the default dropper items.
Index
- Every property on an item must have a unique index in order to export properly.
Unclassed Properties
These properties are usable with any item class. They generally only affect the $fixup
variables passed to an instance.
ConnectionCount
($connectioncount
)- Required for all items accepting an input. The fixup will be set to the number of items connected to the input. This is usually passed to the "Max Value" option in a math_counter.
Start...
- These properties add a checkbox with the given name. The associated fixup variable will be set to
0
or1
as appropriate.
Property Name | Editor Label | Fixup |
---|---|---|
StartActive |
"Start active" | $start_active
|
StartDeployed |
"Start deployed" | $start_deployed
|
StartEnabled |
"Start enabled" | $start_enabled
|
StartLocked |
"Start locked" | $start_locked
|
StartOpen |
"Start open" | $start_open
|
StartReversed |
"Start reversed" | $start_reversed
|
AutoDrop |
"Auto-drop first cube" | $disable_autodrop
|
AutoRespawn |
"Auto-respawn cube" | $disable_autorespawn
|
Note:
AutoDrop
andAutoRespawn
will not be inverted on non-cube items, despite the $fixup name. On droppers, they behave normally.TimerDelay
($timer_delay
)- Adds a timer widget which allows selecting numbers from
3
-30
, and "infinite". When infinite, it will be set to either0
or99999999999
. (Todo: Which?)1
or2
values can be set as theDefaultValue
, but cannot be chosen in the editor. TimerSound
($timersound
)- Set to
0
whenTimerDelay
is infinite, and1
when finite. Always set to0
when no outputs are connected. CubeType
($cube_type
)- While "type" dropdowns can be used on any item class, most of them require a specific one to function.
CubeType
is the one exception to this, as it produces a fixup variable that can be used to change an item's behavior regardless of the class. It also provides the most options (5), and should be usable to switch between variants on most items. AngledPanelType
/AngledPanelAnimation
($animation
)- These two properties add the Angle dropdown normally used for Angled/Glass Panels. The fixup variable is set to
ramp_x_degree_open
, withx
being the angle.
Specialized Properties
These few properties are used on certain specific items, which aren't placeable by users.
IndicatorName
($indicator_name
)- Used on
ITEM_INDICATOR_TOGGLE
. The fixup is set to the name of the antline overlays. IsTimer
($is_timer
)- Used on
ITEM_INDICATOR_PANEL
andITEM_INDICATOR_PANEL_TIMER
. Sets the fixup based on the item type. This is not used for Pedestal Buttons. HelperRadius
($helper_radius
)- Used on
ITEM_PLACEMENT_HELPER
, appears to always be set to64
. UseHelperAngles
($use_helper_angles
)- Used on
ITEM_PLACEMENT_HELPER
, appears to always be set to0
. ForcePlacement
($force_placement
)- Used on
ITEM_PLACEMENT_HELPER
, appears to always be set to0
.
Exporting
Offset
- The offset applied to instances. This should generally always be set to
64 64 64
, so the instance rotates around the center of the voxel.