Table of Contents

Class EquipmentController

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Controls the character's equipment slots, handling equip/unequip logic and network synchronization. Manages client-server broadcasts for equipment changes and slot management.

Implements IPredictableController at Order 93 so equipment state participates in the prediction pipeline. Equipment-driven attribute changes are reconciled alongside other predicted state, eliminating the broadcast/reconcile race on ExternalModifier.

Three network paths feed this container and they must agree with one another:

public class EquipmentController : ItemContainer, IEquipmentController, ICharacterBehaviour, IItemContainer, IPredictableController
Inheritance
Object
Component
Behaviour
MonoBehaviour
NetworkBehaviour
EquipmentController
Implements
Inherited Members
NetworkBehaviour.IsSpawned
NetworkBehaviour.ComponentIndex
NetworkBehaviour.NetworkObject
NetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURS
NetworkBehaviour.UNSET_NETWORKBEHAVIOUR_ID
NetworkBehaviour.ToString()
NetworkBehaviour.Reset()
NetworkBehaviour.OnValidate()
NetworkBehaviour.IsBehaviourReconciling
NetworkBehaviour.ClearReplicateCache()
NetworkBehaviour.CreateReconcile()
NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)
NetworkBehaviour.OnStartServerCalled
NetworkBehaviour.OnStartClientCalled
NetworkBehaviour.OnStopNetwork()
NetworkBehaviour.OnStartServer()
NetworkBehaviour.OnStopServer()
NetworkBehaviour.OnOwnershipServer(NetworkConnection)
NetworkBehaviour.OnSpawnServer(NetworkConnection)
NetworkBehaviour.OnDespawnServer(NetworkConnection)
NetworkBehaviour.OnStartClient()
NetworkBehaviour.OnStopClient()
NetworkBehaviour.OnOwnershipClient(NetworkConnection)
NetworkBehaviour.ClearBuffedRpcs()
NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcs
NetworkBehaviour.IsClientOnly
NetworkBehaviour.IsServerOnly
NetworkBehaviour.IsHost
NetworkBehaviour.IsClient
NetworkBehaviour.IsServer
NetworkBehaviour.IsDeinitializing
NetworkBehaviour.NetworkManager
NetworkBehaviour.ServerManager
NetworkBehaviour.ClientManager
NetworkBehaviour.ObserverManager
NetworkBehaviour.TransportManager
NetworkBehaviour.TimeManager
NetworkBehaviour.SceneManager
NetworkBehaviour.PredictionManager
NetworkBehaviour.RollbackManager
NetworkBehaviour.NetworkObserver
NetworkBehaviour.IsClientInitialized
NetworkBehaviour.IsClientStarted
NetworkBehaviour.IsClientOnlyInitialized
NetworkBehaviour.IsClientOnlyStarted
NetworkBehaviour.IsServerInitialized
NetworkBehaviour.IsServerStarted
NetworkBehaviour.IsServerOnlyInitialized
NetworkBehaviour.IsServerOnlyStarted
NetworkBehaviour.IsHostInitialized
NetworkBehaviour.IsHostStarted
NetworkBehaviour.IsOffline
NetworkBehaviour.IsNetworked
NetworkBehaviour.GetIsNetworked()
NetworkBehaviour.IsManagerReconciling
NetworkBehaviour.Observers
NetworkBehaviour.IsOwner
NetworkBehaviour.IsController
NetworkBehaviour.HasAuthority
NetworkBehaviour.Owner
NetworkBehaviour.OwnerId
NetworkBehaviour.ObjectId
NetworkBehaviour.LocalConnection
NetworkBehaviour.OwnerMatches(NetworkConnection)
NetworkBehaviour.Despawn(GameObject, DespawnType?)
NetworkBehaviour.Despawn(NetworkObject, DespawnType?)
NetworkBehaviour.Despawn(DespawnType?)
NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)
NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)
NetworkBehaviour.RemoveOwnership()
NetworkBehaviour.GiveOwnership(NetworkConnection)
NetworkBehaviour.GetInstance<T>()
NetworkBehaviour.TryRegisterInstance<T>(T)
NetworkBehaviour.UnregisterInstance<T>()
NetworkBehaviour.CanLog(LoggingType)
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.GetComponent<T>()
Component.TryGetComponent<T>(out T)
Component.GetComponentInChildren<T>()
Component.GetComponentsInChildren<T>()
Component.GetComponentInParent<T>()
Component.GetComponentsInParent<T>()
Component.GetComponents<T>()
Component.GetComponentIndex()
Component.CompareTag(TagHandle)
Component.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.GetEntityId()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.name
Object.hideFlags

Properties

OnEquipTriggers

Triggers invoked when this character equips an item. EventData: EquipItemEventData.

public List<Trigger> OnEquipTriggers { get; }

Property Value

List<Trigger>

OnUnequipTriggers

Triggers invoked when this character unequips an item. EventData: EquipItemEventData.

public List<Trigger> OnUnequipTriggers { get; }

Property Value

List<Trigger>

Order

Execution order in the unified prediction pipeline. Runs after CooldownController (90) and before CharacterAttributeController (95) so equipment attribute modifiers are settled before the attribute reconcile snapshot.

public int Order { get; }

Property Value

int

Remarks

Must stay below Order (95). Restoring an item restates its own ledger entry through ItemGenerator.ApplyAttributesCharacterAttribute.SetSource; the attribute reconcile then installs the server's total as the residual over whatever those entries sum to. Raising this above 95 would have that residual computed before this tick's equipment is settled, so an item equipped on the reconciled tick counts twice. See the remarks on Order.

Methods

Activate(int)

Activates the item in the specified equipment slot, typically triggering its use effect.

public void Activate(int index)

Parameters

index int

The equipment slot index to activate.

ClearPendingRequest(ItemSlot)

public void ClearPendingRequest(ItemSlot slot)

Parameters

slot ItemSlot

Equip(Item, int, IItemContainer, ItemSlot)

Equips the specified item into the given equipment slot, handling swaps and unequips as needed.

public bool Equip(Item item, int inventoryIndex, IItemContainer container, ItemSlot toSlot)

Parameters

item Item

The item to equip.

inventoryIndex int

The index in the source inventory.

container IItemContainer

The source item container (e.g., inventory or bank).

toSlot ItemSlot

The equipment slot to equip the item into.

Returns

bool

True if the item was successfully equipped, false otherwise.

NotifyEquipRequested(Item, int, InventoryType, ItemSlot)

public void NotifyEquipRequested(Item item, int inventoryIndex, InventoryType fromInventory, ItemSlot toSlot)

Parameters

item Item
inventoryIndex int
fromInventory InventoryType
toSlot ItemSlot

NotifyUnequipRequested(ItemSlot, InventoryType)

public void NotifyUnequipRequested(ItemSlot slot, InventoryType toInventory)

Parameters

slot ItemSlot
toInventory InventoryType

OnAwake()

Called before InitializeOnce, character will not be set yet. Override for early setup.

public override void OnAwake()

OnCreateReconcile(ref CharacterReconcileData)

Writes this controller's authoritative state into the reconcile data (server only). Called once per tick after OnReplicate(ref CharacterReplicateData, ReplicateState, Channel).

public void OnCreateReconcile(ref CharacterReconcileData data)

Parameters

data CharacterReconcileData

OnReconcile(CharacterReconcileData, Channel)

Restores this controller's state from the server's authoritative reconcile data.

public void OnReconcile(CharacterReconcileData data, Channel channel)

Parameters

data CharacterReconcileData
channel Channel

OnReplicate(ref CharacterReplicateData, ReplicateState, Channel)

Executes this controller's simulation for the current tick. May modify input for observer prediction.

public void OnReplicate(ref CharacterReplicateData input, ReplicateState state, Channel channel)

Parameters

input CharacterReplicateData
state ReplicateState
channel Channel

OnStartCharacter()

Called after Character.OnStartClient. Use this for local client initialization.

public override void OnStartCharacter()

OnStartNetwork()

Called when the network has initialized this object. May be called for server or client but will only be called once. When as host or server this method will run before OnStartServer. When as client only the method will run before OnStartClient.

public override void OnStartNetwork()

OnStopCharacter()

Called right before Character.OnStopClient. Use this for local client cleanup.

public override void OnStopCharacter()

PopulateInput(ref CharacterReplicateData)

Populates this controller's portion of the unified input data (owner only). Called once per tick before OnReplicate(ref CharacterReplicateData, ReplicateState, Channel).

public void PopulateInput(ref CharacterReplicateData input)

Parameters

input CharacterReplicateData

ReadPayload(NetworkConnection, Reader)

Called before network start callbacks, but after the object is initialized with network values. This may be used to read information from predicted spawning, or simply have values set before initialization without depending on SyncTypes.

public override void ReadPayload(NetworkConnection conn, Reader reader)

Parameters

conn NetworkConnection
reader Reader

ResetState(bool)

Resets this NetworkBehaviour so that it may be added to an object pool.

public override void ResetState(bool asServer)

Parameters

asServer bool

Unequip(IItemContainer, byte, out List<Item>)

Unequips the item from the specified slot and adds it to the given container (e.g., inventory or bank).

public bool Unequip(IItemContainer container, byte slot, out List<Item> modifiedItems)

Parameters

container IItemContainer

The destination item container.

slot byte

The equipment slot to unequip from.

modifiedItems List<Item>

The list of items modified during the operation.

Returns

bool

True if the item was successfully unequipped and added, false otherwise.

WritePayload(NetworkConnection, Writer)

Called when writing a spawn. This may be used to deliver information for predicted spawning, or simply have values set before initialization without depending on SyncTypes.

public override void WritePayload(NetworkConnection conn, Writer writer)

Parameters

conn NetworkConnection
writer Writer

Events

OnItemEquipped

Fired after an item is successfully equipped. Subscribers receive the item and the slot.

public event Action<Item, ItemSlot> OnItemEquipped

Event Type

Action<Item, ItemSlot>

OnItemUnequipped

Fired after an item is successfully unequipped. Subscribers receive the item and the slot.

public event Action<Item, ItemSlot> OnItemUnequipped

Event Type

Action<Item, ItemSlot>