Перейти к основному содержанию

EntityAI

A set of predefined entity AI types.

@deprecated

Index

Classes

Attack

Attack:

Attack AI type, entity causes damage to the target entity.

constructor

  • new Attack(customPrototype: EntityAIPrototype & { attack_damage?: number; attack_range?: number; attack_rate?: number; target?: number }): Attack
  • Creates attack entity AI type.


    Parameters

    • customPrototype: EntityAIPrototype & { attack_damage?: number; attack_range?: number; attack_rate?: number; target?: number }

      AI type prototype

    Returns Attack

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

Follow

Follow:

Follow AI type, entity follows it's target. Use another AI type to set target for this AI type.

constructor

  • new Follow(customPrototype: EntityAIPrototype & { denyY?: boolean; jumpVel?: number; rotateHead?: boolean; rotateRatio?: number; rotateSpeed?: number; speed?: number; target?: Vector; targetEntity?: number }): Follow
  • Creates follow entity AI type.


    Parameters

    • customPrototype: EntityAIPrototype & { denyY?: boolean; jumpVel?: number; rotateHead?: boolean; rotateRatio?: number; rotateSpeed?: number; speed?: number; target?: Vector; targetEntity?: number }

      AI type prototype

    Returns Follow

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

Idle

Idle:

Simple Idle AI type, entity just does nothing.

constructor

  • Creates Idle entity AI type.


    Parameters

    Returns Idle

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

Panic

Panic:

Panic AI type, entity just rushes around.

constructor

  • Creates panic entity AI type.


    Parameters

    Returns Panic

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

PanicWatcher

PanicWatcher:

Panic AI watcher type, controls entity panic behavior after getting hurt.

constructor

  • new PanicWatcher(customPrototype: EntityAIPrototype & { name?: string; panic_time?: number; priority_default?: number; priority_panic?: number }): PanicWatcher
  • Creates panic watcher entity AI type.


    Parameters

    • customPrototype: EntityAIPrototype & { name?: string; panic_time?: number; priority_default?: number; priority_panic?: number }

      AI type prototype

    Returns PanicWatcher

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

Swim

Swim:

Swim AI type, if the entity is in water, it swims.

constructor

  • Creates swim entity AI type.


    Parameters

    Returns Swim

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void

Wander

Wander:

Wander AI type, entity walks around making pauses.

constructor

  • Creates wander entity AI type.


    Parameters

    Returns Wander

data

data: object

Object containing the state of the AI type.

optionalentity

entity?: number

Numeric unique entity idenifier that uses this AI type instance or null if it is the pattern.

isInstance

isInstance: boolean

If set to true, it is an instance of AI type, else the pattern (pattern should not be modified directly, AI controller calls instantiate to create instances of AI type).

params

params: object

All the parameters of the AI instance.

optionalparent

parent?: CustomEntity

Instantiated custom entity that uses this AI type instance or null if it is the pattern.

aiEntityChanged

  • aiEntityChanged(entity: number): void
  • Occurs when entity this instance is assigned to this AI type instance, if you override this method, be sure to assign entity to EntityAIClass.EntityAIPrototype.


    Parameters

    • entity: number

    Returns void

changeSelfPriority

  • changeSelfPriority(priority: number): void
  • Changes own priority in parent's controller.


    Parameters

    • priority: number

    Returns void

disableAI

  • disableAI(name: string): void
  • Disables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be disabled

    Returns void

enableAI

  • enableAI(name: string, priority: number, extra: any): void
  • Enables any AI by it's name in the controller.


    Parameters

    • name: string

      AI name to be enables

    • priority: number

      priority to be set to the enabled AI

    • extra: any

      some extra data passed to

    Returns void

finishExecution

  • finishExecution(): void
  • Finishes AI execution and disables it in parent controller.


    Returns void

getAI

  • Gets any AI object by it's name from the current controller.


    Parameters

    • name: string

      AI name

    Returns EntityAIClass

getPriority

  • getPriority(name: string): number
  • Gets any AI priority from the current controller by AI name.


    Parameters

    • name: string

      AI name

    Returns number

instantiate

  • Method that is called to create AI type instance using current instance as pattern.


    Parameters

    • parent: any
    • name: string

    Returns EntityAIClass

removeExecutionTimer

  • removeExecutionTimer(): void
  • Resets execution timer so that AI is executed with no time limits.


    Returns void

setExecutionTimer

  • setExecutionTimer(timer: number): void
  • Sets execution timer time in ticks. AI will be executed specified number of ticks.


    Parameters

    • timer: number

      execution time in ticks

    Returns void

setParams

  • setParams(params: object): void

  • Parameters

    • params: object

    Returns void

    AI type's default name.

setPriority

  • setPriority(name: string, priority: number): void
  • Sets any AI priority by it's name in the controller.


    Parameters

    • name: string

      AI name to change priority

    • priority: number

      priority to be set to the AI

    Returns void