Areas API lets staff mark out areas of the map and lets plugins react when players enter
or leave them.
An area is a set of polygons with a height and a type; the Areas library creates areas
and registers area types. Every second the server checks which areas each player is in,
and runs the callback of an area's type on the server and on the player's client when
the player enters or leaves it. Staff draw areas with the Area Tool, whose modes each
create one type of area; plugins add modes from the AddAreaToolModes hook. The plugin
comes with the area type, which runs the PlayerEnteredArea and PlayerLeftArea
hooks, and with the textarea type and its tool mode, which shows the area's text on
the HUD of a player who enters it.
Summary
Hooks
Hooks
Implements hook AddAreaToolModes
Adds the built-in 'Text Area' mode to the area tool.
Parameters
- mode_list Map the Area.tool_modes table; modes are added with mode_list:Add
Draws the texts of the text areas the local player has recently entered, fading each of them out before it expires.
Implements hook LoadData
Loads the saved areas from the plugin data storage.
Implements hook OneSecond
Checks every player who has moved since the previous check against every area polygon. Runs the area type's callback and notifies the player's client whenever a player enters or leaves an area.
Implements hook OnSchemaLoaded
Calls the AddAreaToolModes hook so that plugins can add their modes to the area tool.
Implements hook PlayerInitialized
Sends all stored areas to the player who has just initialized.
Parameters
- actor Player
Area:PostDrawOpaqueRenderables(draw_depth, draw_skybox)
client plugins/areas/plugin/cl_plugin.lua:21Draws wireframes of the areas that belong to the selected mode of the area tool, and the outline of the area being created, while the local player holds that tool.
Parameters
- draw_depth Boolean whether the depth pass is being drawn
- draw_skybox Boolean whether the skybox is being drawn
Implements hook RegisterPermissions
Registers the 'areas' level design permission.
Implements hook SaveData
Saves all stored areas to the plugin data storage.