Class default<TypeType>Abstract

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

Type Parameters

  • TypeType extends number = number

Hierarchy

Implements

Constructors

Properties

Accessors

Methods

addDelay addMilestone addReferenceId addTag addTamedCreature animateAttack animateBumpTowards applyTravelingEffects burn calculateDamageAmount calculateEquipmentStats calculateStats calculateVoyageInfo canCombatTides canInspect canSailAway canSailTo canSeeObject canSeePosition canSeeTile canSwapWith cancelResting capReputation causeStatus checkForGather checkForGatherFire checkForStill checkForTargetInRange checkForWell checkOnLoadMilestones checkUnder clearTileCache createItemInInventory createMessageManager createNoteManager createQuestManager createSkillManager damage damageByInteractingWith damageRandomEquipment discoverRecipe discoverVulnOrResist equip extinguishTorches findPathToPort fireSootheCheck getActiveStatuses getApplicableStatusEffects getAsHuman getAttack getBarteringBonus getBurnDamage getCombatStrength getConsumeBonus getCraftingDifficulty getDamage getDamageModifier getData getDescription getDiscoveredVulnsAndResists 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 isGhost isHost isLocalPlayer isNearby isOffHandDisabled isOnFire isResting isRestingCancelled isServer isSwimming isValid isWithinHumanBounds kill loadOnIsland loadUi moveTo moveToIsland moveToIslandId moveToIslandPosition moveTowardsIsland notifyItem notifyStat onDie onMoveComplete onMovementCompleted onNoInput onSetStatChangeTimer onSkillGain onStaminaUseChanged onStatChange onStatusEffectChanged overrideNextMovement passTurn processInput queueSoundEffect queueSoundEffectInFront rangeAction refreshStatusEffects removeData removeTag removeTamedCreature resetDefense resetMovementIntent resetStatTimers setCachedTile setData setFromPosition setHumansWithinBound setMoveType setMoving setName setOptions setPosition setStatChangeTimerIgnoreDifficultyOptions setStatus setTamedCreatureEnemy setVehicle setWalkPath setZ skipNextMovement skipNextUpdate staminaReduction staminaSyncCheck startResting statGain swimAndSootheCheck tick tickStatuses toString trampleFire unequip unequipAll updateDirection updateMovementIntent updateRender updateReputation updateReputationForAttackingWithTamedCreature updateStatsAndAttributes updateStrength updateSwimming updateTablesAndWeight updateTile updateVehicle updateView updateWeight getNameTranslation

Constructors

Properties

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

Type declaration

  • end: number
  • start: number
allowSmartMovementClientside?: boolean
anim: number = 0
attackAnimationTime?: IMovementTime
attackAnimationType?: DamageType
cachedMovementPenalty?: number
crafted: Record<number, ICrafted> = {}
customization: ICustomizations
deathBy: ISerializedTranslation = ...
defense: default = ...
defenses: number[] = []
direction: default = Vector2.ZERO

undefined = Vector2.ZERO for this

entityType: EntityType
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
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}`
lastAttackedByReference?: Reference
manualTickActionDelay?: number
messages: IMessageManager
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
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
score: number = 0
shouldSkipNextMovement?: true
shouldSkipNextUpdate?: true
skill: default
stat: default<default<TypeType>> = ...
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
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 | default
  • Returns undefined | default

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

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

  • get asTileEvent(): undefined
  • Returns undefined

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

    Returns undefined | DescriptionType

  • 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 tilesAround(): undefined | default[]
  • Returns undefined | default[]

Methods

  • Parameters

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

    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

  • 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

  • Returns void

  • Parameters

    • Optional destination: default
    • Optional distanceFromEdge: number

    Returns IVoyageInfo

  • 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

  • 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

    • range: number
    • Optional includePlayers: boolean

    Returns IMobCheck

  • Returns boolean

  • Returns void

  • Returns void

  • Returns default

  • 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

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

  • 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

  • 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

    • item: default
    • Optional includeDisabled: true

    Returns undefined | EquipType

  • Parameters

    • slot: EquipType
    • Optional includeDisabled: true

    Returns undefined | default

  • 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

  • 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

  • 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

  • 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

  • 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

      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[]

  • Returns number

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

  • Returns boolean

  • 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

  • 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

    • 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

  • 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

    Returns boolean

  • 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

  • Parameters

    Returns void

  • Parameters

    • stat: Stat | IStat
    • 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: StatusEffectChangeReason

      The reason for the change

    Returns boolean

  • Parameters

    Returns void

  • 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

  • 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

  • Parameters

    Returns void

  • Improve one of the core player stats

    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

  • 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

  • Faces the target tile

    Parameters

    • tile: default
    • Optional updateVehicleDirection: boolean

    Returns void

  • Parameters

    Returns boolean

  • Parameters

    • reputation: number

    Returns void

  • Parameters

    Returns void

  • 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

  • Returns default

Generated using TypeDoc