Skip to content
Spencer Brown edited this page May 9, 2021 · 1 revision

Templates are a variant of instances, which are pre-processed and may be manually imported directly into the map by the compiler. This provides several benefits - brushes may be retextured automatically based on context, different brushes can be enabled/disabled, and the map's tiles may be edited. The primary method of placing templates is the TemplateBrush result, but many others use templates to specify brushes used.

Templates are placed in the templates/ folder of packages, and are restricted to a small subset of entities. Aside from the custom entities specified below, only func_detail and info_overlay are supported. Currently, a BrushTemplate section is required in info.txt, but this will no longer be the case soon:

"BrushTemplate"
     {
     "ID" "TEMPLATE_ID"
     "File" "filename.vmf"
     }

Configuration (bee2_template_conf)

All templates must contain exactly one bee2_template_conf entity, which defines its overall configuration.

  • ID: The ID of the template is required, and must be unique across all packages. This is used to reference this template in configuration elsewhere.
  • Template Type: This can be used to override the type of brushes, making them all world or detail.
  • Discard Brushes: This causes all brushes in the template to be completely discarded. This is useful if the template is used only to position overlays placed directly on the map tiles, and the brushes in the template are only present for editing in Hammer.
  • Group Detail Entities: If enabled, any detail brushes without their own visgroups will be placed into their own individual visgroups. This is intended to be used with random visgroup chances in TemplateBrush, allowing tiles to randomly be added/removed. This does not affect world brushes, meaning they will be always present unless visgrouped.
  • Realign Faces: The orientation and offset of these faces will be ignored, and they will instead be aligned the same way Hammer's "face" alignment works. This is useful for axis-aligned tiles, so that multiple templates will match up with each other seamlessly.
  • Skip Faces: These faces will be not be retextured, regardless of the material.
  • Vertical Faces: These faces will be rotated by a multiple of 90 degrees, so that the top of the face points as close to upward as possible while keeping face offset and scaling. This is intended for diagonal faces, so that it remains aligned but is oriented vertically. If the face ends up perfectly horizontal, this has no effect.
  • Overlay Faces: This only has an effect when BindOverlay is specified in TemplateBrush. Existing overlays in the map (antlines, signage etc) affecting the specified tiles will then be also bound to the specified faces.

Retexturing:

Brushes with specific materials will be retextured automatically to use the materials specified by the style, based on the voxel they are in and their orientation. This allows a single template to be created, and then automatically produce the correct result in all styles. Specific materials will be added in BEE2/templates/, in addition to these deprecated "clean" materials:

  • metal/black_wall_metal_002a: 2x2 Black
  • metal/black_wall_metal_002b: 4x4 Black
  • metal/black_wall_metal_002c: 1x1 Black
  • metal/black_wall_metal_002e: 2x1 Black
  • tile/white_wall_tile001a: 1x1 White
  • tile/white_wall_tile003a: 1x1 White
  • tile/white_wall_tile003b: 1x1 White
  • tile/white_wall_tile003h: 1x1 White
  • tile/white_wall_tile003c: 2x2 White
  • tile/white_wall_state: 2x2 White
  • tile/white_wall_tile003f: 4x4 White
  • tile/white_wall_tile004j: 1x1 White, "panel" variant
  • metal/black_floor_metal_bullseye_001: 1x1 Black , "panel" variant
  • tile/white_wall_tile_bullseye 1x1 White, "panel" variant
  • anim_wp/framework/backpanels[_cheap]: Behind tile material
  • anim_wp/framework/squarebeams: Tile edge material
  • glass/glasswindow007a_less_shiny: Styled glass
  • metal/metalgrate018: Grating
  • nature/toxicslime_puzzlemaker_cheap: Toxic Goo
    Special behaviour: if not facing upward, this is switched to nodraw.

Visgroups

To allow enabling or disabling parts of a template, elements may be placed in visgroups, and will then only be used if all visgroups are activated. In most places where a template ID can be specified, visgroups can be specified in the format TEMP_ID: visgroup, visgroup.

Scaling Templates

Scaling templates are a special kind of template, used to configure material scale, rotation and offset for faces in the map. They consist of a template containing only a config ent and a cubic brush placed at the origin. Each of the faces is then the orientation for that side. This can be used to specify the orientation for glass and grating, for example.

Colour Pickers (bee2_template_colorpicker)

Colour pickers are used to read the colour of tiles in the map, and then apply them to brushes. The picker should be placed at the center of a 32-grid tile, and then the red arrow pointed out of the front of tile. Note that if a colour picker and tile setter affect a tile, the setter will modify the tile after the picker reads it.

  • Name: An optional name for the picker, which allows Tilesetters to reference it, as well as allowing the result to be exported to instance fixups.
  • Faces: The colour on the specified faces will be overriden to what is detected by the picker.
  • Priority : Multiple colour pickers can be applied to the same face, to allow it to fall back to different positions if a tile is not present in a location. In this situation this allows picking which picker result will "win".
  • Use Tile Pattern: Instead of just picking the colour on a tile, this causes the face to be set to the exact texture which would be generated. This only works correctly on faces pointing upward, and cut on the 32-unit grid, but allows shifting the entire pattern upward.
  • White/Black Material: Instead of consulting the style, use this specific material instead. This allows for producing a specific result, including persisting the orientation/offset of the brush face. If these are specified, the brush does not need to use a retexturable material.
  • Remove Tile: As a convenience, this allows causing the tile to be set to nodraw or removed after the picker has read the value. It is equivalent to placing a tilesetter in the same location.

Tilesetters (bee2_template_tilesetter)

Tilesetters are used to modify the tiles making up the geometry of the chamber. This allows forcing tiles to be 4x4 underneath brushwork, nodraw where they are covered, or entirely remove them if custom geometry is desired. Simply place them down, aligned to fit on the 32-grid.

  • Tile Type: The tile type to use. This updates the visual model to assist identification.
  • Force Place: By default, tiles will only be applied if an existing tile is found at this location, and tile types like nodraw won't be overridden by white/black tiles. If Force Place is defined however, the tile will always be added, potentially creating it if required.
  • Color picker: If set, this must be the name of a colour picker which will be read to set the tile colour.
  • Color: This is used to alter which exact colour is used.
    • Use tile color The specified colour or picked colour is used regardless of other configuration. If
    • Match Var or Invert Var: A color override must be specified in TemplateBrush, and the colour from there is then modified in the specified way.
    • Copy type, not color: The existing colour of the tile is kept, and only the type is changed.
Clone this wiki locally