API ReferenceGE Extensionscareermodules
Career Tether Module
Spatial boundary system that triggers callbacks when the player leaves defined areas. Supports box, sphere, capsule, and vehicle-tracking tether shapes. Used by part shopping, tuning, and other garage
Spatial boundary system that triggers callbacks when the player leaves defined areas. Supports box, sphere, capsule, and vehicle-tracking tether shapes. Used by part shopping, tuning, and other garage interactions to cancel sessions when the player walks away.
Public API
| Function | Signature | Description |
|---|---|---|
M.startBoxTether | (p1, x1, y1, z1, callback, data) → tether | Creates an OBB tether centered at p1 with axis half-extents |
M.startSphereTether | (p1, r1, callback, data) → tether | Creates a sphere tether at p1 with radius r1 |
M.startDoorTether | (door, bufferLength, callback, data) → tether | Creates a box tether from a scene door object + buffer |
M.startCapsuleTetherBetweenStatics | (p1, r1, p2, r2, callback, data) → tether | Capsule between two static points with independent radii |
M.startCapsuleTetherBetweenStaticAndVehicle | (p1, r1, vehId, r2, callback, data) → tether | Capsule from static point to a vehicle (dynamic p2) |
M.startVehicleTether | (vehId, radius, inverse, callback) → tether | Sphere around a vehicle; inverse=true triggers on approach |
M.addTether | (t) | Manually registers a custom tether object |
M.removeTether | (t) | Removes a tether from the active list |
M.drawAxisBox | (corner, x, y, z, clr) | Debug visualization: draws a solid axis-aligned box |
Tether Object Structure
tether = {
checkfun = checkSphereTether, -- function(t) → bool (true = broken)
p1 = vec3(...), -- primary position
r1 = 10, -- primary radius
p2 = vec3(...), -- secondary position (capsule)
r2 = 5, -- secondary radius (capsule)
vehId = 123, -- vehicle ID (vehicle tethers)
inverse = false, -- trigger on enter instead of exit
callback = function(t) end, -- called when tether breaks
data = {}, -- user data
remove = false, -- set true to remove next frame
}Shape Types
| Shape | Break Condition |
|---|---|
| Box | Player outside OBB defined by center + 3 axis vectors |
| Sphere | Player distance > radius from center |
| Capsule | Player distance > interpolated radius along line segment |
| Vehicle | Player distance > radius from vehicle (or < if inverse) |
Update Behavior
onUpdateis dynamically hooked/unhooked viaextensions.hookUpdate- only runs when tethers exist- Broken tethers are cleaned up from the back of the list each frame
- Set
tether.remove = trueto manually remove without triggering callback
Usage Example
-- Create a capsule tether for part shopping
local tether = career_modules_tether.startCapsuleTetherBetweenStatics(
computerPos, 10, -- computer end, 10m radius
vehiclePos, 8, -- vehicle end, 8m radius
function(t) career_modules_partShopping.cancelShopping() end
)
-- Remove tether when done
tether.remove = trueDebug Mode
Set drawDebug = true in source to visualize all tethers with spheres, lines, and distance labels.
See Also
- partShopping - Uses capsule tether for shopping boundary
- tuning - Uses capsule tether for tuning boundary
Additional Exports
Values/Properties
| Export | Description |
|---|---|
M.onUpdate | Value: nil |
M.onUpdate | Value: onUpdate |
M.onUpdate | Value: nop |