Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Armor

Module used to manage armor's behavior

Index

Functions

preventDamaging

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

    deprecated

    Currently not implemented

    Parameters

    • id: string

      armor item string id

    Returns void

registerFuncs

  • registerFuncs(id: string, funcs: { hurt: (params: { attacker: number; b1: boolean; b2: boolean; damage: number; type: number }, item: ItemInstance, index: number, maxDamage: number) => boolean; tick: (item: ItemInstance, index: number, maxDamage: number) => boolean }): void
  • Registers armor's hurt and tick functions

    deprecated,

    does not work in multiplayer

    Parameters

    • id: string

      armor item string id

    • funcs: { hurt: (params: { attacker: number; b1: boolean; b2: boolean; damage: number; type: number }, item: ItemInstance, index: number, maxDamage: number) => boolean; tick: (item: ItemInstance, index: number, maxDamage: number) => boolean }
      • hurt: (params: { attacker: number; b1: boolean; b2: boolean; damage: number; type: number }, item: ItemInstance, index: number, maxDamage: number) => boolean
          • (params: { attacker: number; b1: boolean; b2: boolean; damage: number; type: number }, item: ItemInstance, index: number, maxDamage: number): boolean
          • Called when player deals damage if player wears the armor

            Parameters

            • params: { attacker: number; b1: boolean; b2: boolean; damage: number; type: number }

              additional data about damage

              • attacker: number

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

              • b1: boolean

                unknown param

              • b2: boolean

                unknown param

              • damage: number

                damage amout that was applied to the player

              • type: number

                damage type

            • item: ItemInstance

              current armor item instance

            • index: number

              armor slot, one of the Native.ArmorType values

            • maxDamage: number

              maximum damage the armor

            Returns boolean

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

      • tick: (item: ItemInstance, index: number, maxDamage: number) => boolean
          • (item: ItemInstance, index: number, maxDamage: number): boolean
          • Called every tick if player wears the armor

            Parameters

            • item: ItemInstance

              current armor item instance

            • index: number

              armor slot, one of the Native.ArmorType values

            • maxDamage: number

              maximum damage the armor

            Returns boolean

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

    Returns void

registerOnHurtListener

  • registerOnHurtListener(id: string, func: (item: ItemInstance, slot: number, player: number, value: number, type: number, attacker: number, bool1: number, bool2: number) => void): ItemInstance | void
  • This event is called when the damage is dealed to the player that has this armor put on.

    Parameters

    • id: string
    • func: (item: ItemInstance, slot: number, player: number, value: number, type: number, attacker: number, bool1: number, bool2: number) => void
        • (item: ItemInstance, slot: number, player: number, value: number, type: number, attacker: number, bool1: number, bool2: number): void
        • Parameters

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

          Returns void

    Returns ItemInstance | void

    the {id: , count: , data: , extra: } object to change armor item, if nothing is returned, armor will be damaged by default.

registerOnTakeOffListener

  • registerOnTakeOffListener(id: string, func: (item: ItemInstance, slot: number, player: number) => void): void
  • This event is called when player takes off or changes this armor item.

    Parameters

    • id: string
    • func: (item: ItemInstance, slot: number, player: number) => void
        • Parameters

          Returns void

    Returns void

registerOnTakeOnListener

  • registerOnTakeOnListener(id: string, func: (item: ItemInstance, slot: number, player: number) => void): void
  • This event is called when player takes on this armor, or spawns with it.

    Parameters

    • id: string
    • func: (item: ItemInstance, slot: number, player: number) => void
        • Parameters

          Returns void

    Returns void

registerOnTickListener

  • registerOnTickListener(id: string, func: (item: ItemInstance, slot: number, player: number) => void): ItemInstance | void
  • This event is called every tick for every player that has this armor put on.

    Parameters

    • id: string
    • func: (item: ItemInstance, slot: number, player: number) => void
        • Parameters

          Returns void

    Returns ItemInstance | void

    the {id: , count: , data: , extra: } object to change armor item, if nothing is returned, armor will not be changed.

Generated using TypeDoc