Table of Contents

Class ConsumableTemplate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Abstract base class for consumable item templates, defining type, charge cost, and cooldown behavior. Provides logic for consuming items and applying cooldowns.

public abstract class ConsumableTemplate : BaseItemTemplate, ICachedObject, ITooltip
Inheritance
Object
ScriptableObject
ConsumableTemplate
Implements
Derived
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.MemberwiseClone()
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.ToString()
Object.name
Object.hideFlags
Extension Methods

Fields

ActivationTime

The time required to activate this consumable (in seconds). A value of 0 means instant activation.

public float ActivationTime

Field Value

float

ChargeCost

The number of charges consumed per use.

public uint ChargeCost

Field Value

uint

ConsumableType

The type of consumable (e.g., potion, scroll).

public ConsumableType ConsumableType

Field Value

ConsumableType

Cooldown

The cooldown duration (in seconds) applied after consumption.

public float Cooldown

Field Value

float

Methods

BuildTooltip(TooltipContent, bool)

Describes the consumable: what it is, what a use costs, and how often.

public override void BuildTooltip(TooltipContent content, bool describingInstance)

Parameters

content TooltipContent

The content being assembled.

describingInstance bool

CanConsume(IPlayerCharacter, Item, uint)

Determines if the specified character can consume the given item. Checks for valid character, item, stackable status, sufficient charges, and cooldown.

public bool CanConsume(IPlayerCharacter character, Item item, uint currentTick)

Parameters

character IPlayerCharacter

The player character attempting to consume.

item Item

The item to be consumed.

currentTick uint

The current network tick for cooldown evaluation.

Returns

bool

True if the item can be consumed, false otherwise.

Invoke(IPlayerCharacter, Item, uint)

Attempts to consume the item, applying cooldown and reducing charges as needed. Destroys the item if charges are depleted.

public virtual bool Invoke(IPlayerCharacter character, Item item, uint currentTick)

Parameters

character IPlayerCharacter

The player character consuming the item.

item Item

The item to be consumed.

currentTick uint

The current network tick for cooldown creation.

Returns

bool

True if the item was successfully consumed, false otherwise.

ReplayEffect(IPlayerCharacter)

Re-applies, on a reconcile replay of the owning client, the part of a use that the reconcile rolled back: the effect on the character's own replicated state (a potion's restored resources). Never the charge, the cooldown or the item itself: the reconcile does not roll those back, and the caller re-applies the cooldown separately.

public virtual void ReplayEffect(IPlayerCharacter character)

Parameters

character IPlayerCharacter

The character the consumable was used by.

Remarks

A reconcile for a tick BEFORE the use restores the character's resources without it, and the replay of the use tick is the only thing that can put the effect back. Skipping it showed a potion's restore, then the old value again for about a round trip, then the restore once more when the server's own reconcile included it. A reconcile for a tick AT or after the use already contains the effect and does not replay the use tick, so this cannot apply twice. Default: nothing to re-apply.