MapInfo
MapInfo provides parameters of the current map and finds the gameplay zones at a world position.
Where the data comes from
Section titled “Where the data comes from”Properties are read from the loaded map definition. GetZones(position) checks the provided world point against game-zone volumes and returns the names of every matching zone. It does not move an object into a zone or subscribe to enter/exit events.
To track an agent, repeat the query with its current Movement.Position in an appropriate loop.
Quick example
Section titled “Quick example”local zones = MapInfo:GetZones(Cameras.Main.Position)
for index = 1, zones.Length do print(zones[index])endCameras.Main is client-only. In server.lua, pass a position obtained from a server-side API.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
BasementBottomY |
number |
get |
Lower Y boundary of the basement level. |
BasementTopY |
number |
get |
Upper Y boundary of the basement level. |
MapCameraHeight |
number |
get |
Minimap camera height. |
MapCenter |
Vector3 |
get |
Map center in world space. |
MapName |
string |
get |
Current map name. |
MapSize |
number |
get |
Map size used by its representation. |
All properties are getter-only.
Testing on Castle produced:
| Property | Value |
|---|---|
BasementBottomY |
-5 |
BasementTopY |
0 |
MapCameraHeight |
200 |
MapCenter |
(15, 0, 20) |
MapName |
Castle |
MapSize |
130 |
These values describe only the tested map and are not global constants.
GetZones
Section titled “GetZones”MapInfo:GetZones(position: Vector3): Array<string>Returns an Array<string> containing the names of every zone that includes the given world position.
A position can belong to multiple zones at once:
local zones = MapInfo:GetZones(Cameras.Main.Position)-- Example: BuyZoneCT, CSspawnWhen a position is not inside any zone, the method returns an empty array with Length == 0, not nil.
local zones = MapInfo:GetZones(Vector3.zero)
if zones.Length == 0 then print("No zone at this position")endContexts
Section titled “Contexts”MapInfo and GetZones() work on both the client and the Reflex server. Results for the same map and position matched in both contexts.