Attachment components

Attachment components are used to define properties and behaviors of attachment items.

Equip behavior

This component defines the timed action behavior when equipping an attachment, allowing for custom animations and specifications on the time required to equip or unequip.

For example, the saddle attachment uses this component to specify the animation and time taken to equip it:

equipBehavior = {
    time = -1,
    anim = {
        ["Left"] = "Horse_EquipSaddle_Left",
        ["Right"] = "Horse_EquipSaddle_Right",
    },
    shouldHold = true,
}

This component can be both used to customize equip and unequip actions for attachments.

class HorseMod.EquipBehavior

Equip behavior to use during equip or unequip timed actions for attachments.

time: number

Time to equip, if -1 the animation defines the end time.

anim: {Left: string?, Right: string?}?

Animations to play during equip, based on the mounting position, it must be an AnimNode variable condition.

shouldHold: boolean?

Whenever the item should be held in hand when equipping it. Defaults to false.


Container behavior

This component defines the container behavior for attachments that can hold items, such as saddlebags. It defines a world item that represents the container in the game world which will serve as an invisible container in the world that the players can’t see but can store item in.

containerBehavior = {
    worldItem = "HorseMod.HorseSaddlebagsContainer",
}

The majority of this component is handled in the HorseMod.attachments.ContainerManager module, which manages the creation, tracking, and updating of these containers as attachments are equipped and unequipped.

class HorseMod.ContainerBehavior

Used to assign container behavior handling to an attachment.

worldItem: string

Full type of the item being used as the invisible container.