API ReferenceGE Extensionscareermodules
Career Permissions Module
Centralized permission system for career actions. Other modules hook into `onCheckPermission` to grant or restrict actions based on active gameplay state (e.g., missions, deliveries, tutorials).
Centralized permission system for career actions. Other modules hook into onCheckPermission to grant or restrict actions based on active gameplay state (e.g., missions, deliveries, tutorials).
Public API
| Function | Signature | Description |
|---|---|---|
M.getStatusForTag | (tags, additionalData) → table | Queries all extensions for permission on given tag(s); returns highest-priority restriction |
Permission Levels
Ordered by priority (higher overrides lower):
| Level | Priority | Meaning |
|---|---|---|
"allowed" | 0 | Normal behaviour, no restriction |
"warning" | 1 | Action allowed but shows a warning (may have gameplay consequences) |
"forbidden" | 2 | Action visible but disabled |
"hidden" | 3 | Action not shown at all |
Default Permission Tags
| Tag | Controls |
|---|---|
vehicleModification | Repairing, parts, tuning, painting |
vehicleSelling | Selling a vehicle |
vehicleStorage | Putting vehicles into storage |
vehicleRetrieval | Retrieving vehicles from storage |
vehicleShopping | Buying vehicles |
interactRefuel | Refueling POI |
interactMission | Starting missions |
interactDelivery | Starting delivery mode |
recoveryFlipUpright | Flip upright recovery |
recoveryTowToRoad | Tow to road recovery |
recoveryTowToGarage | Tow to garage recovery |
Return Format
{
allow = true, -- true only for "allowed" or "warning"
permission = "forbidden", -- the permission level string
label = "...", -- human-readable reason
type = "text",
penalty = nil, -- optional penalty info
}Hook Integration
Extensions respond to onCheckPermission(tags, permissions, additionalData) by inserting entries into the permissions table:
-- Example hook handler (not part of this extension):
local function onCheckPermission(tags, permissions, additionalData)
if tableContains(tags, "vehicleModification") and myCondition then
table.insert(permissions, {
permission = "forbidden",
label = "Cannot modify vehicle during active mission"
})
end
endUsage Example
local status = career_modules_permissions.getStatusForTag(
{"painting", "vehicleModification"},
{inventoryId = invId}
)
if not status.allow then
button.disabled = true
button.reason = status
endSee Also
- painting, partShopping, tuning - Consumers of permission checks