Entity class that includes stats/status system. Note: We're assuming something with stats is also movable!

Hierarchy

Implements

Constructors

Properties

Accessors

Methods

Constructors

Properties

_description?: ICreatureDescription
_movementTime?: {
    end: number;
    start: number;
}

Type declaration

  • end: number
  • start: number
aberrant?: true
ai: AiType
allowSmartMovementClientside?: boolean
anim: number = 0
attackAnimationTime?: IMovementTime
attackAnimationType?: DamageType
direction: default = Vector2.ZERO

undefined = Vector2.ZERO for this

enemy?: {
    attacks: number;
    attempts: number;
    breakAway?: boolean;
    id: number;
    type: EntityType;
}

Type declaration

  • attacks: number
  • attempts: number
  • Optional breakAway?: boolean
  • id: number
  • type: EntityType
facingDirection: East | North | West | South = Direction.South

undefined = Direction.None for this

fromX: number = 0

Note: This might not be a whole number.

fromY: number = 0

Note: This might not be a whole number.

hitchedTo?: number
id: number
isMoving?: boolean

Not guaranteed to be synced between the server and client for Human entities

islandId: `${number},${number}`
moveType?: MoveType
movementCompleteZ?: number

Only used for Human entities

movingClientside: MovingClientSide = MovingClientSide.NoInput

The state of what the client thinks is happening to this entity (regarding movement)

movingOptions?: IMoveToOptions
originalMoveType?: MoveType
owner?: {
    identifier: string;
    type: Player;
} | {
    id: number;
    type: NPC;
}
preventRendering?: boolean
referenceId?: number

Do not use this property directly, instead use `game.references.getReference()

renamed?: string | ISerializedTranslation
respawned?: number
shouldSkipNextMovement?: true
shouldSkipNextUpdate?: true
spawnAnimationTime: undefined | IMovementTime
stat: default<default> = ...
stats: IStats
status: IStatus
tameTime?: number
x: number
y: number

Accessors

  • get asCorpse(): undefined
  • Returns undefined

  • get asCreature(): default
  • Returns default

  • get asDoodad(): undefined
  • Returns undefined

  • get asEntity(): default<DescriptionType, TypeType, TagType, unknown>
  • Returns default<DescriptionType, TypeType, TagType, unknown>

  • get asEntityMovable(): default<DescriptionType, TypeType, TagType, unknown>
  • Returns default<DescriptionType, TypeType, TagType, unknown>

  • get asEntityWithStats(): default<DescriptionType, TypeType, TagType>
  • Returns default<DescriptionType, TypeType, TagType>

  • get asHuman(): undefined
  • Returns undefined

  • get asItem(): undefined
  • Returns undefined

  • get asLocalPlayer(): undefined
  • Returns undefined

  • get asNPC(): undefined
  • Returns undefined

  • get asPlayer(): undefined
  • Returns undefined

  • get asTileEvent(): undefined
  • Returns undefined

  • get description(): undefined | DescriptionType
  • Get the entities description

    Returns undefined | DescriptionType

  • get entityType(): Creature
  • Returns Creature

  • get facingTile(): default
  • Regular entities don't have a direction so this will be the same as getTile()

    Returns default

  • get isFlying(): boolean
  • Returns boolean

  • get island(): default
  • Returns default

  • get point(): IVector3
  • Location of the entity on the world. Parent classes will probably mark this as always defined

    Returns IVector3

  • get reference(): undefined | Reference
  • Returns undefined | Reference

  • get tile(): default
  • Tile the entity is on in the world. Parent classes will probably mark this as always defined

    Returns default

  • get tileUpdateType(): TileUpdateType
  • Returns TileUpdateType

  • get tilesAround(): undefined | default[]
  • Returns undefined | default[]

Methods

  • Adds a referenceId to the entity if it doesn't already have one

    Returns void

  • Parameters

    • tag: unknown

    Returns void

  • Parameters

    Returns void

  • Faces the target and animates a bump into effect

    Parameters

    Returns void

  • Returns void

  • Parameters

    Returns boolean

  • Parameters

    • type: CanASeeBType
    • islandId: `${number},${number}`
    • x: number
    • y: number
    • z: number
    • fieldOfView: undefined | default = renderer.fieldOfView
    • Optional customRadius: number

    Returns boolean

  • Check if this creature can swap with the player in the event that the player is moving into them

    Parameters

    • human: default<number>

      Human object

    • source: undefined | string

      Source string. Set to undefined if this is being called from the clientside

    Returns boolean

  • Check is a creature is allowed to attack the target (rules of engagement)

    Returns

    True if it can attack them

    Parameters

    • target: undefined | default | default<number>

      Target thing to attack

    Returns boolean

  • Checks that a creature can move to a certain tile and/or interact with doodads/tiles

    Returns

    0 if the creature can move, otherwise an error code

    Parameters

    • isClientside: boolean

      True if clientside. Don't do random stuff in this case

    • tile: default
    • moveType: MoveType
    • willMove: boolean

      Set to true if the object is about to move to this tile. This method will confirm if theres an existing npc/creature there and return false if so

    • Optional options: Partial<ICreatureCheckMoveOptions>

    Returns number

  • Parameters

    Returns boolean

  • Checks under the creature for getting burned, setting off traps, eating items off the ground, and more

    Returns

    Returns whether the creature can keep moving (in the case of creatures with >= 2 speed)

    Parameters

    • x: number = ...
    • y: number = ...
    • Optional skipParticles: boolean

    Returns boolean

  • Returns void

  • Parameters

    Returns undefined | number

  • Parameters

    • damageInfo: IDamageInfo
    • Optional creatureX: number
    • Optional creatureY: number
    • Optional creatureZ: number

    Returns undefined | number

  • Parameters

    Returns undefined | default[]

  • Returns undefined | AiType

  • Gets a data

    Returns

    Data value or undefined if it wasn't found

    Type Parameters

    • T

    Parameters

    • key: string

      Data key

    Returns undefined | T

  • Parameters

    Returns Defense

  • Gets the enemy the creature marked

    Returns

    Enemy

    Returns undefined | default | default<number>

  • Returns IHitch

  • Returns string

  • Returns number

  • Gets movement progress and moves the state machine forward when the movement is completed

    Parameters

    • timeStamp: number

    Returns number

  • Parameters

    • Optional article: Article

      Whether to include an article for the name of the creature. Uses the article rules on the language. Defaults to true.

    • Optional count: number

      The number of this creature that you're getting the name of. Defaults to 1.

      Examples:

      • creature.getName() // "an acid spitter demon"
      • creature.getName(false) // "acid spitter demon"
      • creature.getName(undefined, 3) // "acid spitter demons"

    Returns default

  • Returns undefined | default<number>

  • Gets the temperature produced by this object. Positive values are "heat", negative values are "cold". Refer to the values of the Temperature enum to see the possible range. If this method is not implemented, or it returns undefined, Temperature.Neutral is used.

    Returns undefined | number

  • Returns the handler for this status effect, whether or not this entity currently has the effect.

    Type Parameters

    Parameters

    Returns undefined | S

  • Generator for status effects on the entity.

    Returns default[]

  • Parameters

    Returns boolean

  • Check if a data was set

    Returns

    True if the data exists, false if it doesn't

    Parameters

    • key: string

      Data key

    Returns boolean

  • Returns whether the entity has the given StatusType

    Parameters

    Returns number

  • Parameters

    • tag: unknown

    Returns boolean

  • Returns void

  • Parameters

    Returns void

  • Initializes the creature's stats. Used in the constructor & save conversion.

    Parameters

    • hp: number
    • Optional maxhp: number

    Returns void

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Checks if the entity is within the viewport bounds of one or more humans

    Returns boolean

  • Parameters

    Returns void

  • Parameters

    Returns undefined | default

  • Returns void

  • Parameters

    Returns void

  • Parameters

    • enemy: undefined | default | default<number>
    • Optional bypass: boolean

    Returns boolean

  • Parameters

    • type: SfxType
    • delay: number = 0
    • speed: number = ...

    Returns void

  • Parameters

    • type: SfxType
    • Optional delay: number
    • Optional speed: number

    Returns void

  • Returns void

  • Parameters

    • Optional remainTamed: boolean

    Returns boolean

  • Removes a data

    Returns

    True when the data is removed. False if the key wasn't set

    Parameters

    • key: string

      Data key

    Returns boolean

  • Parameters

    • tag: unknown

    Returns void

  • Parameters

    • targetTile: default
    • Optional preventRendering: boolean

    Returns void

  • Sets a data

    Rturns

    The value

    Type Parameters

    • T

    Parameters

    • key: string

      Data key

    • value: T

      Data value

    Returns T

  • Parameters

    Returns void

  • Parameters

    • fromX: number = ...
    • fromY: number = ...

    Returns void

  • Parameters

    • fromX: number
    • fromY: number
    • Optional toZ: number
    • Optional options: IMoveToOptions

    Returns void

  • Sets whether the entity has the given StatusType. Emits EntityEvent.StatusChange.

    Parameters

    • status: StatusType

      The status to change

    • level: number | boolean

      Whether the entity will have the status.
      If given false/0, removes the status. If given true/1+, raises the status to the given level.

    • reason: StatusEffectChangeReason

      The reason for the change

    • force: boolean = false

      Forces the status to be set to the given value, even if the current effect is being lowered.

    Returns boolean

  • Skips the next movement for this creature / npc

    Returns void

  • Skips the next update for this creature / npc

    Returns void

  • Parameters

    • human: default<number>
    • bonus: number = 0

    Returns boolean

  • Returns the times a creature has been tamed.

    Returns

    number if the creature has been tamed and undefined if it has never been tamed.

    Returns undefined | number

  • Returns string

  • Returns void

  • Parameters

    Returns boolean

  • Faces the target tile

    Parameters

    Returns void

  • Updates the DoodadOverHidden tile flag if the creature is large. Large creatures should render over the doodad over layer, which means we should hide the doodad over layer for doodads on the creatures tile.

    Parameters

    • tile: default
    • shouldBeHidden: boolean

    Returns void

  • Parameters

    • hidden: boolean = false

    Returns void

  • Called when the entity is about to move to another tile. This should update relevant properties on the tile and return true

    Returns

    False to block the move

    Parameters

    • fromTile: default

      Tile the entity was on

    • toTile: default

      Tile the entity is moving onto

    Returns boolean

  • Parameters

    • value: any

    Returns value is default

Generated using TypeDoc