Class default<DescriptionType, TypeType, EntityReferenceType>Abstract

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

Type Parameters

  • DescriptionType = unknown

  • TypeType extends number = number

  • EntityReferenceType extends Player | NPC = Player | NPC

Hierarchy

Implements

Constructors

Properties

Accessors

Methods

addDelay addMarkerIcon addMilestone addReferenceId addTag addTamedCreature animate animateAttack animateBumpTowards applyTravelingEffects asNot asType burn calculateDamageAmount calculateEquipmentStats calculateStats calculateVoyageInfo canCombatTides canInspect canSailAway canSailTo canSeeObject canSeePosition canSeeTile canSwapWith cancelResting causeStatus checkForGather checkForGatherFire checkForStill checkForTargetInRange checkForWell checkOnLoadMilestones checkUnder clearTileCache cloneItemIntoInventory computeLights connectVehicle createFire createItemInInventory createMessageManager createNoteManager createQuestManager createSkillManager damage damageByInteractingWith damageRandomEquipment disconnectVehicle discoverRecipe discoverRecipes discoverVulnOrResist ensureDelay equip extinguishTorchesIfSwimming faceDirection findPathToPort getActiveStatuses getApplicableStatuses getAsHuman getAttack getBarteringBonus getBurnDamage getCombatStrength getConsumeBonus getCraftingDifficulty getCurse getDamage getDamageModifier getData getDefense getDescription getDiscoveredVulnsAndResists getEquipEffect getEquipSlotForItem getEquippedItem getEquippedItems getEquippedUseBenefits getGameOptions getGameOptionsBeforeModifiers getInsulation getJumpTile getMaxHealth getMaxWeight getMoveType getMovementDelay getMovementIntent getMovementPoint getMovementProgress getName getProducedTemperature getQualityBonus getRangedAccuracy getRangedSkillBonus getScaledWeight getSimplifiedCumulativeAttack getSimplifiedCumulativeDefense getSkillBonus getStaminaDelay getStatus getStatusLevel getStatuses getVehicle getWanderChance? getWanderHomePoint? getWanderHomeRadius? getWanderIdleChance? getWanderNewDirectionChance? getWeightOrStaminaMovementPenalty getWeightStatus giveRune hasData hasDelay hasDiscoveredVulnOrResist hasStatus hasTag healthSyncCheck hurtHands incrementIslandTickCount initializeStatuses isContainer isCorpse isCreature isDoodad isDualWielding isEntity isHuman isItem isNPC isNearby isOffHandDisabled isPlayer isTile isTileEvent isVehicleAllowedOnTile kill loadOnIsland loadUi moveTo moveToIsland moveToIslandId moveToIslandPosition moveTowardsIsland notifyItem notifyStat onDie onMoveComplete onMovementCompleted onNoInput onPostMove onSetStatChangeTimer onSkillGain onStaminaUseChanged onStatChange onStatusChanged overrideNextMovement passTurn processInput queueSoundEffect queueSoundEffectInFront rangeAction refreshStatuses removeData removeMarkerIcon removeTag removeTamedCreature resetChangeTimers resetDefense resetMovementIntent resetStatTimers setCachedTile setData setFromPosition setHumansWithinBound setMoveType setMoving setName setOptions setPosition setStatChangeTimerIgnoreDifficultyOptions setStatus setTamedCreatureEnemy setVehicle setZ skipNextMovement skipNextUpdate sootheChecks staminaReduction staminaSyncCheck startResting startSlipping statGain stopSlipping tick tickStatuses toString unequip unequipAll updateDirection updateMovementIntent updateRender updateSlipping updateStatsAndAttributes updateStrength updateSwimming updateTablesAndWeight updateTileWhenMoving updateVehicle updateView updateWalkTo updateWeight updateWorldTile waitForWalkTo walkToEntity walkToTile getNameTranslation

Constructors

  • Type Parameters

    • DescriptionType = unknown

    • TypeType extends number = number

    • EntityReferenceType extends NPC | Player = NPC | Player

    Parameters

    Returns default<DescriptionType, TypeType, EntityReferenceType>

Properties

_description?: DescriptionType
activeTurns: number = ...
allowSmartMovementClientside?: boolean

Used for smart vehicle movement (minecarts) Note: This is clientside only.

anim: number = 0
attackAnimationData?: IAttackAnimationData

Used for attack animations. Note: This is clientside only.

cachedMovementPenalty?: number
connectedVehicleId?: number
containedItems: default[] = []
containerType?: ContainerType
crafted: SaferNumberIndexedObject<ICrafted> = {}
cumulativeEvilCrafting: number = 0
customization: ICustomizations
deathBy: ISerializedTranslation = ...
defenses: number[] = []
direction: default = Vector2.ZERO

undefined = Vector2.ZERO for this

entityType: EntityType
equipEffects: Map<EquipEffect, EquipEffects> = ...
equippedOffHandDisabled?: default
equippedReferences: Map<EquipType, default> = ...
event: IEventEmitter<default<DescriptionType, TypeType, EntityReferenceType>, IHumanEvents>
facingDirection: East | North | West | South = Direction.South

undefined = Direction.None for this

flyingDelay?: number
fromX: number = 0

Note: This might not be a whole number.

fromY: number = 0

Note: This might not be a whole number.

gameOptionsCached?: IGameOptionsPlayer
handEquippedToLast: MainHand | OffHand = EquipType.OffHand
highestAttack?: number
highestDefense?: number
historicalActions?: PartialRecord<ActionType, number>
id: number
identifier: string
inventory: IContainer = ...

Deprecated

(use the entity itself)

invocations?: PartialRecord<ItemType, number>
isConnecting: boolean = false
isMoving?: boolean

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

isMovingSuppressVehicleClientside: boolean = false

Flag that will prevent a humans vehicle from showing up until the movement finishews

islandId: `${number},${number}`
lastAttackedByReference?: Reference
lastGainedStat?: Stat
lastReceivedRune?: Deity
manualTickActionDelay?: number
messages: IMessageManager
milestonesCollection: any = ...
moveType?: MoveType
movementCompleteZ?: number

Only used for Human entities

movementIntent: IMovementIntent = {}
movingData: IMovingData = {}

Used for movement animations. Note: This is clientside only.

nextMoveDirection?: None | East | North | West | South
nextMoveTime: number = 0
options: ImmutableObject<IOptions> = ...
persistentMarker: undefined | {
    guid: string;
    type: Tamed;
}

Notifier marker assigned to this entity

preventRendering?: boolean
realTimeTickActionDelay: number = 0
referenceId?: number

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

renamed?: string | ISerializedTranslation
respawnPoint: undefined | IVector4
restData: undefined | IRestData
score: number = 0
shouldSkipNextMovement?: true
shouldSkipNextUpdate?: true
skill: default
slipping?: ISlippingData
sortDirection?: SortDirection

When not provided, uses SortDirection.Ascending

stat: default<default<DescriptionType, TypeType, EntityReferenceType>> = ...
state: PlayerState = PlayerState.None
stats: IStats
status: IStatus
swimming: boolean = false
tamedCreatures: Map<`${number},${number}`, Set<number>> = ...
ticksSpent: Map<`${number},${number}`, number> = ...
tileUpdateType: TileUpdateType
turns: number = 1
type: TypeType
vehicleItemReference: undefined | default
walkSoundCounter: number = 4
walkToInProgress?: IWalkToPathInProgress
x: number
y: number
z: WorldZ

Accessors

  • get asContainer(): this & IUncastableContainer
  • Returns this & IUncastableContainer

  • get asCorpse(): undefined
  • Returns undefined

  • get asCreature(): undefined
  • Returns undefined

  • get asDoodad(): undefined
  • Returns undefined

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

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

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

  • get asHuman(): this
  • Returns this

  • get asItem(): undefined
  • Returns undefined

  • get asLoaded(): undefined | this
  • undefined if this entity's island is not loaded, this if it is

    Returns undefined | this

  • get asLocalPlayer(): undefined | default
  • Returns undefined | default

  • get asNPC(): undefined | default
  • Returns undefined | default

  • get asNotLocalPlayer(): undefined | this
  • Returns undefined | this

  • get asPlayer(): undefined | default
  • Returns undefined | default

  • get asTile(): undefined
  • Returns undefined

  • get asTileEvent(): undefined
  • Returns undefined

  • get connectedVehicle(): undefined | default
  • Returns undefined | default

  • get days(): number
  • Returns number

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

    Returns undefined | Readonly<DescriptionType>

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

    Returns default

  • get fromTile(): undefined | default
  • Tile the entity is moving from

    Returns undefined | default

  • get humansVisible(): default<unknown, number, NPC | Player>[]
  • Returns humans within this entities fov & that they can see

    Returns default<unknown, number, NPC | Player>[]

  • get isDead(): boolean
  • Returns boolean

  • get isFlying(): boolean
  • Returns boolean

  • get isGhost(): boolean
  • Returns boolean

  • get isHost(): boolean
  • Returns

    True if this player is the host of the multiplayer game or if there is no multiplayer game active

    Returns boolean

  • get isLoaded(): boolean
  • Whether this entity's island is loaded

    Returns boolean

  • get isLocalPlayer(): boolean
  • Returns boolean

  • get isOnFire(): FireType
  • Returns FireType

  • get isResting(): boolean
  • Returns boolean

  • get isRestingCancelled(): boolean
  • Returns boolean

  • get isServer(): boolean
  • Returns

    True if this is the special dedicated server player

    Returns boolean

  • get isSwimming(): boolean
  • Gets if the human is swimming (and not on a boat)

    Returns boolean

  • get isValid(): boolean
  • Returns boolean

  • get isWalkingTo(): boolean
  • Returns boolean

  • get isWithinHumanBounds(): boolean
  • Checks if the entity is within the viewport bounds of one or more humans

    Returns boolean

  • get island(): default
  • Returns default

  • get lastAttackedByEntityHuman(): undefined | default<unknown, number, NPC | Player>
  • Gets the last attacked entity as a human (from combat, creature owners, doodad builders, firestarters).

    Returns undefined | default<unknown, number, NPC | Player>

  • get luck(): number
  • Luck is a multiplier applied to some random chance calculations.

    Returns number

  • get maelstromLevel(): number
  • Returns number

  • 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<EntityReferenceType>
  • Returns undefined | Reference<EntityReferenceType>

  • get slippingData(): undefined | ISlippingData
  • Returns undefined | ISlippingData

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

    Returns default

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

Methods

  • Parameters

    • delay: number
    • Optional replace: boolean
    • Optional addStaminaDelay: boolean
    • cap: number = Infinity

    Returns void

  • Parameters

    Returns void

  • Parameters

    • milestone: Milestone
    • Optional data: string | number
    • Optional update: boolean

    Returns void

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

    Returns void

  • Parameters

    • tag: unknown

    Returns void

  • Parameters

    Returns void

  • Animates the entity between a specific set of positions

    Parameters

    • fromX: number
    • fromY: number
    • toX: number
    • toY: number
    • delay: Delay

    Returns void

  • Parameters

    Returns void

  • Faces the target and animates a bump into effect

    Parameters

    Returns void

  • Applies traveling effects to the player

    • Loses stamina, hunger, and thirst
    • Damages spyglass, golden sextant, and boat if it's being used
    • Decays items in the player's inventory

    Parameters

    Returns void

  • Parameters

    • type: TypeType

    Returns undefined | default<DescriptionType, TypeType, EntityReferenceType>

  • Burn the player/NPC

    Parameters

    • fireType: FireType
    • skipMessage: boolean = false
    • Optional skipParry: boolean
    • Optional equipType: EquipType
    • Optional fromCombat: boolean
    • level: number = 1
    • Optional thing: default | default

    Returns undefined | number

  • Returns void

  • Returns void

  • Parameters

    • Optional destination: default
    • Optional distanceFromEdge: number

    Returns IVoyageInfo

  • Parameters

    • x: number
    • y: number

    Returns boolean

  • Parameters

    • type: CanASeeBType
    • islandId: `${number},${number}`
    • x: number
    • y: number
    • z: number
    • Optional fieldOfView: FieldOfView
    • Optional customRadius: number

    Returns boolean

  • Returns undefined | default

  • Returns undefined | default

  • Check if there is a still in front of the player.

    Parameters

    • Optional withWater: boolean

      Check if the still has water in it?

    • Optional isLit: boolean

      Check if the still is lit?

    Returns boolean

  • Parameters

    • towardsTile: undefined | default
    • range: number
    • accuracy: undefined | number
    • Optional includePlayers: boolean

    Returns IMobCheck

  • Parameters

    • towardsTile: undefined | default
    • range: number
    • accuracy: undefined | number
    • includePlayers: undefined | boolean
    • clientSide: true

    Returns IMobCheck[]

  • Returns boolean

  • Returns void

  • Returns void

  • Recompute lights around the human

    Returns void

  • Parameters

    Returns void

  • Creates a fire at a given tile and assigns the player as its creator.

    Parameters

    Returns undefined | default

  • Returns default

  • Parameters

    Returns undefined | number

  • Returns void

  • Parameters

    • animate: boolean = true

    Returns void

  • Parameters

    • recipeType: ItemType
    • crafted: ICrafted = ...
    • Optional discoveredClientSide: boolean
    • emit: boolean = true

    Returns void

  • Parameters

    • recipes: [recipeType: ItemType, crafted: ICrafted][]
    • Optional discoveredClientSide: boolean

    Returns void

  • Parameters

    • delay: number

    Returns void

  • Parameters

    • item: default
    • slot: EquipType
    • internal: boolean = false
    • skipRevertItem: boolean = false

    Returns boolean

  • Extinguishes all torches the player is holding of they are swimming.

    Returns void

  • Parameters

    • portId: number
    • Optional options: Partial<{
          requireBoat: boolean;
          startReversed: boolean;
      }>

    Returns undefined | default[]

  • Returns the bartering bonus for a given credit value

    Parameters

    • baseCredits: number

    Returns number

  • Parameters

    Returns number

  • Returns number

  • Parameters

    Returns number

  • Parameters

    Returns number

  • Returns number

  • Returns number

  • Gets a data

    Returns

    Data value or undefined if it wasn't found

    Type Parameters

    • T

    Parameters

    • key: string

      Data key

    Returns undefined | T

  • Returns default

  • Called when filling out the entities description for the first time

    Returns undefined | DescriptionType

  • Parameters

    • item: default
    • Optional includeDisabled: true

    Returns undefined | EquipType

  • Parameters

    • slot: EquipType
    • Optional includeDisabled: true

    Returns undefined | default

  • Parameters

    • Optional includeDisabled: true

    Returns default[]

  • Gets the use benefits for all equipped items.

    Returns

    number that is the bonus amount the player recieves when consuming.

    Parameters

    • stat: Stat

      to check use benefits for.

    Returns undefined | {
        amount: number;
        items: default[];
    }

  • Gets the insulation of this object.

    Insulation is a decimal number from 0 to 1.

    • An insulation of 0 means that the temperature inside this object is equivalent to the temperature outside.
    • An insulation of 1 means that no temperature inside this object is emitted to the outside tiles — it is a completely separate temperature "biome".
    • Values in between change how much of the temperatures are produced/used on either side.

    Parameters

    Returns number

  • Returns undefined | default

  • Gets the max health of the player.

    Returns the result of the "getMaxHealth" event, or the max in Stat.Health, if the result of the hook is undefined.

    Parameters

    • withBonus: boolean = true

    Returns number

  • Gets the strength of the player.

    Returns the result of Hook.GetPlayerStrength, or the max in Stat.Health, if the result of the hook is undefined.

    Used internally for Stat.Weight.max

    Returns number

  • Returns number

  • Note: This is usually only ran on the server

    Returns IMovementIntent

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

    Parameters

    • timeStamp: number

    Returns 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

  • Parameters

    Returns number

  • Parameters

    Returns number

  • Gets this human's current carried weight, scaled down to what it would be without any weight bonuses applied

    Returns number

  • Returns number

  • Returns number

  • Parameters

    Returns number

  • Gets a stamina penalty delay to be used for slowed actions and movement.

    Parameters

    • staminaToStartAddingDelayAt: number = STAMINA_LOW_PENALTY_START_VALUE

      Stat value where delays start getting added from.

    Returns number

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

    Type Parameters

    Parameters

    Returns undefined | S

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

    Parameters

    Returns number

  • Generator for status effects on the entity.

    Returns default[]

  • Parameters

    • defaultChance: number

    Returns undefined | number

  • Returns undefined | number

  • Parameters

    • defaultChance: number

    Returns undefined | number

  • Parameters

    • defaultChance: number

    Returns undefined | number

  • Returns number

  • Returns

    whether the rune was given

    Parameters

    • deity: ArrayOr<DeityReal>

      The deity to potentially give a rune for

    • chance: number

      A chance multiplier on top of the base rune chance of 10% (an additional 30% chance may be added by theurgy)

    • domain: `event:${number}` | `craft:${number}` | `action:${number}` | `skill:${number}` | `killcreature:${number}` | `tamecreature:${number}` | `killnpc:${number}`
    • context: default

    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 boolean

  • Returns whether the entity has the given StatusType

    Parameters

    Returns number

  • Parameters

    • tag: unknown

    Returns boolean

  • Parameters

    • reason: string

    Returns void

  • Parameters

    Returns boolean

  • Returns void

  • Called when loading the human

    Returns void

  • Returns boolean

  • Returns boolean

  • Returns void

  • Loads the player onto an island Called when the game is initially loading and moving a player to another island

    Parameters

    Returns void

  • Loads ui. Should only be called if this player is local

    Returns void

  • Parameters

    Returns void

  • Moves this player to another island

    Parameters

    Returns Promise<void>

  • Returns void

  • Returns void

  • Note: The noInput event would be emitted before moveComplete. Ordering is done via EmitHumanEventPacket

    Returns void

  • Parameters

    Returns void

  • Parameters

    • skill: SkillType
    • fromValue: number
    • toValue: number
    • mod: number

    Returns void

  • Event handler for when resting begins, weight changes, or strength changes.

    Returns void

  • Event handler for EntityEvent.StatChanged. Handles special functionality when stats are increased:

    1. When resting & stamina is full, resting will be cancelled.
    2. Health is sync-checked.
    3. When hunger > maximum, damage will be dealt, stamina will be decreased, and a message will be displayed.
    4. When thirst > maximum, damage will be dealt, stamina will be decreased, and a message will be displayed.

    Parameters

    Returns void

  • Event handler for when a status effect is applied or removed.

    Parameters

    Returns void

  • Parameters

    Returns void

  • This is only ran on the server

    Parameters

    • timeStamp: number

    Returns undefined | IMovementIntent

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Returns void

  • Removes a data

    Returns

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

    Parameters

    • key: string

      Data key

    Returns boolean

  • Returns void

  • Parameters

    • tag: unknown

    Returns void

  • Parameters

    Returns boolean

  • Returns void

  • Parameters

    • Optional skipStatChangedEvent: boolean

    Returns void

  • Returns void

  • Sets a data

    Rturns

    The value

    Type Parameters

    • T

    Parameters

    • key: string

      Data key

    • value: T

      Data value

    Returns T

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    Returns void

  • Immediately move the entity to the tile

    Parameters

    Returns void

  • Parameters

    • stat: IStat | Stat
    • timer: number
    • Optional amt: number

    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: StatusChangeReason

      The reason for the change

    • Optional force: boolean

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

    Returns boolean

  • Parameters

    • item: undefined | default
    • Optional extinguishTorches: boolean

    Returns boolean

  • Parameters

    • z: number
    • allowCancelation: boolean = true
    • updateFlowField: boolean = true

    Returns boolean

  • Skips the next movement for this creature / npc

    Returns void

  • Skips the next update for this creature / npc

    Returns void

  • Returns void

  • Parameters

    • Optional skill: SkillType
    • Optional level: number

    Returns void

  • Parameters

    • reason: string

    Returns void

  • Parameters

    Returns void

  • Returns void

  • Ticks a player

    Returns

    True if the game should tick after this

    Parameters

    • Optional isPassTurn: boolean
    • Optional turnType: TurnTypeFlag

    Returns boolean

  • Updates caused by status effects such as bleeding, poison, and burns.

    Returns void

  • Returns string

  • Unequips an item. Note: This is safe to call even if the item isn't equipped. it'll do nothing in that case.

    Parameters

    • item: default
    • internal: boolean = false
    • skipMessage: boolean = false
    • skipRevertItem: boolean = false
    • isArmorStandSwap: boolean = false

    Returns boolean

  • Unequip all equipment

    Parameters

    • displayMessage: boolean = true
    • isArmorStandSwap: boolean = false

    Returns IEquip[]

  • Parameters

    Returns boolean

  • Returns void

  • This needs to be called whenever the player's strength requires an update.

    Example usage includes:

    1. When max health changes. Max health is used in calculating the strength.
    2. If a mod is using the GetPlayerStrength hook and the calculation needs to be refreshed.

    Returns void

  • Returns void

  • Parameters

    • source: string

    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

  • Returns void

  • Parameters

    • source: string

    Returns void

  • Updates the world renderer & flow field state for the tile

    Parameters

    • tileUpdateType: TileUpdateType = ...
    • Optional updateNeighbors: boolean
    • Optional skipFlowFieldUpdate: boolean

    Returns void

  • Returns a promise that resolves once the walk finishes

    Returns Promise<void>

  • Parameters

    Returns Promise<boolean>

  • Returns default

Generated using TypeDoc