Skip to content
On this page

Athena.systems.job.system.Job

server/systems/job/system.Job

Create a Job Instance

A job can be specified as a series of tasks to complete with specific criteria.

The complexity of a job is limited to your programming knowledge.

ie. Go to this location, interact with this thing, ensure you have this item, etc.

Example

ts
// Never recycle the same job instance
const someJob = new Job();

// Never recycle objectives between job instances
Athena.systems.job.objective.createAndAdd(someJob, {
    description: 'Go to a position.',
    pos: {
        x: 0,
        y: 0,
        z: 0 - 1, // Always subtract 1 from a player position
    },
    criteria: Athena.systems.job.objective.buildCriteria({
        NO_VEHICLE: true,
        NO_WEAPON: true,
    }),
    range: 3,
    type: Athena.systems.job.objective.getType('WAYPOINT'),
});

// Adding a player to this job instance starts it
someJob.addPlayer(somePlayer);

Constructors

constructor

new Job()

Creates an instance of a job handler.

Used to build a Job for usage.

This instance should be called each time to create new job instances.

Defined in

server/systems/job/system.ts:68

Properties

completedCallback

Private completedCallback: (job: Job) => Promise<void>

Type declaration

Usage

Athena.systems.job.system.Job.(job): Promise<void>

Parameters
NameType
jobJob
Returns

Promise<void>

Defined in

server/systems/job/system.ts:56


id

Private id: number

The ID of the player.

Defined in

server/systems/job/system.ts:51


objectives

Private objectives: Objective[] = []

Defined in

server/systems/job/system.ts:53


player

Private player: Player

Defined in

server/systems/job/system.ts:52


quitCallback

Private quitCallback: (job: Job, reason: string) => void

Type declaration

Usage

Athena.systems.job.system.Job.(job, reason): void

Parameters
NameType
jobJob
reasonstring
Returns

void

Defined in

server/systems/job/system.ts:57


startTime

Private startTime: number

Defined in

server/systems/job/system.ts:55


vehicles

Private vehicles: { uid: string ; vehicle: Vehicle }[] = []

Defined in

server/systems/job/system.ts:54

Methods

addNextObjective

Usage

Athena.systems.job.system.Job.addNextObjective(objectiveData): void

Inserts an objective to the beginning of the objectives array.

Parameters

NameType
objectiveDataObjective

Returns

void

Defined in

server/systems/job/system.ts:337


addObjective

Usage

Athena.systems.job.system.Job.addObjective(objectiveData): void

Add an objective to this job. Use the objective interface to generate the objective information.

Parameters

NameType
objectiveDataObjective

Returns

void

Defined in

server/systems/job/system.ts:92


addPlayer

Usage

Athena.systems.job.system.Job.addPlayer(player): void

Add the player to the job this job and start it.

Ensure that this Job is initialized with new Job first.

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity

Returns

void

Defined in

server/systems/job/system.ts:78


addVehicle

Usage

Athena.systems.job.system.Job.addVehicle(player, model, pos, rot, color1?, color2?): Vehicle

Create a unique vehicle for this job.

Objective eventually removes the job vehicle.

This unique job vehicle is temporarily assinged to the player.

Returns a vehicle with a 'uid'.

Parameters

NameType
playerPlayer
modelstring | number
posIVector3
rotIVector3
color1?RGBA
color2?RGBA

Returns

Vehicle

Defined in

server/systems/job/system.ts:108


getCurrentObjective

Usage

Athena.systems.job.system.Job.getCurrentObjective(): any

Get the current objective the player is completing.

Returns

any

Defined in

server/systems/job/system.ts:317


getElapsedMilliseconds

Usage

Athena.systems.job.system.Job.getElapsedMilliseconds(): number

Get the time since this job has started.

Returns

number

Defined in

server/systems/job/system.ts:327


getPlayer

Usage

Athena.systems.job.system.Job.getPlayer(): Player

Get the current player that is utilizing this job instance.

Returns

Player

Defined in

server/systems/job/system.ts:263


getVehicles

Usage

Athena.systems.job.system.Job.getVehicles(): { uid: string ; vehicle: Vehicle }[]

Return job instance vehicles

Memberof

Job

Returns

{ uid: string ; vehicle: Vehicle }[]

Defined in

server/systems/job/system.ts:174


goToNextObjective

Usage

Athena.systems.job.system.Job.Private goToNextObjective(): Promise<void>

Remove the first element of the objective list and move on to the next.

Returns

Promise<void>

Defined in

server/systems/job/system.ts:231


loadObjectives

Usage

Athena.systems.job.system.Job.loadObjectives(objectiveData): void

Appends a list of objectives into the Job Framework.

Parameters

NameType
objectiveDataObjective[]

Returns

void

Defined in

server/systems/job/system.ts:183


quit

Usage

Athena.systems.job.system.Job.quit(reason): void

Call this to cleanup a job.

Parameters

NameType
reasonstring

Returns

void

Defined in

server/systems/job/system.ts:208


removeAllVehicles

Usage

Athena.systems.job.system.Job.removeAllVehicles(): void

Remove all vehicles from this job.

Returns

void

Defined in

server/systems/job/system.ts:138


removeAttachable

Usage

Athena.systems.job.system.Job.removeAttachable(): void

Remove the current job attachable.

Returns

void

Defined in

server/systems/job/system.ts:272


removeVehicle

Usage

Athena.systems.job.system.Job.removeVehicle(uid): void

Remove a vehicle by unique identifier assigned when adding a vehicle.

Parameters

NameTypeDescription
uidstringA unique string

Returns

void

Defined in

server/systems/job/system.ts:153


setCompletedCallback

Usage

Athena.systems.job.system.Job.setCompletedCallback(callback): void

Set the async callback that is called when a user completed a job.

Parameters

NameType
callback() => Promise<void>

Returns

void

Defined in

server/systems/job/system.ts:349


setQuitCallback

Usage

Athena.systems.job.system.Job.setQuitCallback(callback): void

Set the callback that is called when a user quits a job.

Parameters

NameType
callback(job: Job, reason: string) => void

Returns

void

Defined in

server/systems/job/system.ts:359


syncObjective

Usage

Athena.systems.job.system.Job.Private syncObjective(): void

Emits data down to the player to start handling job information.

Returns

void

Defined in

server/systems/job/system.ts:290

Created by Stuyk | Est. 2020