Table of Contents

Class ItemSpawnableSettings

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Per-spawner configuration for world items: which item, how many, and how often the rare one shows up instead of the common one.

[Serializable]
public class ItemSpawnableSettings : SpawnableSettings
Inheritance
ItemSpawnableSettings
Inherited Members

Remarks

Like NPCSpawnableSettings, this exists so one world-item prefab can serve every pickup in the game. The prefab is the container; the template injected here is what it actually is. That keeps the object pool to a single bucket for all ground loot rather than one bucket per item type, which is the difference between a fixed memory cost and one that scales with the size of the item database.

Fields

AchievementTemplateID

Achievement granted to whoever picks the item up. 0 for none.

[Tooltip("Achievement template ID granted on pickup. 0 = none.")]
[TemplateReference(typeof(AchievementTemplate))]
public int AchievementTemplateID

Field Value

int

ItemTemplate

The item template to inject when RollTable is empty.

[Tooltip("Item spawned when the roll table below is empty.")]
public BaseItemTemplate ItemTemplate

Field Value

BaseItemTemplate

MaximumAmount

The maximum number of items to spawn in a single stack.

[Min(1)]
public int MaximumAmount

Field Value

int

MinimumAmount

The minimum number of items to spawn in a single stack.

[Min(1)]
public int MinimumAmount

Field Value

int

RollTable

Optional weighted table. When it holds entries, one is rolled instead of using ItemTemplate.

[Tooltip("Optional weighted table. When non-empty, one entry is rolled per spawn.")]
public List<ItemSpawnableSettings.ItemRoll> RollTable

Field Value

List<ItemSpawnableSettings.ItemRoll>

Methods

OnSpawned(NetworkObject, ObjectSpawner)

Injects the rolled item template and stack amount into the spawned WorldItem component.

public override void OnSpawned(NetworkObject nob, ObjectSpawner spawner)

Parameters

nob NetworkObject

The instantiated network object to configure.

spawner ObjectSpawner

The spawner that created this object.

OnValidate()

Clamps the stack ranges so a misconfigured entry cannot throw at spawn time.

public override void OnValidate()