Table of Contents

Class EquippableBuilder

Namespace
S1API.Items
Assembly
S1API.dll

Builder for creating equippable components that can be attached to items. Use this to create custom equippable behavior for items.

public sealed class EquippableBuilder
Inheritance
EquippableBuilder
Inherited Members
Extension Methods

Constructors

EquippableBuilder()

public EquippableBuilder()

Methods

Build()

Builds and finalizes the equippable component. Configures the GameObject to be persistent and inactive (prefab-like state).

public Equippable Build()

Returns

Equippable

A wrapper around the created equippable component.

CreateBasicEquippable(string)

Creates a basic equippable GameObject with the default Equippable component.

public EquippableBuilder CreateBasicEquippable(string name = null)

Parameters

name string

Optional name for the GameObject.

Returns

EquippableBuilder

The builder instance for fluent chaining.

CreateEquippable<T>(string)

Creates an equippable GameObject with the specified equippable component type.

public EquippableBuilder CreateEquippable<T>(string name = null) where T : Equippable

Parameters

name string

Optional name for the GameObject. If not provided, uses the type name.

Returns

EquippableBuilder

The builder instance for fluent chaining.

Type Parameters

T

The type of equippable component to create. Must inherit from the game's Equippable class.

CreateViewmodelEquippable(string)

Creates a viewmodel equippable GameObject with Equippable_Viewmodel component. This allows the item to be held in first-person with a 3D model.

public EquippableBuilder CreateViewmodelEquippable(string name = null)

Parameters

name string

Optional name for the GameObject.

Returns

EquippableBuilder

The builder instance for fluent chaining.

WithAvatarEquippable(string, AvatarHand, string)

Configures the third-person avatar equippable animation. Only applies to viewmodel equippables created with CreateViewmodelEquippable(string).

public EquippableBuilder WithAvatarEquippable(string assetPath, AvatarHand hand = AvatarHand.Right, string animationTrigger = "RightArm_Hold_ClosedHand")

Parameters

assetPath string

Resources path to the AvatarEquippable prefab (e.g., "Equippables/MyItem").

hand AvatarHand

Which hand holds the item in third-person (Left or Right).

animationTrigger string

Animation trigger/bool name for third-person animation.

Returns

EquippableBuilder

The builder instance for fluent chaining.

WithInteraction(bool, bool)

Configures interaction and pickup capabilities when this item is equipped.

public EquippableBuilder WithInteraction(bool canInteract, bool canPickup)

Parameters

canInteract bool

Whether the player can interact with objects when this is equipped.

canPickup bool

Whether the player can pick up items when this is equipped.

Returns

EquippableBuilder

The builder instance for fluent chaining.

WithUseCallback(Action<ItemInstance>)

Registers a callback to be invoked when the player uses this item (clicks while holding it). Only applies to viewmodel equippables created with CreateViewmodelEquippable(string). The callback receives the ItemInstance being used.

public EquippableBuilder WithUseCallback(Action<ItemInstance> callback)

Parameters

callback Action<ItemInstance>

Callback to invoke when the item is used.

Returns

EquippableBuilder

The builder instance for fluent chaining.

WithViewmodelTransform(Vector3, Vector3, Vector3?)

Configures the first-person viewmodel transform settings. Only applies to viewmodel equippables created with CreateViewmodelEquippable(string).

public EquippableBuilder WithViewmodelTransform(Vector3 position, Vector3 rotation, Vector3? scale = null)

Parameters

position Vector3

Local position offset for the viewmodel.

rotation Vector3

Local euler angles for the viewmodel.

scale Vector3?

Local scale for the viewmodel (default: Vector3.one).

Returns

EquippableBuilder

The builder instance for fluent chaining.