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

Hierarchy

Implements

Constructors

Properties

Accessors

Methods

addDelay addItemMilestones addMilestone addReferenceId addTag addTamedCreature animateAttack animateBumpTowards applyTravelingEffects burn calculateDamageAmount calculateEquipmentStats calculateStats calculateVoyageInfo canCombatTides canInspect canSailAway canSailTo canSeeObject canSeePosition canSeeTile canSwapWith cancelResting capReputation causeStatus changeId checkForGather checkForGatherFire checkForStill checkForTargetInRange checkForWell checkOnLoadMilestones checkSkillMilestones checkUnder clearTileCache createItemInInventory createMessageManager createNoteManager createQuestManager createSkillManager damage damageByInteractingWith damageRandomEquipment delete discoverRecipe discoverVulnOrResist equip extinguishTorches faceDirection findPathToPort fireSootheCheck getActiveStatuses getApplicableStatusEffects getAsHuman getAttack getBarteringBonus getBurnDamage getCombatStrength getConsumeBonus getCraftingDifficulty getDamage getDamageModifier getData getDescription getDialogInfo getDiscoveredVulnsAndResists getDisplayCreature getEquipEffect getEquipSlotForItem getEquippedItem getEquippedItems getGameOptions getGameOptionsBeforeModifiers getInspectionId getInsulation getJumpTile getMaxHealth getMaxWeight getMoveType getMovementDelay getMovementIntent getMovementPoint getMovementProgress getName getProducedTemperature getQualityBonus getReputation getReputationMultiplier getScaledWeight getSimplifiedCumulativeAttack getSkillBonus getStaminaDelay getStatus getStatuses getWeightOrStaminaMovementPenalty getWeightStatus hasData hasDelay hasDiscoveredVulnOrResist hasStatus hasTag hasWalkPath healthSyncCheck humansVisible hurtHands incrementIslandTickCount isDead isDualWielding isExploredClientSide isGhost isHost isLocalPlayer isNearby isOffHandDisabled isOnFire isResting isRestingCancelled isServer isSwimming isValid isWithinHumanBounds kill load loadOnIsland loadUi moveTo moveToIsland moveToIslandId moveToIslandPosition moveTowardsIsland notifyItem notifyStat onCanMove onDamage onDie onGetMovementIntent onMoveComplete onMovementCompleted onNoInput onSetStatChangeTimer onSkillGain onStaminaUseChanged onStatChange onStatusEffectChanged onUnserialized overrideNextMovement passTurn preSerializeObject processInput prompt queueSoundEffect queueSoundEffectInFront rangeAction refreshStatusEffects removeData removeTag removeTamedCreature resetDefense resetMovementIntent resetStatTimers respawn revealItem setCachedTile setData setFromPosition setHumansWithinBound setMoveType setMoving setName setOptions setPosition setStatChangeTimerIgnoreDifficultyOptions setStatus setTamedCreatureEnemy setVehicle setWalkPath setZ setup skipNextMovement skipNextUpdate staminaReduction staminaSyncCheck startResting statGain swimAndSootheCheck tick tickStatuses toString trampleFire unequip unequipAll unload updateActionSlots updateContainerSortInfo updateDialogInfo updateDirection updateDismantleTable updateMovementIntent updateRender updateReputation updateReputationForAttackingWithTamedCreature updateStatsAndAttributes updateStrength updateSwimming updateTables updateTablesAndWeight updateTile updateVehicle updateView updateWeight getNameTranslation

Constructors

  • Parameters

    • Optional identifier: string

    Returns default

Properties

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

Type declaration

  • end: number
  • start: number
absentLastUsedTime: number = 0
actionBar: IActionBarSlotData[] = []
allowSmartMovementClientside?: boolean
anim: number = 0
attackAnimationTime?: IMovementTime
attackAnimationType?: DamageType
cachedMovementPenalty?: number
containerSortInfo: Record<string | number, undefined | IContainerSortInfo> = {}
crafted: Record<number, ICrafted> = {}
customization: ICustomizations
deathBy: ISerializedTranslation = ...
defense: default = ...
defenses: number[] = []
dialogContainerInfo: Record<number, undefined | IDialogInfo> = {}
dialogInfo: Record<string, IDialogInfo> = {}
direction: default = Vector2.ZERO

undefined = Vector2.ZERO for this

displayCreature?: CreatureType
equipEffects: Map<EquipEffect, EquipEffects> = ...
equippedOffHandDisabled?: default
equippedReferences: Map<EquipType, default> = ...
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
hintSeen: boolean[] = []
id: number
identifier: string
inventory: IContainer = ...
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}` = DEFAULT_ISLAND_ID
lastAttackedByReference?: Reference
manualTickActionDelay?: number
messages: IMessageManager
milestoneModifiers: Set<Milestone> = ...
milestoneTitle?: Milestone
milestonesCollection: GameplayModifiersCollection<default, Milestone, MilestoneModifierInstance<any>, [default<number>?]> = ...
moveType?: MoveType
movementCompleteZ?: number

Only used for Human entities

movementIntent: IMovementIntent = {}
movingClientside: MovingClientSide = MovingClientSide.NoInput

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

movingOptions?: IMoveToOptions
name: string
nextMoveDirection?: None | East | North | West | South
nextMoveTime: number = 0
options: Readonly<IOptions> = ...
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
revealedItems: Record<number, boolean> = {}
score: number = 0
shouldSkipNextMovement?: true
shouldSkipNextUpdate?: true
skill: default
stat: default<default> = ...
state: PlayerState = PlayerState.None
stats: IStats
status: IStatus
swimming: boolean = false
tamedCreatures: Map<`${number},${number}`, Set<number>> = ...
ticksSpent: Map<`${number},${number}`, number> = ...
turns: number = 1
type: number
useActionsWhileMoving: boolean = true
vehicleItemReference: undefined | default
walkPath?: IWalkPath
walkSoundCounter: number = 4
x: number
y: number

Accessors

  • get asCorpse(): undefined
  • Returns undefined

  • get asCreature(): undefined
  • Returns undefined

  • 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(): default<number>
  • Returns default<number>

  • get asItem(): undefined
  • Returns undefined

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

  • get asNPC(): undefined
  • Returns undefined

  • get asPlayer(): this
  • Returns this

  • get asTileEvent(): undefined
  • Returns undefined

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

    Returns undefined | DescriptionType

  • get entityType(): Player
  • Returns Player

  • 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

  • Parameters

    • delay: number
    • Optional replace: boolean
    • Optional addStaminaDelay: boolean

    Returns void

  • This only does stuff when it's called on the local player

    Parameters

    Returns void

  • Parameters

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

    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

  • 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

  • Burn the player

    Parameters

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

    Returns undefined | number

  • Returns void

  • Parameters

    Returns boolean

  • Parameters

    • x: number
    • y: number

    Returns boolean

  • Parameters

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

    Returns boolean

  • Parameters

    • entity: default<unknown, number, unknown, unknown>
    • source: undefined | string

    Returns boolean

  • Returns void

  • Parameters

    • id: number

    Returns void

  • 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

    • range: number
    • Optional includePlayers: boolean

    Returns IMobCheck

  • Returns boolean

  • Returns void

  • Returns void

  • Parameters

    Returns undefined | number

  • Deprecated

    provide a full IDamageInfo object yourself you lazy fiend

    Parameters

    • damageInfoOrAmount: number | IDamageInfo
    • Optional damageMessage: default | default
    • Optional soundDelay: number
    • Optional causesBlood: boolean
    • Optional statusEffect: default

    Returns undefined | number

  • Returns void

  • Parameters

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

    Returns void

  • Parameters

    Returns boolean

  • Extinguishes all torches the player is holding.

    Returns void

  • Returns true if the player changed their facing direction.

    Parameters

    Returns boolean

  • Parameters

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

    Returns undefined | default[]

  • Chance to stop frostbite when next to a fire

    Returns void

  • Returns the bartering bonus for a given credit value

    Parameters

    • baseCredits: number

    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

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

    Returns void

  • Parameters

    • dialogIndex: undefined | string | number

    Returns undefined | IDialogInfo

  • Returns undefined | CreatureType

  • Parameters

    • Optional includeDisabled: true

    Returns default[]

  • Returns string

  • 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

  • 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

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

    Parameters

    • timeStamp: number

    Returns number

  • Parameters

    • includeTitle: boolean = false

    Returns default

  • 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

  • Returns number

  • Multiply the reputation amount with whatever is set via milestone modifiers or custom game options for this player.

    Returns

    A number or undefined if a reputation number was not passed.

    Parameters

    • reputation: undefined | number

      A number or undefined to be mutiplied.

    Returns undefined | number

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

    Returns number

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

    Parameters

    • staminaToStartAddingDelayAt: number = STAMINA_LOW_PENALTY_START

      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

  • Generator for status effects on the entity.

    Returns default[]

  • 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

  • Returns boolean

  • Parameters

    • reason: string

    Returns void

  • Parameters

    Returns boolean

  • Returns boolean

  • Returns boolean

  • Check if a position is marked as explored Only use this clientside

    Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Parameters

    • entity: default<unknown, number, unknown, unknown>

    Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns boolean

  • Returns true if this is the special dedicated server player

    Returns boolean

  • Gets if the human is swimming (and not on a boat)

    Returns boolean

  • Returns boolean

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

    Returns boolean

  • Returns void

  • 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>

  • Parameters

    Returns undefined | false

  • Parameters

    Returns void

  • Returns void

  • Returns void

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

    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

  • Prompts the player

    Parameters

    • type: Prompt
    • Rest ...args: any[]

    Returns Promise<boolean | default>

  • Parameters

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

    Returns void

  • Parameters

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

    Returns void

  • Parameters

    Returns {
        actionRange: number;
        bonusRange: number;
        mobCheck: IMobCheck;
    }

    • actionRange: number
    • bonusRange: number
    • mobCheck: IMobCheck
  • 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

  • Parameters

    • tag: unknown

    Returns void

  • Parameters

    • Optional skipStatChangedEvent: boolean

    Returns void

  • Returns void

  • Parameters

    • reset: boolean

    Returns void

  • Parameters

    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

  • 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

    Returns boolean

  • Parameters

    • item: undefined | default
    • Optional extinguishTorches: boolean

    Returns boolean

  • Parameters

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

      If true, adds a delay to the player, clears any particles, and updates the view. (Default: true)

    • updateFlowField: boolean = true

    Returns boolean

  • Parameters

    Returns void

  • Skips the next movement for this creature / npc

    Returns void

  • Skips the next update for this creature / npc

    Returns void

  • Parameters

    • Optional skill: SkillType
    • Optional level: number

    Returns void

  • Parameters

    • reason: string

    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

  • Parameters

    Returns void

  • 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

    Returns void

  • Returns void

  • Returns void

  • Parameters

    Returns void

  • Send a packet to the server about the sort info for the container

    Parameters

    • dialogIndex: undefined | string | number

    Returns void

  • Send a packet to the server about the dialog info for the dialog

    Parameters

    • dialogIndex: undefined | string | number

    Returns void

  • Faces the target tile

    Parameters

    • tile: default
    • Optional updateVehicleDirection: boolean

    Returns void

  • Parameters

    • Optional adjacentContainers: IContainer[]
    • Optional force: boolean

    Returns void

  • Parameters

    • reputation: number

    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
    • Optional options: Partial<{
          allowCaching: boolean;
          skipDeferral: boolean;
      }>

    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

Generated using TypeDoc