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

Adds the built-in 'Text Area' mode to the area tool.
Draws the texts of the text areas the local player has recently entered, fading each of them out before it expires.
Loads the saved areas from the plugin data storage.
Checks every player who has moved since the previous check against every area polygon.
Calls the AddAreaToolModes hook so that plugins can add their modes to the area tool.
Sends all stored areas to the player who has just initialized.
Draws 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.
Registers the 'areas' level design permission.
Saves all stored areas to the plugin data storage.

Hooks

Area:AddAreaToolModes(mode_list)

shared plugins/areas/plugin/sh_plugin.lua:103

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.

Area:LoadData()

server plugins/areas/plugin/sv_plugin.lua:11

Implements hook LoadData

Loads the saved areas from the plugin data storage.

Area:OneSecond()

server plugins/areas/plugin/sv_plugin.lua:25

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.

Area:OnSchemaLoaded()

shared plugins/areas/plugin/sh_plugin.lua:93

Implements hook OnSchemaLoaded

Calls the AddAreaToolModes hook so that plugins can add their modes to the area tool.

Area:PlayerInitialized(actor)

server plugins/areas/plugin/sv_plugin.lua:6

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:21

Draws 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

Area:RegisterPermissions()

shared plugins/areas/plugin/sh_plugin.lua:19

Implements hook RegisterPermissions

Registers the 'areas' level design permission.

Area:SaveData()

server plugins/areas/plugin/sv_plugin.lua:18

Implements hook SaveData

Saves all stored areas to the plugin data storage.

Defined in