Athena.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 ​
// 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 ​
Name | Type |
---|---|
job | Job |
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 ​
Name | Type |
---|---|
job | Job |
reason | string |
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 ​
Name | Type |
---|---|
objectiveData | Objective |
Returns ​
void
Defined in ​
server/systems/job/system.ts:333
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 ​
Name | Type |
---|---|
objectiveData | Objective |
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 ​
Name | Type | Description |
---|---|---|
player | Player | An 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 ​
Name | Type |
---|---|
player | Player |
model | string | number |
pos | IVector3 |
rot | IVector3 |
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:313
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:323
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 ​
Name | Type |
---|---|
objectiveData | Objective [] |
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 ​
Name | Type |
---|---|
reason | string |
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 ​
Name | Type | Description |
---|---|---|
uid | string | A 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 ​
Name | Type |
---|---|
callback | () => Promise <void > |
Returns ​
void
Defined in ​
server/systems/job/system.ts:345
setQuitCallback ​
Usage
Athena.systems.job.system.Job.setQuitCallback(callback
): void
Set the callback that is called when a user quits a job.
Parameters ​
Name | Type |
---|---|
callback | (job : Job , reason : string ) => void |
Returns ​
void
Defined in ​
server/systems/job/system.ts:355
syncObjective ​
Usage
Athena.systems.job.system.Job.Private
syncObjective(): void
Emits data down to the player to start handling job information.
Returns ​
void