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

Armor

Module used to manage armor's behavior.

Index

Interfaces

ArmorGeneralFunction

  • ArmorGeneralFunction(item: ItemInstance, slot: number, player: number): void
  • Parameters

    Returns void

ArmorHurtFunction

  • ArmorHurtFunction(item: ItemInstance, slot: number, player: number, value: number, type: number, attacker: number, bool1: boolean, bool2: boolean): void
  • Parameters

    • item: ItemInstance
    • slot: number
    • player: number
    • value: number
    • type: number
    • attacker: number
    • bool1: boolean
    • bool2: boolean

    Returns void

IArmorCallback

IArmorCallback:

hurt

tick

IArmorHurtParams

IArmorHurtParams:

attacker

attacker: number

Attacker entity or -1 if the damage was not caused by an entity.

bool1

bool1: boolean

TODO: Unknown param!

bool2

bool2: boolean

TODO: Unknown param!

damage

damage: number

Damage amount that was applied to the player.

type

type: number

Damage type.

IArmorInfo

IArmorInfo:

callback

callback: IArmorCallback

durability

durability: number

IArmorJSCallback

IArmorJSCallback:

hurt

  • Called when player deals damage if player wears the armor.


    Parameters

    • params: IArmorHurtParams

      additional data about damage

    • slot: ItemInstance

      current armor item instance

    • index: number

      armor slot, one of the EArmorType values

    • durability: number

      maximum damage the armor

    Returns boolean

    true, if changes to the item parameter should be applied, false otherwise.

tick

  • tick(slot: ItemInstance, index: number, durability: number): boolean
  • Called every tick if player wears the armor.


    Parameters

    • slot: ItemInstance

      current armor item instance

    • index: number

      armor slot, one of the EArmorType values

    • durability: number

      maximum damage the armor

    Returns boolean

    true, if changes to the item parameter should be applied, false otherwise.

Functions

preventDamaging

  • preventDamaging(id: string | number): void
  • Prevents armor from being damaged.


    Parameters

    • id: string | number

      armor item string or numeric ID

    Returns void

registerFuncs

registerLocalOnTakeOffListener

  • This event is called when local player takes off or changes this armor item.

    @since

    2.2.1b106


    Parameters

    Returns void

registerLocalOnTakeOnListener

  • This event is called when local player takes on this armor, or spawns with it.

    @since

    2.2.1b106


    Parameters

    Returns void

registerOnHurtListener

  • This event is called when the damage is dealt to the player that has this armor put on.


    Parameters

    Returns void

    Item object to change armor item, if nothing is returned, armor will not be changed.

registerOnLocalTickListener

  • This event is called every tick for local player that has this armor put on.

    @since

    2.2.1b106


    Parameters

    Returns void

    Item object to change armor item, if nothing is returned, armor will not be changed.

registerOnTakeOffListener

  • This event is called when player takes off or changes this armor item.


    Parameters

    Returns void

registerOnTakeOnListener

  • This event is called when player takes on this armor, or spawns with it.


    Parameters

    Returns void

registerOnTickListener

  • This event is called every tick for every player that has this armor put on.


    Parameters

    Returns void

    Item object to change armor item, if nothing is returned, armor will not be changed.