> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_building/functions.md).

# Functions

> **Note:**\
> This documentation lists all exported functions (`exports`) in the codebase.

## Client Side

* **getCurrentDoor()**
  * <sub>Returns the current door ID and its lock state for the player.</sub>
* **openEditorWithDefaultObject()**
  * <sub>Opens the building editor with a default object.</sub>
* **openEditorSpecialWithResources()**
  * <sub>Opens the building editor with a special objects.</sub>
* **openEditorSpecial(data)**
  * <sub>Opens the building editor with a special object (e.g., for special models).</sub>
  * <sub><mark style="color:red;">**Important:**<mark style="color:red;"></sub> <sub><mark style="color:red;">`data`<mark style="color:red;"></sub> <sub><mark style="color:red;">must contain the<mark style="color:red;"></sub> <sub><mark style="color:red;">`name`<mark style="color:red;"></sub> <sub><mark style="color:red;">of the item that is linked in the config to a special model.<mark style="color:red;"></sub>
* **startUpgrading()**
  * <sub>Starts the upgrade mode for structures.</sub>
* **checkDistToBuildTc()**
  * <sub>Checks if the player is far enough from other TCs to build a new one.</sub>
* **getTcsData()**
  * <sub>Returns all currently loaded TCs (tool cupboards) data.</sub>
* **getObjectInTc(id)**
  * <sub>Returns all objects within the radius of a given TC.</sub>
* **getClosestTc()**
  * <sub>Returns the closest TC ID and distance to the player.</sub>
* **getCurrentTcId()**
  * <sub>Returns the current TC ID the player is in.</sub>
* **checkAuth(id)**
  * <sub>Checks if the player is authorized in the given TC.</sub>
* **isEditorOpen()**
  * <sub>Returns whether the building editor is currently open.</sub>
* **isUpgrading()**
  * <sub>Returns whether the player is currently in upgrade mode.</sub>
* **setInBuildingZone(bool)**
  * <sub>Sets the inBuildingZone variable to the given boolean.</sub>
* **setInNoBuildingZone(bool)**
  * <sub>Sets the inNoBuildingZone variable to the given boolean.</sub>
* **addNoBuildingZone(coords, radius)**
  * <sub>Adds a no-building zone at the given coordinates with the specified radius.</sub>

***

## Server Side

* **getTcData(id)**
  * <sub>Returns upkeep and status data for a given TC (tool cupboard).</sub>
* **getTcAuthData(id)**
  * <sub>Returns the authorization data (authorized players) for a given TC.</sub>
* **findTcForObject(uid)**
  * <sub>Finds the TC that contains the given object and returns its data.</sub>
* **checkAuth(source, bid)**
  * <sub>Checks if the player (source) is authorized in the given TC.</sub>
* **getCurrentTcId(source)**
  * <sub>Returns the current TC ID for the given player.</sub>
* **setHealthObject(uid, hp)**
  * <sub>Sets the health of an object by its unique ID.</sub>
* **getObjects()**
  * <sub>Returns all currently loaded building objects.</sub>
* **isBaseBeingRaided(tcId)**
  * <sub>Returns whether a base (by TC ID) is currently in a raided state.</sub>
* **cleanupRaidState(tcId)**
  * <sub>Clears the raid state for the given TC, ending the raid.</sub>

***
