Portal 2 Puzzle Maker/editoritems.txt: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Add some undocumented properties)
Line 82: Line 82:
  "CanAnchorOnBarriers" "1"
  "CanAnchorOnBarriers" "1"
  "CanAnchorOnGoo" "1"
  "CanAnchorOnGoo" "1"
  }
  }


Line 148: Line 149:
; <code>CanAnchorOnBarriers</code>
; <code>CanAnchorOnBarriers</code>
: If enabled, several surfaces will be treated as attachment points: the side of Glass/Grating, tops of 90° Angled/Glass Panels, the surfaces of Track/Piston Platforms, and the sides of Light Bridges. For the latter, the item will be offset slightly so that it sits on the bridge. Eligibility for placement is defined by the relevant item types (<code>ITEM_BARRIER</code>, <code>ITEM_PANEL_ANGLED</code>, <code>ITEM_PANEL_CLEAR</code>, <code>ITEM_RAIL_PLATFORM</code>, <code>ITEM_PISTON_PLATFORM</code>, and <code>ITEM_LIGHT_BRIDGE</code>). For this reason, custom items cannot have other items placed on them. {{bug|Combining this with <code>HANDLE_8_POSITIONS</code> will cause the item to reset to the center of the voxel whenever the chamber geometry is changed.}}
: If enabled, several surfaces will be treated as attachment points: the side of Glass/Grating, tops of 90° Angled/Glass Panels, the surfaces of Track/Piston Platforms, and the sides of Light Bridges. For the latter, the item will be offset slightly so that it sits on the bridge. Eligibility for placement is defined by the relevant item types (<code>ITEM_BARRIER</code>, <code>ITEM_PANEL_ANGLED</code>, <code>ITEM_PANEL_CLEAR</code>, <code>ITEM_RAIL_PLATFORM</code>, <code>ITEM_PISTON_PLATFORM</code>, and <code>ITEM_LIGHT_BRIDGE</code>). For this reason, custom items cannot have other items placed on them. {{bug|Combining this with <code>HANDLE_8_POSITIONS</code> will cause the item to reset to the center of the voxel whenever the chamber geometry is changed.}}
; <code>Deletable</code>
: If disabled, the item cannot be deleted. Generally not needed for custom items, but can be removed from the default items to allow deleting them.
; <code>Copyable</code>
: If disabled, the item cannot be copied by holding Ctrl. Generally not needed for custom items, but can be removed from the default items to allow copying them. {{bug|Uncopyable items can still be copied, by pressing C while the item is selected.}}
; <code>PseudoHandle</code>
: If enabled, this item will play rotation handle sounds when moved. This is used for the <code>_EXTENT</code> items, but can be applied to any class. It should generally not be needed for custom items.
; <code>OccupiesVoxel</code>
: Present on barriers, Faith Plate targets, and the <code>_EXTENT</code> items. Unknown functionality.
; <code>RenderColor</code>
: Present on Faith Plate targets. Unknown functionality, changing it does not seem to affect the in-editor render color.


=== Properties ===
=== Properties ===

Revision as of 09:50, 7 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.

Note.pngNote:This documentation assumes you have a basic knowledge of Hammer and instances.
Note.pngNote:Portal 2 must be restarted for changes to this file to take effect.
Todo: Migrate documentation here from the BEE2 wiki page, and finish things which went undocumented there.

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 SubTypes. 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 SubTypes, 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 to models/props_map_editor, and the selection mesh is loaded from a .3ds file relative to models/puzzlemaker, with selection_ added at the start of the path.
Icon-Bug.pngBug:selection_ is added at the start of the path, rather than the filename. So if ModelName is set to subfolder/model.3ds, the selection mesh would be loaded from selection_subfolder/model.3ds, not subfolder/selection_model.3ds  [todo tested in ?]
Note.pngNote: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.pngWarning: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, and 3 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 by DesiredFacing, 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 with ITEM_LASER_CATCHER, ITEM_LASER_RELAY and ITEM_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 the y axis. When offset, the +x side faces toward the center of the voxel.
    Icon-Bug.pngBug: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.
    Icon-Bug.pngBug: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°.
    Icon-Bug.pngBug: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 the y 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, and CEILING 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 surfaces of Track/Piston Platforms, and the sides of Light Bridges. For the latter, the item will be offset slightly so that it sits on the bridge. Eligibility for placement is defined by the relevant item types (ITEM_BARRIER, ITEM_PANEL_ANGLED, ITEM_PANEL_CLEAR, ITEM_RAIL_PLATFORM, ITEM_PISTON_PLATFORM, and ITEM_LIGHT_BRIDGE). For this reason, custom items cannot have other items placed on them.
Icon-Bug.pngBug: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 ?]
Deletable
If disabled, the item cannot be deleted. Generally not needed for custom items, but can be removed from the default items to allow deleting them.
Copyable
If disabled, the item cannot be copied by holding Ctrl. Generally not needed for custom items, but can be removed from the default items to allow copying them.
Icon-Bug.pngBug:Uncopyable items can still be copied, by pressing C while the item is selected.  [todo tested in ?]
PseudoHandle
If enabled, this item will play rotation handle sounds when moved. This is used for the _EXTENT items, but can be applied to any class. It should generally not be needed for custom items.
OccupiesVoxel
Present on barriers, Faith Plate targets, and the _EXTENT items. Unknown functionality.
RenderColor
Present on Faith Plate targets. Unknown functionality, changing it does not seem to affect the in-editor render color.

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 or 1 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.pngNote:AutoDrop and AutoRespawn 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 99999999999 on the ItemPedestalButton class, and 0 on everything else. 1 or 2 values can be set as the DefaultValue, but cannot be chosen in the editor.
TimerSound ($timersound)
Set to 0 when TimerDelay is infinite, and 1 when finite. Always set to 0 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, with x 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 and ITEM_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 to 64.
UseHelperAngles ($use_helper_angles)
Used on ITEM_PLACEMENT_HELPER, appears to always be set to 0.
ForcePlacement ($force_placement)
Used on ITEM_PLACEMENT_HELPER, appears to always be set to 0.

Exporting

Todo: Document
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.

Item Classes

Todo: Document