Skip to content

vbsp_config conditions

Spencer Brown edited this page Sep 11, 2024 · 5 revisions

Overview

vbsp_config is the main config file for the compiler. It defines all the transformations which occur, and all the options set in items. The final file is produced by joining together all the sub-files in each item, style, and other object as appropriate. There are many top-level blocks, all with different purposes.

Conditions

Conditions are the primary means of modifying items and instances. Conditions effectively work like basic IF statements, where Flags refer to the various conditions required to succeed, and Results define the outcome. The syntax is:

"Conditions"
	{
	"Condition"  
		{
		"Priority" "0" 
		"test1"	"value"  
		"test2"
            {
            "test_options" "..."
            }
		"result"  
			{  
			"Result1"	"value"
			"Result2"
				{
				...
				}
			} 
		"else"
			{
			"Result1"	"value"
			"Result2"
				{
				...
				}
			}
		} 
	"Condition"
		{
		...
		}
	}

All of the toplevel 'tests' must evaluate to true for the condition to be executed. Every instance in the map has each condition evaluated on it. If no flags exist, the condition always executes. If the condition has an else block, that section will be executed instead of the result if the condition flags fail. Multiple else/result blocks can exist, the contents just executes in the order they were defined.

Two special results are the Condition and Switch results. Condition runs a sub-condition if the parent succeeds. This allows for trees of decisions to be performed. Switch runs a test with multiple configurations, executing different results for each. As a special case, Condition, ElseCondition, Switch and ElseSwitch can be placed on the same level as a Result block to reduce excessive indentation in files.

The following compact form:

"Conditions"
    {
    "Condition"  
        {
        "Priority" "0" 
        "test1" "value"
        "result"
            {
            "runs_before_condition" "..."
            }
        "condition"
            {
            "sub_test" "..."
            "result"
                {
                ...
                }
            }
        "elsecondition"
            {
            "sub_test2" "..."
            "result"
                {
                ...
                }
            }
        "else"
            {
            "runs_after_condition" "..."
            }
        }
    }

functions identically to:

"Conditions"
    {
    "Condition"  
        {
        "Priority" "0" 
        "test1" "value"
        "Result"
            {
            "runs_before_condition" "..."
            "condition"
                {
                "sub_test" "..."
                "result"
                    {
                    ...
                    }
                }
            }
        "else"
            {
            "condition"
                {
                "sub_test2" "..."
                "result"
                    {
                    ...
                    }
                }
            "runs_after_condition" "..."
            }
        }
    }

Execution order

Sometimes, the order in which conditions executes matters. For this purpose, a 'priority' value can be set on toplevel conditions. The default value is zero, smaller numbers execute before larger numbers. If necessary, decimal values like 10.000001 can be used, with infinite precision. The ordering is as follows:

  • Each priority level (smallest to largest)
    • Style configurations
    • For each item, sorted alphabetically by ID:
      • all_config
      • style-specific config
      • Any additional configs appended to the definition.
      • ItemConfig definitions.
    • Any #Meta-Conditions

Since the above ordering is somewhat complex, if ordering matters it's better to explicitly set priority levels.

Note that several tests and results require a specific priority level, so that they run before/after certain #Meta-Conditions.

Instance lookup

Special Filenames

In many vbsp_config values, special names can be used to refer to instances set in editoritems, so the same config can apply to multiple styles and prevent duplicating long strings. This takes the form: <ITEM_ID>, <ITEM_ID:1,2>, <ITEM_ID_2:subtype>

When read, the associated item is looked up in editoritems.txt, then the reference is replaced by the relevant instances. If no subtype is specified after the colon, then it evaluates to all non-custom instances. Multiple subtypes can be specified, as well as multiple <lookup> definitions if you need to refer to multiple items.

The subtype can come in three forms:

Numeric subtypes

The simplest is one or more numbers, indicating the instance with that position.

Builtin keywords

Instead of remembering which number corresponds to which instance, the following set of keywords can be used instead. Some refer to multiple subtypes. No checking is done to see whether the subtype makes sense for the item, this is entirely equivalent to the corresponding number.

  • Cube:
    • standard: Normal cube.
    • companion, comp: Companion cube.
    • reflect, redirect, reflection, redirection, laser: Laser cube.
    • sphere, edgeless, ball: Edgeless Safety Cube.
    • franken, monster: FrankenTurret.
  • Floor Button:
    • weighted_, floor_, cube_, sphere_, ball_, edgeless_ + white or black: A specific button instance - ball_white, etc.
    • btn_weighted, etc: Both colours.
    • btn_black, btn_white: A button of that colour, of any type.
  • Track platforms:
    • track_bottom_grate: Grating at the base of enclosed platforms.
    • track_bottom, track_middle, track_top: Three parts of the track.
    • track_single: 1-large track.
    • track_plat, track_platform: Non-oscillating platform.
    • track_platform_oscillate, track_plat_oscil: Oscillating platform.
    • track_plats or track_platforms Both platform types.
    • track_rail: Bottom, middle, top and single track components.
  • Funnels:
    • fun_emitter: The functional emitter part.
    • fun_white: White frame.
    • fun_black: Black frame.
    • fun_frame: Frame in either colour.
  • Fizzlers:
    • fizz_base: Base logic.
    • fizz_mdl, fizz_model: Emitter model.

Custom names

If an instance is defined in editoritems with a non-numeric name, it is considered a "custom subtype". These are not exported for the editor to use, but can instead be looked up by doing <ITEM_ID:bee2_name_of_subtype>.

Predefined names

In addition, there are a number of special predefined name lists (delimited by [square brackets] instead of angled brackets). These are used to identify things like the elevators, instead of remembering the specific indexes and item IDs. For corridors, add a number to choose a specific version instead of all of that type.

  • [glass_128]: Glass/grating clips section.

  • [glass_left_corner]

  • [glass_left_short]

  • [glass_left_straight]

  • [glass_left_convex_corner]

  • (Also glass_right_ and glass_ versions of the above)

  • [coopExit]: Coop Disassembly Room

  • [coopEntry]: Coop Spawn Room (inside the main map)

  • [elevatorEntry], [spEntry]: Entry Elevator

  • [elevatorExit], [spExit]: Exit Elevator

  • [spExitCorr], [spEntryCorr]: SP entry or exit corridors.

  • [coopCorr]: Coop exit corridors.

  • [indToggle]: Antline toggle instance. These are handled directly by the compiler, so they won't actually appear as instances.

  • [indPanCheck], [indPanTimer]: Different indicator panel types. Default PeTI doesn't do this, but these can be different instances.

  • [indPan]: Both indicator panel types.

  • [transitionEnts] : Transition instances for map start and stop, plus some essential globals.

  • [laserEmitter], [laserCatcher], [laserRelay]: Both the center and offset instance for those items.

  • [door_frame_sp]: SP door frames.

  • [door_frame_coop]: Coop door frames.

  • [white_frame_sp], [black_frame_coop], etc: Black/White SP/Coop door frames.

  • [door_frame]: Any entry/exit door frame.

  • [white_frames]: White frames only

  • [black_frames]: Black frames only


List of all defined conditions

Meta-Conditions

Metaconditions are conditions run automatically by the compiler. They cannot be modified, but package conditions can choose a priority to run before or after these operations. Importantly several tests or results must be run before or after some meta-conditions to function properly.

associate_faith_plates (-900):

Parse through the map, collecting all faithplate segments.

Tiling, instancelocs and connections must have been parsed first. Once complete all targets have been removed.

This is done as a meta-condition to allow placing tiles we will attach to.

link_cubes (-750):

Determine the cubes set based on instance settings.

This sets the cube type used by droppers. Marker items like Cube Colourisers, Superposition Entanglers, gel splats (if applied to a dropper) and custom cube items will have been removed.

link_items (-300):

Take the defined linked items, and actually link them together.

mon_camera_link (-275):

Link cameras to monitors.

legacy_scaffold_link (-250.0001):

Apply the legacy scaffold logic.

Prefer using LinkedItems instead.

gen_item_outputs (-250):

Create outputs for all items with connections.

This performs an optimization pass over items with outputs to remove redundancy, then applies all the outputs to the instances. Before this, connection count and inversion values are not valid. After this point, items may not have connections altered, but the connection count is set, checkmark/timer instances exist, etc.

position_exit_signs (-10):

Configure exit signage.

If "remove_exit_signs" is set, then delete them. Otherwise, if "signExitInst" is set, overlay the specified instance on top of the sign pair.

set_elev_videos (50):

Add the scripts and options for customisable elevator videos to the map.

add_voice (100):

Add voice lines to the map.

add_fog_ents (100):

Add the tonemap and fog controllers, based on the skybox.

make_barriers (150):

Make barrier entities.

anti_fizz_bump (200):

Create portal_bumpers and noportal_volumes surrounding fizzlers.

This makes it more difficult to portal-bump through an active fizzler. It is only applied to trigger_portal_cleansers with the Client flag checked.

ap_tag_modifications (200):

Perform modifications for Aperture Tag.

  • Paint is always present in every map!
  • Suppress ATLAS's Portalgun in coop.
  • In singleplayer, override the transition ent instance to have the Gel Gun.
  • Create subdirectories with the user's steam ID to fix a workshop compile bug.

set_player_model (400):

Set the player model in SinglePlayer.

vactube_gen (400):

Generate the vactubes, after most conditions have run.

generate_fizzlers (500):

Generates fizzler models and the brushes according to their set types.

After this is done, fizzler-related conditions will not function correctly. However the model instances are now available for modification.

set_player_portalgun (500):

Controls which portalgun the player will be given.

This does not apply to coop. It checks the 'blueportal' and 'orangeportal' attributes to see what are in the map.

  • If there are no spawners in the map, the player gets a dual portal device.
  • If there are only blue portal spawners, the player gets a orange-only gun.
  • If there are only orange portal spawners, the player gets a blue- only gun (Regular single portal device).
  • If there are both spawner types, the player doesn't get a gun.
  • If the attribute PortalGunOnOff is present, special logic is added for that.
  • If the attribute NeedsPortalMan is present, or the player has a non-dual device the @portalgun manager script is added to enable these features. NeedsPortalMan still works to add this in Coop.

generate_cubes (750):

Generates cube instances.

After this point, all the addon instances, cube entities, droppers etc have been generated.

add_screenshot_logic (750):

If the screenshot type is 'auto', add in the needed ents.

Tests

Ungrouped Conditions

debug:

Displays text when executed, for debugging conditions.

If the text ends with an '=', the instance will also be displayed. As a test, this always evaluates as true.

FaithType:

Valid Priority Levels: greater than -900 Determine the type of faith plate used.

The value can be set to 'straight', 'straightup', 'angled', or 'any' to detect those types of plates.

FizzlerType:

Check if a fizzler is the specified type name.

CheckMarker:

Check if markers are present at a position.

Parameters: * name: The name to look for. This can contain one * to match prefixes/suffixes. * nameVar: If found, set this variable to the actual name. * pos: The position to check. * pos2: If specified, the position is a bounding box from 1 to 2. * radius: Check markers within this distance. If this is specified, pos2 is not permitted. * global: If true, positions are an absolute position, ignoring this instance. * removeFound: If true, remove the found marker. If you don't need it, this will improve performance. * copyto: Copies fixup vars from the searching instance to the one which set the marker. The value is in the form $src $dest. * copyfrom: Copies fixup vars from the one that set the marker to the searching instance. The value is in the form $src $dest.

random:

Randomly is either true or false.

LockingIO:

The LockingIO test is no longer used. Configure locking items in the enhanced editoritems configuration.


Cubes/Droppers

CubeType:

Valid Priority Levels: greater than -750 Check if an instance is/should be a cube.

This is only valid on ITEM_BOX_DROPPER, ITEM_CUBE, and items marked as a custom dropperless cube. The value should be the ID of a cube type, or the following special values:

  • <any>: Any kind of cube item
  • <none>: Not a cube item
  • <companion>: A cube marked as companion-like.
  • <sphere> or <ball>: A sphere-type cube.
  • <reflection> or <reflect>: A reflection-type cube.
  • <dropper>: The dropper half of a pair.
  • <cube>: The cube half of a pair.

DropperColor:

Valid Priority Levels: greater than -750 Detect the color of a cube on droppers.

This is True if the cube is coloured. The value should be a $fixup which will have the tint copied into it.


Global Properties

styleVar:

Checks if the given Style Var is true.

Use the NOT test or "!styleVar" to invert if needed.

has:

Checks if the given Voice Attribute is present.

Use the NOT test or "!has" to invert if needed.

has_music:

Checks the selected music ID.

Use <NONE> for no music.

Game:

Checks which game is being modded.

Accepts the following aliases instead of a Steam ID:

  • PORTAL2
  • APTAG
  • ALATAG
  • TAG
  • Aperture Tag
  • TWTM
  • Thinking With Time Machine
  • DEST_AP
  • Destroyed Aperture

has_char:

Checks to see if the given charcter is present in the voice pack.

<NONE> means no voice pack is chosen. This is case-insensitive, and allows partial matches - Cave matches a voice pack with Cave Johnson.

HasCavePortrait:

Checks to see if the Cave Portrait option is set for the given voice pack.

entryCorridor:

Check the selected entry corridor matches this filename.

exitCorridor:

Check the selected exit corridor matches this filename.

ifMode:

Aliases: iscoop, gamemode
Checks if the game mode is SP or COOP.

ifPreview:

Aliases: preview
Checks if the preview mode status equals the given value.

If preview mode is enabled, the player will start before the entry door, and restart the map after reaching the exit door. If False, they start in the elevator.

Preview mode is always False when publishing.

hasExitSignage:

Check to see if either exit sign is present.

ItemConfig:

Check if an Item Config Panel value matches another value.

  • ID is the ID of the group.
  • Name is the name of the widget, or "name[timer]" to pick the value for timer multi-widgets.
  • The deprecated option UseTimer uses $timer_delay for the timer value. Instead, use name[$timer_delay].
  • Value is the value to compare to.
  • If the value does not exist, this always fails.

Instances

instance:

Evaluates True if the instance matches the given file.

instFlag:

Aliases: InstPart
Evaluates True if the instance contains the given portion.

hasInst:

Checks if the given instance is present anywhere in the map.

hasTrait:

Check if the instance has a specific 'trait', which is set by code.

Current traits:

  • white, black: If editoritems indicates the colour of the item.
  • arrival_departure_transition: arrival_departure_transition_ents.
  • barrier: Glass/grating instances:
    • barrier_128: Segment instance.
    • barrier_frame: Any frame part.
      • frame_convex_corner: Convex corner (unused).
      • frame_short: Shortened frame to fit a corner.
      • frame_straight: Straight frame section.
      • frame_corner: Frame corner section.
      • frame_left: Left half of the frame.
      • frame_right: Right half of the frame.
  • floor_button: ItemButtonFloor type item:
    • btn_ball: Button Type = Sphere.
    • btn_cube: Button Type = Cube
    • weighted: Button Type = Weighted
  • dropperless: A dropperless Cube:
    • cube_standard: Normal Cube.
    • cube_companion: Companion Cube.
    • cube_ball: Edgeless Safety Cube.
    • cube_reflect: Discouragment Redirection Cube.
    • cube_franken: FrankenTurret.
  • preplaced: The various pre-existing instances:
    • coop_corridor: A Coop exit Corridor.
    • sp_corridor: SP entry or exit corridor.
    • corridor_frame: White/black door frame.
    • corridor_1-7: The specified entry/exit corridor.
    • elevator: An elevator instance.
    • entry_elevator: Entry Elevator.
    • exit_elevator: Exit Elevator.
    • entry_corridor: Entry SP Corridor.
    • exit_corridor: Exit SP/Coop Corridor.
  • fizzler: A fizzler item:
    • fizzler_base: Logic instance.
    • fizzler_model: Model instance.
    • cust_shape: Set if the fizzler has been moved to a custom position by ReshapeFizzler.
  • locking_targ: Target of a locking pedestal button.
  • locking_btn: Locking pedestal button.
  • paint_dropper: Gel Dropper:
    • paint_dropper_bomb: Bomb-type dropper.
    • paint_dropper_sprayer: Sprayer-type dropper.
  • panel_angled: Angled Panel-type item.
  • track_platform: Track Platform-style item:
    • plat_bottom: Bottom frame.
    • plat_bottom_grate: Grating.
    • plat_middle: Middle frame.
    • plat_single: One-long frame.
    • plat_top: Top frame.
    • plat_non_osc: Non-oscillating platform.
    • plat_osc: Oscillating platform.
  • tbeam_emitter: Funnel emitter.
  • tbeam_frame: Funnel frame.

instVar:

Checks if the $replace value matches the given value.

The test value follows the form A == B, with any of the three permitted to be variables. The operator can be any of =, ==, <, >, <=, >=, !=. If omitted, the operation is assumed to be ==. If only a single value is present, it is tested as a boolean.

offsetDist:

Check if the given instance is in an offset position.

This computes the distance between the instance location and the center of the voxel. The value can be the distance for an exact check, '< x', '> $var', etc.


Logic

AND:

The AND group evaluates True if all subtests are True.

OR:

The OR group evaluates True if any subtests are True.

NOT:

The NOT group inverts the value of it's one subtest.

Alternatively, simply prefix any test with ! ("!instance").

XOR:

The XOR group returns True if the number of true subtests is odd.

NOR:

The NOR group evaluates True if any subtests are False.

NAND:

The NAND group evaluates True if all subtests are False.


Positioning

rotation:

Aliases: angle, angles, orient, orientation, dir, direction
Check that an instance is pointed in a direction.

The value should be either just the angle to check, or a block of options:

  • direction: A unit vector (XYZ value) pointing in a direction, or some keywords: +z, -y, N/S/E/W, up/down, floor/ceiling, or walls for any wall side.
  • From_dir: The direction the unrotated instance is pointed in. This lets the test check multiple directions.
  • Allow_inverse: If true, this also returns True if the instance is pointed the opposite direction .

posIsSolid:

Checks to see if a tile is present at the given location.

  • Pos is the position of the tile, where 0 0 0 is the floor-position of the brush.
  • Dir is the normal the face is pointing. (0 0 1) is up.
  • Pos2: If set, checks all the tiles in a bounding box.
  • Type defines the type the brush must be:
    • Any requires some sort of surface.
    • Tile allows a black/white tile of some kind.
    • None means that no surface must be present.
    • White requires a portalable surface.
    • Black requires a non-portalable surface.
    • 4x4 requires a tile that forces the 4x4 size.
    • 1x1 requires a tile that does not force a size.
  • Mode specifies how the check is done, if Pos2 is provided:
    • avg/average (default): The tiles will be averaged together. if there is an equal number of white/black tiles, black wins.
    • and: The check must pass on all tiles.
    • or: The check must pass on any tile.
    • same: Checks to see if all tiles are the same. Type is ignored.
    • diff/different: Checks to see if there are multiple tile types. Type is ignored.
  • SetVar defines an instvar which will be given a value of black, white or none depending on the average colour of tiles.
  • If gridPos is true, the position will be snapped, so it aligns with the 128 grid (Useful with fizzler/light strip items).
  • RemoveTile: If set to 1, the tile will be removed if found.
  • Debug: If "Developer Mode" is enabled in BEE options, the location sampled will be marked in the VMF. This key will be written into the comment field to assist with identifying the relevant condition.

PosIsGoo:

Check to see if a given location is submerged in goo.

0 0 0 is the origin of the instance, values are in 128 increments.

BlockType:

Determine the block type at a grid position.

If the value is single value, that should be the type. Otherwise, the value should be a block with 'offset' and 'type' values. The offset is in block increments, with 0 0 0 equal to the mounting voxel. If 'offset2' is also provided, all positions in the bounding box will be checked.

The type should be a space-seperated list of locations:

  • VOID (Outside the map)
  • SOLID (Full wall cube)
  • EMBED (Hollow wall cube)
  • AIR (Inside the map, may be occupied by items)
  • OCCUPIED (Known to be occupied by items)
  • PIT (Bottomless pits, any)
    • PIT_SINGLE (one-high)
    • PIT_TOP
    • PIT_MID
    • PIT_BOTTOM
  • GOO
    • GOO_SINGLE (one-deep goo)
    • GOO_TOP (goo surface)
    • GOO_MID
    • GOO_BOTTOM (floor)

Results

Ungrouped Conditions

QuoteEvent:

Valid Priority Levels: less than +100 Enable a quote event. The given file is the default instance.

SetAreaTex:

Force an area to use certain textures.

This only works in styles using the clumping texture algorithm.

custAntline:

Valid Priority Levels: less than -250 Customise the output antlines.

Options:

  • wall: The configuration for antlines on walls. Same as global style options.
  • floor: The configuration for floor/ceiling antlines. If not provided, this is assumed to be the same as wall.
  • remove_signs: If true, remove the indicator signs.
  • toggle_var: If set, this item controls the toggle state fully of its antlines. This is a fixup var which will be set to the name of the overlays, for user control.

Error:

When executed, this causes the compilation to immediately fail with a custom message.

This can be used when an item is configured in an incorrect manner.

Parameters: * ID: A package:id pair specifying a TransToken in info.txt, containing the actual base message to display. HTML can be used to mark up things like specific keywords or fixups. * Marker: Each of these blocks adds a highlight for a specific location in the map. * Type: Either voxel (to label the whole voxel), or point (for a smaller location). * Offset: Specifies the position, relative to this instance. * Parameters: This allows substituting fixup values into the message. In this block, each key is a name which should match a {field} in the original message. The value is then substituted for that field, if present. These values will always be HTML-escaped.

setFaithAttrs:

Aliases: setFaith, setFaithAttr
Valid Priority Levels: greater than -900 Modify the trigger_catapults used for ItemFaithPlate items.

This can also be used to modify the catapult for bomb-type Gel Droppers.

  • template: The template used for the catapult trigger. For the additional helper trigger, it will be offset upward.
  • offset: Allow shifting the triggers around.

CustomBarrier:

Convert regular glass/grating into a custom barrier type.

The parameter is just the ID of the barrier type to produce. The item this executes on needs to have an output which is connected to a glass/grating item.

LinkedItem:

Valid Priority Levels: less than -300 Marks the current instance for linkage together into a chain.

At priority level -300, the sequence of similarly-marked items this links to is grouped together, and given fixup values to allow linking them.

Every instance has $type set to loop, start, mid or end depending on its role. For each group of linked items, $group is set to a unique number. Then for each item, $ind is set to a unique index (starting at 1), and if it is not an endpoint $next is set to the index of the next item. This should be used by naming items @itemtype_track_$group_$ind, and then connecting that to @itemtype_track_$group_$next. See the Unstationary Scaffold package for an example usage.

Parameters:

  • Group: Should be set to a unique name. All calls with this name can be linked together. If not used, only this specific result call will link.
  • AllowLoop: If true, allow constructing a loop of items. In this situation, the indexes will start at some item at random, and proceed around. The last will then link to the first.
  • AllowStart, AllowEnd, AllowMid: If false, disallows this item to be used in this role. This defaults to true.
  • TransferIO: If true (default), all inputs and outputs are transferred to the first item (index = 1). This instance can then forward the results to the other items in the group.
  • StartLogic/MidLogic/EndLogic/LoopLogic: These instances will be overlaid on the instance, depending on whether it starts/ends or is in the middle of the path. If the item loops, all use LoopLogic. If MidLogic is not specified, an error is produced if the chain is longer than 2 items.
  • Antlines: Controls what happens to antlines linking between the items. If one of the items outputs to a non-linked item, those antlines must be kept. Three behaviours are available:
    • remove (default): Completely remove the antlines.
    • keep: Leave them untouched.
    • move: Move them all to the first item.
  • EndcapInst: Special instance for Unstationary Scaffolds. If the item is facing upwards, and is the end for a mostly horizontal beam it is switched to this instance, and rotated to face towards the previous track.
  • endcap_free_rotate: If true, the endcap can point in any angle, otherwise it points in the nearest 90-degree angle.

SetMarker:

Set a marker at a specific position.

Parameters: * global: If true, the position is an absolute position, ignoring this instance. * name: A name to store to identify this marker/item. * pos: The position or offset to use for the marker.

PistonPlatform:

Generates piston platforms with optimized logic.

This does assume the item behaves similar to the original platform, and will use that VScript.

The first thing this result does is determine if the piston is able to move (has inputs, or automatic mode is enabled). If it cannot, the entire piston can use prop_static props, so a single "full static" instance is used. Otherwise, it will need to move, so func_movelinears must be generated. In this case, 4 pistons are generated. The ones below the bottom point set for the piston (if any) aren't going to move, so they can still be static. But the moving sections must be dynamic.

So further user logic can react to the piston being static, in this case $bottom_level and $top_level are changed to be set to the same value - the height of the piston.

Quite a number of instances are required. These can either be provided in the result configuration directly, or the "itemid" option can be provided. In that case, instances will be looked up under the <ITEM_ID:bee2_pist_XXX> names.

Instances: * fullstatic_0 - fullstatic_4: A fully assembled piston at the specified height, used when it will not move at all. The template below is not used, so this should be included in the instance. * static_1 - static_3: Single piston section, below the moving ones and therefore doesn't need to move. 4 isn't present since if the piston is able to move, the tip/platform will always be moving. * dynamic_1 - dynamic_4: Single piston section, which can move and is parented to pistX. These should probably be identical to the corresponding static_X instance, but just movable.

Parameters: * itemid: If set, instances will be looked up on this item, as mentioned above. * has_dn_fizz: If true, enable the VScript's Think function to enable/disable fizzler triggers. * auto_var: This should be a 0/1 (or fixup variable containing the same) to indicate if the piston has automatic movement, and so cannot use the "full static" instances. * source_ent: If sounds are used, set this to the name of an entity which is used as the source location for the sounds. * snd_start, snd_stop: Soundscript / raw WAV played when the piston starts/stops moving. * snd_loop: Looping soundscript / raw WAV played while the piston moves. * speed: Speed of the piston in units per second. Defaults to 150. * template: Specifies a brush template ID used to generate the func_movelinears. This should contain brushes for collision, each with different visgroups. This is then offset as required to the starting position, and tied to the appropriate entities. Static parts are made func_detail. * visgroup_1-visgroup_3, visgroup_top: Names of the visgroups in the template for each piston segment. Defaults to pist_1-pist_4.

Python:

Aliases: Operation
Apply a function to a fixup.

trackPlatform:

Logic specific to Track Platforms.

This allows switching the instances used depending on if the track is horizontal or vertical and sets the track targetnames to a useful value. This should be run unconditionally, not once per item. Values:

  • orig_item: The "<ITEM_ID>" for the track platform, with angle brackets. This is used to determine all the instance filenames.
  • single_plat: An instance used for the entire platform, if it's one rail long (and therefore can't move).
  • multi_track: If set, replace the track instances with combined versions. Each sub-key should be the length of the piece, with the value the instance to use instead.
  • multi_overlap_ends: If true, the multi-instances will include the space spanned by the top/bottom tracks (but those instances will remain).
  • track_name: If set, rename track instances following the pattern plat_name-track_nameXX. Otherwise, all tracks will receive the name of the platform.
  • plat_suffix: If set, add a _vert or _horiz suffix to the platform.
  • plat_var: If set, save the orientation (vert/horiz) to the provided $fixup variable.
  • track_var: If set, save N, S, E, or W to the provided $fixup variable to indicate the relative direction the top faces.

Specialized Conditions

These are used to implement complex items which need their own code. They have limited utility otherwise.

BarrierHole:

Aliases: GlassHole
Add Glass/grating holes. The value is the ID of a BarrierHole.

UnstScaffold:

Valid Priority Levels: less than -250.0001 The pre-2.4.40 version of the condition used to generate Unstationary Scaffolds.

This has since been swapped to use the LinkedItems result, but this is kept for package compatiblity.

AntLaser:

Valid Priority Levels: less than -250 The condition to generate AntLasers and Antline Corners.

This is executed once to modify all instances.

ATLAS_SpawnPoint:

Create the spawn point for ATLAS in the entry corridor.

It produces either an instance or the normal spawn entity. This is required since ATLAS may need to have the paint gun logic. The two parameters origin and angles must be set to determine the required position, or facing can be set for older files. If global is set, the spawn point will be absolute instead of relative to the current instance.

TagFizzler:

Valid Priority Levels: less than -250 Add an Aperture Tag Paint Gun activation fizzler.

These fizzlers are created via signs, and work very specially. This must be before -250 so that it runs before fizzlers and connections.

makeCatwalk:

Speciallised result to generate catwalks from markers.

Only runs once, and then quits the condition list.

  • `markerInst: The instance set in editoritems.

  • template: Template ID, with visgroups matching the below instance names.

  • Instances:

    • straight_128/256/512: Straight sections. Extends East.
    • `corner: An L-corner piece. Connects on North and West sides.
    • TJunction: A T-piece. Connects on all but the East side.
    • crossJunction: A X-piece. Connects on all sides.
    • end: An end piece. Connects on the East side.
    • stair: A stair. Starts East and goes Up and West.
    • end_wall: Connects a West wall to an East catwalk.
    • support_wall: A support extending from the East wall.
    • support_ceil: A support extending from the ceiling.
    • support_floor: A support extending from the floor.
    • support_goo: A floor support, designed for goo pits.
    • support_end_wall: A support underneath end_wall, attaching it to the wall.
    • single_wall: A section connecting to an East wall.

ConveyorBelt:

Create a conveyor belt.

  • Options:
    • SegmentInst: Generated at each square. (track is the name of the path to attach to.)
    • TrackTeleport: Set the track points so they teleport trains to the start.
    • Speed: The fixup or number for the train speed.
    • MotionTrig: If set, a trigger_multiple will be spawned that EnableMotions weighted cubes. The value is the name of the relevant filter.
    • EndOutput: Adds an output to the last track. The value is the same as outputs in VMFs. RotateSegments: If true (default), force segments to face in the direction of movement.
    • BeamKeys: If set, a list of keyvalues to use to generate an env_beam travelling from start to end. The origin is treated specially - X is the distance from walls, y is the distance to the side, and z is the height. RailTemplate: A template for the track sections. This is made into a non-solid func_brush, combining all sections.
    • NoPortalFloor: If set, add a func_noportal_volume on the floor under the track.
    • PaintFizzler: If set, add a paint fizzler underneath the belt.

CutOutTile:

Generate random quarter tiles, like in Destroyed or Retro maps.

  • MarkerItem is the instance file to look for (<ITEM_BEE2_CUTOUT_TILE>)
  • floor_chance: The percentage change for a segment in the middle of the floor to be a normal tile.
  • floor_glue_chance: The chance for any tile to be glue - this should be higher than the regular chance, as that overrides this.
  • rotateMax is the maximum angle to rotate squarebeam models.
  • squarebeamsSkin sets the skin to use for the squarebeams floor frame.
  • dispBase, if true makes the floor a displacement with random alpha.
  • Materials blocks specify the possible materials to use: - squarebeams is the squarebeams variant to use. - ceilingwalls are the sides of the ceiling section. - floorbase is the texture under floor sections. If dispBase is True this is a displacement material. - tile_glue is used on top of a thinner tile segment. - clip is the player_clip texture used over floor segments. (This allows customising the surfaceprop.)

ResizeableTrigger:

Valid Priority Levels: less than -250 Replace two markers with a trigger brush.

This is run once to affect all of an item. Options:

  • markerInst: <ITEM_ID:1,2> value referencing the marker instances, or a filename.
  • markerItem: The item's ID
  • previewConf: A item config which enables/disables the preview overlay.
  • previewInst: An instance to place at the marker location in preview mode. This should contain checkmarks to display the value when testing.
  • previewMat: If set, the material to use for an overlay func_brush. The brush will be parented to the trigger, so it vanishes once killed. It is also non-solid.
  • previewScale: The scale for the func_brush materials.
  • previewActivate, previewDeactivate: The VMF output to turn the previewInst on and off.
  • triggerActivate, triggerDeactivate: The instance:name;Output outputs used when the trigger turns on or off.
  • coopVar: The instance variable which enables detecting both Coop players. The trigger will be a trigger_playerteam.
  • coopActivate, coopDeactivate: The instance:name;Output outputs used when coopVar is enabled. These should be suitable for a logic_coop_manager.
  • coopOnce: If true, kill the manager after it first activates.
  • keys: A block of keyvalues for the trigger brush. Origin and targetname will be set automatically.
  • localkeys: The same as above, except values will be changed to use instance-local names.

SendificatorLaser:

Valid Priority Levels: less than -250 Record the position of the target for Sendificator Lasers.

Sendificator:

Valid Priority Levels: less than -250 Implement Sendificators.

SignageItem:

Implement the Signage item.

CustVactube:

Valid Priority Levels: less than -250 Specialised result to parse vactubes from markers.

Only runs once, and then quits the condition list. After priority 400, the ents will actually be placed.

Options:

  • group: Specifies the group this belongs to. Items with the same group can be connected together.
  • Instances: Configuration for a set of instances.
    • trig_size: The width of the automatically generated trigger_vphysics_motion and trigger_pushes. If zero, no triggers will be produced.
    • straight_inst: Instance to use for straight segments. This can itself be a block to specify different length variants - the key should be the length in units (128, 256, 192, etc).
    • corner_small_inst, corner_medium_inst, corner_large_inst: The instance for each size of corner turn.
    • temp_corner_small, temp_corner_medium, temp_corner_large: Template IDs (and optionally :visgroups) corresponding to these corner instances. These produce a trigger_vphysics_motion for the corner.
    • support_inst: For straight segments, up to 4 of these are placed to attach the segment to any walls, if adjacient tiles are present.
    • support_ring_inst: Placed over a straight instance, if any support_inst are placed in that voxel.
    • entry_floor_inst: Placed on the start of the tube, if the tube points downward into the floor.
    • entry_ceil_inst: Placed on the start of the tube, if the tube points upward into the ceiling.
    • entry_inst: Placed on the start of the tube, if it faces horizontally.
    • exit_inst: Placed on the end of the tube.

Brushes

GenRotatingEnt:

Properly setup rotating brush entities to match the instance.

This uses the orientation of the instance to determine the correct spawnflags to make it rotate in the correct direction.

This can either modify an existing entity (which may be in an instance), or generate a new one. The generated brush will be 2x2x2 units large, and always set to be non-solid.

For both modes:

  • Axis: specifies the rotation axis local to the instance.
  • Reversed: If set, flips the direction around.
  • Classname: Specifies which entity, since the spawnflags required varies.

For application to an existing entity:

  • ModifyTarget: The local name of the entity to modify.

For brush generation mode:

  • Pos and name are local to the instance, and will set the origin and targetname respectively.
  • Keys are any other keyvalues to be set.
  • Flags sets additional spawnflags. Multiple values may be separated by +, and will be added together.
  • Classname specifies which entity will be created, as well as which other values will be set to specify the correct orientation.
  • AddOut is used to add outputs to the generated entity. It takes the options Output, Target, Input, Inst_targ, Param and Delay. If Inst_targ is defined, it will be used with the input to construct an instance proxy input. If OnceOnly is set, the output will be deleted when fired.

Permitted entities:

AlterTexture:

Aliases: AlterTex, AlterFace
Set the tile at a particular place to use a specific texture.

This can only be set for an entire voxel side at once.

pos is the position, relative to the instance (0 0 0 is the floor-surface). dir is the normal of the texture (pointing out) If gridPos is true, the position will be snapped, so it aligns with the 128 brushes (Useful with fizzler/light strip items).

tex is the texture to use. scale allows you to scale up/down the material - this is a multiplier, not the actual value.

If template is set, the template should be an axis aligned cube. This will be rotated by the instance angles, and then the face with the same orientation will be applied to the face (with the rotation and texture).

AddBrush:

Spawn in a brush at the indicated points.

  • point1 and point2 are locations local to the instance, with 0 0 0 as the floor-position.
  • type is either black or white.
  • detail should be set to 1/0. If true the brush will be a func_detail instead of a world brush.

The sides will be textured with 1x1, 2x2 or 4x4 wall, ceiling and floor textures as needed.

TemplateBrush:

Aliases: BrushTemplate
Import a template VMF file, retexturing it to match orientation.

It will be placed overlapping the given instance. If no block is used, only the ID can be specified. Options:

  • ID: The ID of the template to be inserted. Visgroups can be specified after a colon, comma-seperated (temp_id:vis1,vis2). $fixup variables can be used for any part. As a convenience, if the ID is totally blank this will do nothing.
  • angles: Override the instance rotation, so it is always rotated this much.
  • rotation: Apply the specified rotation before the instance's rotation.
  • offset: Offset the template from the instance's position.
  • force: a space-seperated list of overrides. If 'white' or 'black' is present, the colour of tiles will be overridden. If invert is added, white/black tiles will be swapped. If a tile size (2x2, 4x4, wall, special) is included, all tiles will be switched to that size (if not a floor/ceiling). If 'world' or 'detail' is present, the brush will be forced to that type.
  • replace: A block of template material -> replacement textures. This is case-insensitive - any texture here will not be altered otherwise. If the material starts with a #, it is instead a list of face IDs separated by spaces. If the result evaluates to "", no change occurs. Both can be $fixups (parsed first).
  • bindOverlay: Bind overlays in this template to the given surface, and bind overlays on a surface to surfaces in this template. The value specifies the offset to the surface, where 0 0 0 is the floor position. It can also be a block of multiple positions.
  • alignBindOverlay: If set, align the bindOverlay offsets to the grid.
  • keys/localkeys: If set, a brush entity will instead be generated with these values. This overrides force world/detail. Specially-handled keys: - "origin", offset automatically. - "movedir" on func_movelinear - set a normal surrounded by <>, this gets replaced with angles.
  • colorVar: If this fixup var is set to white or black, that colour will be forced. If the value is <editor>, the colour will be chosen based on the color of the surface for ItemButtonFloor, funnels or entry/exit frames.
  • invertVar: If this fixup value is true, tile colour will be swapped to the opposite of the current force option. This applies after colorVar.
  • visgroup: Sets how visgrouped parts are handled. Several values are possible: - A keyvalues block: Each name should match a visgroup, and the value should be a block of condition tests that if true enables that group. - 'none' (default): All extra groups are ignored. - 'choose': One group is chosen randomly. - a number: The percentage chance for each visgroup to be added.
  • visgroup_force_var: If set and True, visgroup is ignored and all groups are added.
  • pickerVars: If this is set, the results of colorpickers can be read out of the template. The key is the name of the picker, the value is the fixup name to write to. The output is either 'white', 'black' or ''.
  • outputs: Add outputs to the brush ent. Syntax is like VMFs, and all names are local to the instance.
  • senseOffset: If set, colorpickers and tilesetters will be treated as being offset by this amount.

MarkAntigel:

Implement the Antigel marker.

CheckpointTrigger:

Generate a trigger underneath coop checkpoint items.

SetTile:

Aliases: SetTiles
Set 4x4 parts of a tile to the given values.

Offset defines the position of the upper-left tile in the grid. Each Tile section defines a row of the positions to edit like so:

"SetTile"
    {
    "Offset" "-48 48 0"
    "Tile" "BBBB"
    "Tile" "B..B"
    "Tile" "B..B"
    "Tile" "BBBB"
    }
  • Force, if true, will make the specified tiles override any existing ones and create the tile if necessary. Otherwise, they will be merged in - white/black tiles will not replace tiles set to nodraw or void for example.
  • chance, if specified allows producing irregular tiles by randomly not changing the tile.

If you need less regular placement (other orientation, precise positions) use a bee2_template_tilesetter in a template.

Allowed tile characters:

  • W: White tile.
  • w: White 4x4 only tile.
  • B: Black tile.
  • b: Black 4x4 only tile.
  • g: The side/bottom of goo pits.
  • n: Nodraw surface.
  • i: Invert the tile surface, if black/white.
  • 1: Convert to a 1x1 only tile, if a black/white tile.
  • 4: Convert to a 4x4 only tile, if a black/white tile.
  • .: Void (remove the tile in this position).
  • _ or : Placeholder (don't modify this space).
  • x: Cutout Tile (Broken)
  • o: Cutout Tile (Partial)

addPlacementHelper:

Add a placement helper to a specific tile.

Offset and normal specify the position and direction out of the surface the helper should be added to. If upDir is specified, this is the direction of the top of the portal.

SetPanelOptions:

Aliases: SetPanelOpts, SetPanOptions, SetPanOpts, AlterPanelOptions, AlterPanelOpts, AlterPanOptions, AlterPanOpts
Modify an existing panel associated with this instance.

See CreatePanel to add new ones. This is used for panel-type items, allowing them to generate the correct brushwork regardless of the kind of tiles used on the surface. It can also be used to generate some flat "slabs" protruding from a surface. This first finds panels, then applies the various options below if specified.

Search parameters:

  • normal: The direction facing out of the surface. This defaults to "up".
  • pos1, pos2: Search for a panel covering the rectangle covering two diagnonally opposite corners. These default to a full tile.
  • point: Alternatively, individually specify each point to search for panels with irregular shapes.
  • exact: If true, only panels exactly matching the points will be found. If false, any panel overlapping these will be modified.

Options:

  • type: Change the specially handled behaviours set for the panel. Available options:
    • NORMAL: No special behaviour.
    • FLIP_BLACK: Apply black tiles to the backside of the panel, doubling it in thickness.
    • FLIP_INVERT: Apply the inverse colour to the backside of the panel, doubling it in thickness.
    • ANGLED_30, ANGLED_45, ANGLED_60: Rotate the panel to match an extended panel of these angles. As a convenience, the ramp_open_XX_deg animation values will also be accepted.
  • thickness: The thickness of the surface. Must be 2, 4 or 8.
  • bevel: If true, angle the sides. Otherwise, leave them straight.
  • nodraw_sides: If true, apply nodraw to the sides and back instead of squarebeams/backpanels materials.
  • seal: If enabled, nodraw tiles will be generated at the original position to seal in the map.
  • move_bullseye: If set, this will move any bullseye target on the tile. This only affects the actual trajectory, not the visual (which always appears).
  • template: If set, additionally insert this template at the instance's location, merging the brushes into this entity. This can be used for irregularly-shaped tiles, clips or other extra brushes you wish to include. Don't include the sections of panel you're planning to template in the panel's points, or it will generate those tiles as well. Instead use a tile_setter or color_picker to remove them through the template.
  • offset: Offset the brush in any direction. It starts flush where a normal surface would be.
  • keys, localkeys: Make the panel use a brush entity with these options. If not provided or the classname is set to '', the panel is generated as a world brush.

CreatePanel:

Convert a set of tiles into a dynamic entity.

See SetPanelOptions to add new ones. This is used for panel-type items, allowing them to generate the correct brushwork regardless of the kind of tiles used on the surface. It can also be used to generate some flat "slabs" protruding from a surface. All parameters are optional.

Options:

  • normal: The direction facing out of the surface. This defaults to "up".
  • pos1, pos2: The position of the tile on two diagnonally opposite corners. This allows only modifying some of the tiles. These default to a full tile.
  • type: Instructs the panel to use some specially handled behaviours. Available options:
    • NORMAL: No special behaviour.
    • FLIP_BLACK: Apply black tiles to the backside of the panel, doubling it in thickness.
    • FLIP_INVERT: Apply the inverse colour to the backside of the panel, doubling it in thickness.
    • ANGLED_30, ANGLED_45, ANGLED_60: Rotate the panel to match an extended panel of these angles. As a convenience, the ramp_open_XX_deg animation values will also be accepted.
  • thickness: The thickness of the surface. Must be 2, 4 or 8.
  • bevel: If true, angle the sides. Otherwise, leave them straight.
  • nodraw_sides: If true, apply nodraw to the sides and back instead of squarebeams/backpanels materials.
  • seal: If enabled, nodraw tiles will be generated at the original position to seal in the map.
  • move_bullseye: If set, this will move any bullseye target on the tile. This only affects the actual trajectory, not the visual (which always appears).
  • template: If set, additionally insert this template at the instance's location, merging the brushes into this entity. This can be used for irregularly-shaped tiles, clips or other extra brushes you wish to include. Don't include the sections of panel you're planning to template in the panel's points, or it will generate those tiles as well. Instead use a tile_setter or color_picker to remove them through the template.
  • offset: Offset the brush in any direction. It starts flush where a normal surface would be.
  • keys, localkeys: Make the panel use a brush entity with these options. If not provided the panel is generated as a world brush.

TransferBullseye:

Transfer catapult targets and placement helpers from one tile to another.

RotateToPanel:

Find a panel on the specified surface, then rotate the instance if required to match.


Collisions

Collisions:

Modify conditions on the current item. Each block inside is applied one by one:

  • BBox: Add a new collision box for this item:
    • type: Space-seperated list of collision types this collision will contain.
    • tags: Space-seperated list of 'tags' to associate with these collisions.
    • pos1, pos2: The two positions for this bounding box.
    • off1, off2: May be repeated in any order, to apply shifts to the positions. Each must have a 'dir' and 'dist' value pair. The direction is scaled by the distance, then added to the position.
  • Remove: Remove bounding boxes from this item if they have all the tags specified in this value. Alternatively specify "*" to remove all bounding boxes from this item.
  • TrackPlat: Add a bounding box across the whole of a track platform's movement volume. This takes the same parameters as BBox, but the orientation is relative to the tracks not the platform. The volume is placed relative to each track end instance, then those are combined so it "sweeps" from the first to the last.
  • SweepTrace: Traces in a specified direction, then sweeps a bounding box to the impact point. Intended to produce the collisions for things like funnels or light bridges. The trace starts from the midpoint of the initial bounding box, then a new box is formed from the three points.
    • type: Space-seperated list of collision types this collision will contain.
    • tags: Space-seperated list of 'tags' to associate with these collisions.
    • pos1, pos2: The two positions for this bounding box.
    • mask: Space-separated list of collision types which stop the trace. This is always stopped by chamber geometry. This defaults to "SOLID GLASS GRATING".

VScriptCollide:

Mark the specified collision type as being required for VScript code.

All collision volumes containing that type will be written into a VScript database for querying at runtime.

The SOLID type is excluded, since TraceLine should handle that, and it'd be a massive table.


Cubes/Droppers

CubeAddon:

Aliases: DropperAddon
Valid Priority Levels: between -750+750 (inclusive) Attach an addon to an item.

SetDropperOffset:

Valid Priority Levels: between -750+750 (inclusive) Update the position cubes will be spawned at for a dropper.

ChangeCubeType:

Aliases: SetCubeType
Valid Priority Levels: between -750+750 (inclusive) Change the cube-type of a cube item.

This is only valid on ITEM_BOX_DROPPER, ITEM_CUBE, and instances marked as a custom dropperless cube.

CubeFilter:

Valid Priority Levels: greater than -750 Given a set of cube-type IDs, generate a filter for them.

Each cube should be the name of an ID, with ! before to exclude it. It succeeds if a target is any of the included types, and not any of the excluded types (exclusions override inclusion).

The IDs may also be:

  • <any> to detect all cube types (including franken)
  • <companion> to detect 'companion' items.
  • <sphere> to detect sphere-type items.

The resultvar fixup will be set to the name to use.

VScriptCubePredicate:

Valid Priority Levels: greater than -750 Given a set of cube-type IDs, generate VScript code to identify them.

This produces a script to include, which will define the specified function name. Specifying the same filename twice will include all the functions. For that reason the filename should be unique.

Each cube should be the name of an ID, with ! before to exclude it. It succeeds if a target is any of the included types, and not any of the excluded types (exclusions override inclusion). The IDs may also be:

  • <any> to detect all cube types (including franken)
  • <companion> to detect 'companion' items.
  • <sphere> to detect sphere-type items.

Config options:

  • function: Name of the function - called with an entity as an argument.
  • filename: Path to the .nut script, relative to scripts/vscripts/.
  • Cube: A cube to include.

Entities

TemplateOverlay:

Use a template to insert one or more overlays on a surface.

Options:

  • ID: The template ID. Brushes will be ignored.
  • Replace: old -> new material replacements.
  • Face_pos: The offset of the brush face.
  • Normal: The direction of the brush face.
  • Offset: An offset to move the overlays by.

createEntity:

Create an entity.

  • keys and localkeys defines the new keyvalues used.
  • origin and angles are local to the instance.

WaterSplash:

Creates splashes when something goes in and out of water.

Arguments:

  • parent: The name of the parent entity.
  • name: The name given to the env_splash.
  • scale: The size of the effect (8 by default).
  • position: The offset position to place the entity.
  • position2: The offset to which the entity will move.
  • type: Use certain fixup values to calculate pos2 instead: piston_1/2/3/4: Use $bottom_level and $top_level as offsets. track_platform: Use $travel_direction, $travel_distance, etc.
  • fast_check: Check faster for movement. Needed for items which move quickly.

FunnelLight:

Place a light for Funnel items.


Fizzlers

ChangeFizzlerType:

Valid Priority Levels: less than +500 Change the type of the fizzler. Only valid when run on the base instance.

ReshapeFizzler:

Valid Priority Levels: less than -250 Convert a fizzler connected via the output to a new shape.

This allows for different placing of fizzler items.

  • Each segment parameter should be a x y z;x y z pair of positions that represent the ends of the fizzler.
  • up_axis should be set to a normal vector pointing in the new 'upward' direction.
  • If none are connected, a regular fizzler will be synthesized.

The following fixup vars will be set to allow the shape to match the fizzler:

  • $uses_nodraw will be 1 if the fizzler nodraws surfaces behind it.

Global Properties

setOption:

Set a value in the "options" part of VBSP_config.

Each child property will be set.

styleVar:

Set Style Vars.

The value should be a set of SetTrue and SetFalse keyvalues.

has:

Valid Priority Levels: less than +100 Sets a number of Voice Attributes.

Each child property will be set. The value is ignored, but must be present for syntax reasons.

PreCacheModel:

Precache the given model for switching.

This places it as a prop_dynamic_override.

GetItemConfig:

Load a config from the item config panel onto a fixup.

  • ID is the ID of the group.
  • Name is the name of the widget, or "name[timer]" to pick the value for timer multi-widgets.
  • The deprecated option UseTimer uses $timer_delay for the timer value. Instead, use name[$timer_delay].
  • resultVar is the location to store the value into.
  • Default is the default value, if the config isn't found.

I/O

AddOutput:

Add an output from an instance to a global or local name.

Values:

  • output: The output name. Can be <ITEM_ID:activate> or <ITEM_ID:deactivate> to look up the output from that item type. (This is unrelated to instance lookups.)
  • target: The name of the target entity, local to the instance (if not starting with @ or !). If the target is blank, it is fired directly at the instance. That is only useful if replaceInstance has been used to convert the instance into another entity.
  • input: The input to give.
  • parm: Parameters for the input.
  • delay: Delay for the output.
  • only_once: True to make the input last only once (overrides times).
  • times: The number of times to trigger the input.

ChangeIOType:

Valid Priority Levels: less than -250 Switch an item to use different inputs or outputs.

The contents are the same as that allowed in the input BEE2 block in editoritems.

AppendConnInputs:

Valid Priority Levels: less than -250 Append additional outputs to an item's connections, which are fired when inputs change.

This has the same format of the editoritems BEE2 block, but only accepts any number of the following:

  • enable_cmd
  • disable_cmd
  • sec_enable_cmd
  • sec_disable_cmd

Instance Generation

addGlobal:

Add one instance in a specific location.

Options:

  • allow_multiple: Allow multiple copies of this instance. If 0, the instance will not be added if it was already added.
  • name: The targetname of the instance. If blank, the instance will be given a name of the form inst_1234.
  • file: The filename for the instance.
  • angles: The orientation of the instance (defaults to 0 0 0).
  • fixup_style: The Fixup style for the instance. 0 (default) is Prefix, 1 is Suffix, and 2 is None.
  • position: The location of the instance. If not set, it will be placed in a 128x128 nodraw room somewhere in the map. Objects which can interact with nearby object should not be placed there.

addOverlay:

Aliases: overlayinst
Add another instance on top of this one.

If a single value, this sets only the filename. Values:

  • file: The filename.
  • fixup_style: The Fixup style for the instance. '0' (default) is Prefix, '1' is Suffix, and '2' is None.
  • copy_fixup: If true, all the $replace values from the original instance will be copied over.
  • move_outputs: If true, outputs will be moved to this instance.
  • offset: The offset (relative to the base) that the instance will be placed. Can be set to <piston_top> and <piston_bottom> to offset based on the configuration. <piston_start> will set it to the starting position, and <piston_end> will set it to the ending position of the Piston Platform's handles.
  • rotation: Rotate the instance by this amount.
  • angles: If set, overrides rotation and the instance angles entirely.
  • fixup/localfixup: Keyvalues in this block will be copied to the overlay entity.
    • If the value starts with $, the variable will be copied over.
    • If this is present, copy_fixup will be disabled.

AttachInputOverlay:

Valid Priority Levels: less than -250 Add an overlaid instance, which connects to this item as an additional input.

In addition to all options available to AddOverlay, this supports the following options: - input_dual: If this item is a dual input type, specifies which to use: "A", "B" or "A+B". - input_conf: The configuration to use for the new item.

addShuffleGroup:

Pick from a pool of instances to randomise decoration.

For each sub-condition that succeeds, a random instance is placed, with a fixup set to a value corresponding to the condition.

Parameters: - Var: The fixup variable to set on each item. This is used to tweak it to match the condition. - Conditions: Each value here is the value to produce if this instance is required. The contents of the block is then a condition test to check. - Pool: A list of instances to randomly allocate to the conditions. There should be at least as many pool values as there are conditions. - Seed: Value to modify the seed with before placing.

addCavePortrait:

A variant of AddOverlay for adding Cave Portraits.

If the set quote pack is not Cave Johnson, this does nothing. Otherwise, this overlays an instance, setting the $skin variable appropriately. Config values match that of addOverlay.


Instances

rename:

Aliases: changeInstance
Set the file to a value.

suffix:

Aliases: instSuffix
Add the specified suffix to the filename.

setKey:

Set a keyvalue to the given value.

The name and value should be separated by a space.

instVar:

Aliases: instVarSuffix
Append the value of an instance variable to the filename.

Pass either the variable name, or a set of value->suffix pairs for a lookup.

setInstVar:

Aliases: assign, setFixupVar
Set an instance variable to the given value.

Values follow the format $start_enabled 1, with or without the $. $out $in will copy the value of $in into $out.

mapInstVar:

Set one instance var based on the value of another.

The first value is the in -> out var, and all following are values to map.

clearOutputs:

Aliases: clearOutput
Remove the outputs from an instance.

removeFixup:

Aliases: deleteFixup, removeInstVar, deleteInstVar
Remove a fixup from the instance.

localTarget:

Generate a instvar with an instance-local name.

Useful with AddOutput commands, or other values which use targetnames in the parameter. The result takes the form <prefix><instance name>[-<local>]<suffix>.

replaceInstance:

Replace an instance with another entity.

keys and localkeys defines the new keyvalues used. targetname and angles are preset, and origin will be used to offset the given amount from the current location. If keep_instance is true, the instance entity will be kept instead of removed.

GlobalInput:

Trigger an input either on map spawn, or when a relay is triggered.

Arguments:

  • Input: the input to use, either a name or an instance: command.
  • Target: If set, a local name to send commands to. Otherwise, the instance itself.
  • Delay: Number of seconds to delay the input.
  • Name: If set the name of the logic_relay which must be triggered. If not set the output will fire OnMapSpawn.
  • Output: The name of the output, defaulting to OnTrigger. Ignored if Name is not set.
  • Param: The parameter for the output.
  • AlsoOnLoad: If output is firing on map spawn, also fire it on save load too.

Alternatively pass a string VMF-style output, which only provides OnMapSpawn functionality.

ScriptVar:

Set a variable on a script, via a logic_auto.

Name is the local name for the script entity. Var is the variable name. Value is the value to set.


Logic

condition:

Check a different condition if the outer block is true.

switch:

Run the same test multiple times with different arguments.

  • method is the way the search is done - first, last, random, or all.
  • test is the name of the test. (flag is accepted for backwards compatibility.)
  • seed sets the randomisation seed for this block, for the random mode.

Each keyvalues group is a case to check - the Keyvalues name is the test argument, and the contents are the results to execute in that case. The special group "<default>" is only run if no other test is valid. For random mode, you can omit the test to choose from all objects. In this case the test arguments are ignored.

For example:

"Switch"
    {
    "method" "first"
    "test" "instvar"
    "$cube_type 0" // "instvar" "cube_type 0"
        {
        ...
        }
    "$cube_type 1"
        {
        ...
        }
    "<default>"
        {
        // Run for all other types.
        }
    }
// Random mode:
"Switch"
    {
    "method" "random"
    "seed" "unique text"
    ""
        {
        // Choice 1
        }
    ""
        {
        // Choice 2
        }
    ""
        {
        // Choice 3
        }
    }

Main Conditions

debug:

Displays text when executed, for debugging conditions.

If the text ends with an '=', the instance will also be displayed. As a test, this always evaluates as true.

dummy:

Aliases: nop, do_nothing
Dummy result that doesn't do anything.

timedRelay:

Generate a logic_relay with outputs delayed by a certain amount.

This allows triggering outputs based on $timer_delay values.

nextInstance:

Skip to the next instance.

The value will be ignored.

endCondition:

Aliases: nextCondition
Skip to the next condition.

The value will be ignored.

staticPiston:

Convert a regular piston into a static version.

This is done to save entities and improve lighting. If changed to static pistons, the $bottom and $top level become equal. Instances: Bottom_1/2/3: Moving piston with the given $bottom_level Logic_0/1/2/3: Additional logic instance for the given $bottom_level Static_0/1/2/3/4: A static piston at the given height. Alternatively, specify all instances via editoritems, by setting the value to the item ID optionally followed by a :prefix.

GooDebris:

Add random instances to goo squares.

Options: - file: The filename for the instance. The variant files should be suffixed with _1.vmf, _2.vmf, etc. - space: the number of border squares which must be filled with goo for a square to be eligible - defaults to 1. - weight, number: see the Variant result, a set of weights for the options - chance: The percentage chance a square will have a debris item - offset: A random xy offset applied to the instances.


Monitors

Monitor:

Valid Priority Levels: less than -275 Result for the monitor component.

Options:

  • bullseye_name: If possible to break this, this is the name to give the npc_bullseye.
  • bullseye_loc: This is the position to place the bullseye at.
  • bullseye_parent: This is the parent to give the bullseye.

The fixup variable $is_breakable is set to True if lasers or turrets are present to indicate the func_breakable should be added.

Camera:

Valid Priority Levels: less than -275 Result for the camera item.

Options:

  • cam_off: The position that the camera yaws around.

  • yaw_off: The offset from cam_off that the camera rotates up/down.

  • pitch_off: The offset from yaw_off that is where the sensor is.

  • yaw_inst: The instance to place for the yaw rotation.

  • pitch_inst: The instance to place for the up/down rotation.

  • yaw_range: How many degrees can the camera rotate from a forward position?

  • pitch_range: How many degrees can the camera rotate up/down?


Packing

Pack:

Pack files from a packing list.

PackFile:

Adda single file to the map.


Positioning

ReadSurfType:

Read the type of surface at a particular location.

  • Pos is the position of the tile, where 0 0 0 is the floor-position of the brush.
  • Dir is the normal the face is pointing. (0 0 1) is up.
  • Pos2: If set, causes the check to average the tiles in a bounding box. If no tiles are present they're treated as a lack of them. Otherwise, the dominant colour wins, with ties treated as black.
  • ResultVar is the variable which is set. This will be set to black, white or none depending on the average colour of tiles.
  • If gridPos is true, the position will be snapped so it aligns with the 128 grid (Useful with fizzler/light strip items).
  • RemoveTile: If set to 1, the tile will be removed if found.
  • Debug: If "Developer Mode" is enabled in BEE options, the location sampled will be marked in the VMF. This key will be written into the comment field to assist with identifying the relevant condition.

SetBlock:

Set a block to the given value, overwriting the existing value.

  • type is the type of block to set:
    • VOID (Outside the map)
    • SOLID (Full wall cube)
    • EMBED (Hollow wall cube)
    • AIR (Inside the map, may be occupied by items)
    • OCCUPIED (Known to be occupied by items)
    • PIT_SINGLE (one-high)
    • PIT_TOP
    • PIT_MID
    • PIT_BOTTOM
    • GOO_SINGLE (one-deep goo)
    • GOO_TOP (goo surface)
    • GOO_MID
    • GOO_BOTTOM (floor)
  • offset is in block increments, with 0 0 0 equal to the mounting surface.
  • If 'offset2' is also provided, all positions in the bounding box will be set.

forceUpright:

Position an instance to orient upwards while keeping the normal.

The result angle will have pitch and roll set to 0. Vertical instances are unaffected.

switchOrientation:

Apply an alternate orientation.

"wall" makes the attaching surface in the -X direction, making obs rooms, corridors etc easier to build. The Z axis points in the former +X direction. "ceiling" flips the instance, making items such as droppers easier to build. The X axis remains unchanged.

setAngles:

Set the orientation of an instance to a certain angle.

OffsetInst:

Aliases: offsetinstance
Translate the instance locally by the given amount.

The special values <piston>, <piston_bottom> and <piston_top> can be used to offset it based on the starting position, bottom or top position of a piston platform.

OppositeWallDist:

Calculate the distance between this item and the opposing wall.

The value is stored in the $var specified by the property value. Alternately it is set by ResultVar, and offset adds or subtracts to the value. GooCollide means that it will stop when goo is found, otherwise it is ignored. GooAdjust means additionally if the space is GOO, the distance will be modified so that it specifies the surface of the goo.

RotateInst:

Aliases: RotateInstance
Rotate the instance around an axis.

If axis is specified, it should be a normal vector and the instance will be rotated angle degrees around it. Otherwise, angle is a pitch-yaw-roll angle which is applied. around can be a point (local, pre-rotation) which is used as the origin.

As a convenience, the ramp_open_XX_deg animations are also permitted in axis mode.

Tip: If you want to match angled panels, rotate with an axis of 0 -1 0 and an around value of 0 -64 -64.


Randomisation

random:

Randomly choose one of the sub-results to execute.

The chance value defines the percentage chance for any result to be chosen. weights defines the weighting for each result. Both are comma-separated, matching up with the results following. Wrap a set of results in a group property block to treat them as a single result to be executed in order.

variant:

This allows using a random instance from a weighted group.

A suffix will be added in the form _var4. Two or three properties should be given:

  • Number: The number of random instances.
  • Weights: A comma-separated list of weights for each instance.
  • seed: Optional seed to disambiuate multiple options.

Any variant has a chance of weight/sum(weights) of being chosen: A weight of 2, 1, 1 means the first instance has a 2/4 chance of being chosen, and the other 2 have a 1/4 chance of being chosen. The chosen variant depends on the position, direction and name of the instance.

Alternatively, you can use "variant" "number" to choose from equally-weighted options.

RandomNum:

Generate a random number and save in a fixup value.

Parameters:

  • decimal: If true, the value will contain decimals, otherwise it is integer only.
  • ResultVar is the $fixup variable the result will be saved in.
  • seed: If this is set, it will be used to keep the value constant across map recompiles. This should be unique to this use of RandomVec.
  • min, max: These are used to define the range to generate (inclusive). If the min and max are equal that number will always be used instead.

RandomVec:

A variant of RandomNum which generates a random vector instead.

Parameters:

  • decimal: If true, the value will contain decimals, otherwise it is integer only.
  • ResultVar is the $fixup variable the result will be saved in.
  • seed: If this is set, it will be used to keep the value constant across map recompiles. This should be unique to this use of RandomVec.
  • min_x, max_y etc: These are used to define the range to generate (inclusive). If the min and max are equal that number will always be used instead.

randomShift:

Randomly shift a instance by the given amounts.

The positions are local to the instance.


Removed

HollowBrush:

The HollowBrush result is no longer used. The tiling system means this no longer must be done manually.

MarkLocking:

The MarkLocking result is no longer used. Configure locking items in the enhanced editoritems configuration.

changeOutputs:

The changeOutputs result is no longer used. Use ChangeIOType instead.

changeInputs:

The changeInputs result is no longer used. Use ChangeIOType instead.

FaithBullseye:

The FaithBullseye result is no longer used. Faith Plate targets are now entirely generated by the compiler.

faithMods:

The faithMods result is no longer used.

The functions provided by this have been replaced by other features:

  • FaithType can be used to check the type of the plate.
  • setFaithAttrs can be used to modify the trigger.
  • Use the comp_kv_setter entity to add outputs or modify keyvalues on the trigger(s).
Clone this wiki locally