kyoJobCreator
Exports (API)
The API version is 1. Within a major version only additive changes are made; check GetApiVersion() if your integration depends on it.
- Mutating exports run the same validation as the panel. An export cannot create a job the panel would have refused.
- They run as the console, and the audit log records which resource called them.
- Returned tables are copies, never the live data.
Results
Exports that change something return a Result:
-- success
{ ok = true, data = ... }
-- failure
{ ok = false, error = { code = 'ERR_NOT_FOUND', field = 'name', detail = nil } }
| Error code | Meaning |
|---|
ERR_INVALID | A parameter is missing or wrong (field says which) |
ERR_NOT_FOUND | The job, location or player does not exist |
ERR_CONFLICT | Already exists, or would clash |
ERR_FORBIDDEN | Not allowed |
ERR_READ_ONLY | The job is linked; its definition belongs to the framework |
ERR_LIMIT_REACHED | A limit in config/server.lua was reached |
ERR_INSUFFICIENT_FUNDS | Not enough money in the account |
ERR_UNSUPPORTED | The framework or an adapter cannot do it |
ERR_DATABASE | The database refused the change |
ERR_NOT_LOADED, ERR_BUSY, ERR_RATE_LIMIT, ERR_TOO_FAR, ERR_NOT_CONFIGURED, ERR_INVENTORY_FULL | See the error name |
local res = exports.kyoJobCreator:AddSocietyMoney('mechanic', 5000, 'Paid by insurance')
if not res.ok then
print(res.error.code, res.error.field)
end
Server exports
Version
| Export | Returns |
|---|
GetApiVersion() | number |
Jobs (read)
| Export | Returns |
|---|
GetJobs() | Every job |
GetJob(name) | The job, or nil |
JobExists(name) | boolean |
GetJobGrades(name) | The job’s ranks ({} if it doesn’t exist) |
GetJobOwnership(name) | 'managed', 'linked', 'adopted' or nil |
Jobs (change)
| Export | Description |
|---|
CreateJob(spec) | Create a job. spec has the same shape the panel sends |
UpdateJob(name, patch) | Change some fields. Fields left out keep their value. Accepted: label, name, type, whitelisted, defaultDuty, offDutyPay, enabled |
DeleteJob(name, options) | Delete a job. With employees you must pass options.reassignTo (job name for them) or options.force = true |
DuplicateJob(name, newName, options) | Copy a job. options.withLocations copies its locations too |
ExportJobPreset(name) | Export the job as a preset document |
ImportJobPreset(document, options) | Import a preset. options.name renames it |
Locations
| Export | Description |
|---|
GetLocations(filter) | Every location. filter may have job, kind, enabled |
GetLocation(id) | One location, or nil |
CreateLocation(spec) | Create a location. Use spec.job (job name) or spec.jobId |
UpdateLocation(id, patch) | Change some fields; the rest are kept |
DeleteLocation(id) | Delete a location |
exports.kyoJobCreator:CreateLocation({
job = 'mechanic',
kind = 'stash',
label = 'Parts locker',
coords = vector3(-347.3, -133.4, 39.0),
radius = 1.5,
minGrade = 0,
})
Employees
| Export | Description |
|---|
GetPlayerJobs(source) | Every job the player may hold (multijob roster) |
HasJob(source, name, minGrade) | true if the player currently has that job, optionally at or above minGrade |
HasJobPermission(source, permission) | true if the player’s rank has a permission, e.g. 'boss.hire' |
IsOnDuty(source) | true if the player is on duty |
SetPlayerJob(source, name, grade) | Make one of the player’s jobs the active one |
HirePlayer(source, name, grade, actor) | Hire a player |
FirePlayer(identifier, name, actor) | Dismiss a player by identifier |
Company account
| Export | Description |
|---|
GetSocietyBalance(name) | Balance of the job’s account (0 if it doesn’t exist) |
AddSocietyMoney(name, amount, reason) | Pay money in. reason is required |
RemoveSocietyMoney(name, amount, reason) | Take money out. reason is required |
Framework and import
| Export | Description |
|---|
GetIntegrationReport() | What was resolved at boot for every adapter |
ListFrameworkJobs() | Jobs the framework has |
GetImportReport() | The Import screen’s comparison |
LinkJob(name, actor) | Link a framework job |
AdoptJob(name, actor) | Take over a job’s definition |
UnlinkJob(name, actor) | Unlink a job |
Client exports
| Export | Returns |
|---|
GetApiVersion() | number |
GetPlayerJob() | The player’s current job |
GetVisibleLocations(filter) | Locations this player can see |
GetLocation(id) | One location, or nil |
IsNearLocation(id) | true if the player is within the location’s radius |
GetInteractionProvider() | The interaction provider in use (a target resource or markers) |
if exports.kyoJobCreator:IsNearLocation(12) then
-- ...
end