Skip to content
On this page

Athena.controllers.object

Functions

addToPlayer

Usage

Athena.controllers.object.addToPlayer(player, objectData): string

Add an object to the player that only they can see.

Returns a uid or generates one if not specified.

Example

ts
const uid = Athena.controllers.object.addToPlayer(somePlayer, {
     model: 'prop_pizza_oven_01',
     pos: { x: 0, y: 0, z: 0}
});

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
objectDataIObject

Returns

string

uid A unique string for object

Defined in

server/controllers/object.ts:168


append

Usage

Athena.controllers.object.append(objectData): string

Add an object to the global world.

These objects should not be used to construct interiors.

Create an MLO, or use something like CodeWalker to create large scale map changes.

Returns a uid or generates one if not specified.

Example

ts
const uid = Athena.controllers.object.append({
     model: 'prop_pizza_oven_01',
     pos: { x: 0, y: 0, z: 0}
});

Athena.controllers.object.append({
     uid: 'the-uid-you-specified',
     model: 'prop_pizza_oven_01',
     pos: { x: 0, y: 0, z: 0}
});

Parameters

NameType
objectDataIObject

Returns

string

uid A unique string for object

Defined in

server/controllers/object.ts:70


override

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"append"
callback(objectData: IObject) => string

Returns

any

Defined in

server/controllers/object.ts:250

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"remove"
callback(uid: string) => boolean

Returns

any

Defined in

server/controllers/object.ts:251

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"addToPlayer"
callback(player: Player, objectData: IObject) => string

Returns

any

Defined in

server/controllers/object.ts:252

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"removeFromPlayer"
callback(player: Player, uid: string) => any

Returns

any

Defined in

server/controllers/object.ts:253

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"updatePosition"
callback(uid: string, pos: IVector3, player?: Player) => boolean

Returns

any

Defined in

server/controllers/object.ts:254

Usage

Athena.controllers.object.override(functionName, callback): any

Used to override any object streamer functionality

Parameters

NameType
functionName"updateModel"
callback(uid: string, model: string, player: Player) => boolean

Returns

any

Defined in

server/controllers/object.ts:255


remove

Usage

Athena.controllers.object.remove(uid): boolean

Removes an object from the global world.

If the object was found and removed this will return true.

Example

ts
const result = Athena.controllers.object.remove(someUid);

Athena.controllers.object.remove('the-uid-you-specified');

Parameters

NameTypeDescription
uidstringA unique string

Returns

boolean

Defined in

server/controllers/object.ts:104


removeFromPlayer

Usage

Athena.controllers.object.removeFromPlayer(player, uid): any

Remove an object from the player that only they can see.

Example

ts
Athena.controllers.object.removeFromPlayer(somePlayer, someUid);

Parameters

NameTypeDescription
playerPlayerAn alt:V Player Entity
uidstringA unique string

Returns

any

Defined in

server/controllers/object.ts:139


updateModel

Usage

Athena.controllers.object.updateModel(uid, model, player?): boolean

Parameters

NameTypeDefault value
uidstringundefined
modelstringundefined
playerPlayerundefined

Returns

boolean

Defined in

server/controllers/object.ts:224


updatePosition

Usage

Athena.controllers.object.updatePosition(uid, pos, player?): boolean

Updates the position for an object.

NOT ALL OBJECTS CAN BE MOVED DYNAMICALLY.

Example

Non-Player Object

ts
Athena.controllers.object.updatePosition(someUid, { x: 0, y: 0, z: 0});

Player Object

ts
Athena.controllers.object.updatePosition(someUid, { x: 0, y: 0, z: 0}, somePlayer);

Parameters

NameTypeDefault valueDescription
uidstringundefinedA unique string
posIVector3undefinedA position in the world.
player?Playerundefined

Returns

boolean

Defined in

server/controllers/object.ts:204

Created by Stuyk | Est. 2020