CreateAiNavigationBlocker: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document G1R:MP 0.1.2 navigation collision API
 
Document expanded scripting capacities and complete audited limits for 0.1.3 BUILD81
 
Line 37: Line 37:
* All coordinates and dimensions use metres. A box uses centre <code>x/y/z</code>, <code>width</code>, <code>depth</code>, <code>height</code>, and optional yaw in degrees. A cylinder uses centre <code>x/y/z</code>, <code>radius</code>, and <code>height</code>. Each dimension must be 0.01-10000 metres.
* All coordinates and dimensions use metres. A box uses centre <code>x/y/z</code>, <code>width</code>, <code>depth</code>, <code>height</code>, and optional yaw in degrees. A cylinder uses centre <code>x/y/z</code>, <code>radius</code>, and <code>height</code>. Each dimension must be 0.01-10000 metres.
* A polygon uses <code>points = {{x=...,y=...}, ...}</code> with 3-16 vertices plus <code>minZ</code> and <code>maxZ</code>. It must be finite, simple and convex; clockwise input is normalized. Coordinates are limited to +/-100000 metres.
* A polygon uses <code>points = {{x=...,y=...}, ...}</code> with 3-16 vertices plus <code>minZ</code> and <code>maxZ</code>. It must be finite, simple and convex; clockwise input is normalized. Coordinates are limited to +/-100000 metres.
* Optional <code>enabled</code> defaults to true. The server permits at most 1024 blockers per resource and 4096 total, and also bounds spatial-index growth.
* Optional <code>enabled</code> defaults to true. The server permits at most 4096 blockers per resource and 16384 total, and also bounds spatial-index growth.
* The blocker is visible to every AI entity whose collision mode includes the custom layer, not only entities owned by the creating resource. Only the creating resource may inspect, update, enable, disable or destroy it.
* The blocker is visible to every AI entity whose collision mode includes the custom layer, not only entities owned by the creating resource. Only the creating resource may inspect, update, enable, disable or destroy it.
* Stopping or restarting the owning resource removes all of its blockers automatically. Dynamic player, NPC and monster capsule collision is separate and always remains active.
* Stopping or restarting the owning resource removes all of its blockers automatically. Dynamic player, NPC and monster capsule collision is separate and always remains active.
* Use custom blockers for static geometry and occasional changes such as opening or closing a gate. Moving or toggling blockers every server tick is unsupported; moving characters already use the mandatory dynamic capsule layer.
* Use custom blockers for static geometry and occasional changes such as opening or closing a gate. Moving or toggling blockers every server tick is unsupported; moving characters already use the mandatory dynamic capsule layer.
* Expanded limits apply from update 0.1.3 BUILD81. See [[Scripting limits]]; earlier 0.1.3 binaries retain their old limits.


[[Category:Lua Functions]]
[[Category:Lua Functions]]

Latest revision as of 11:51, 12 September 2026

createAiNavigationBlocker

AVAILABLE FROM UPDATE 0.1.2
This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.

Creates a resource-owned static navigation blocker used by server-simulated NPCs and monsters.

Syntax

string|false createAiNavigationBlocker(table definition)

Parameters

Name Type Required Description
definition table yes A validated box, cylinder, or convex polygon definition in metres.

Returns

Returns a new opaque decimal blocker ID string, or false when the definition is invalid or a bounded resource/server limit is reached.

Examples

Block a rotated doorway volume:

local blockerId = createAiNavigationBlocker({
    shape = "box",
    x = 125.0, y = -48.0, z = 2.0,
    width = 2.5, depth = 0.8, height = 4.0,
    yaw = 30,
})

Notes

  • Available only in server-side resource scripts.
  • All coordinates and dimensions use metres. A box uses centre x/y/z, width, depth, height, and optional yaw in degrees. A cylinder uses centre x/y/z, radius, and height. Each dimension must be 0.01-10000 metres.
  • A polygon uses points = {{x=...,y=...}, ...} with 3-16 vertices plus minZ and maxZ. It must be finite, simple and convex; clockwise input is normalized. Coordinates are limited to +/-100000 metres.
  • Optional enabled defaults to true. The server permits at most 4096 blockers per resource and 16384 total, and also bounds spatial-index growth.
  • The blocker is visible to every AI entity whose collision mode includes the custom layer, not only entities owned by the creating resource. Only the creating resource may inspect, update, enable, disable or destroy it.
  • Stopping or restarting the owning resource removes all of its blockers automatically. Dynamic player, NPC and monster capsule collision is separate and always remains active.
  • Use custom blockers for static geometry and occasional changes such as opening or closing a gate. Moving or toggling blockers every server tick is unsupported; moving characters already use the mandatory dynamic capsule layer.
  • Expanded limits apply from update 0.1.3 BUILD81. See Scripting limits; earlier 0.1.3 binaries retain their old limits.