EquippableItemTemplate - jimdroberts/FishMMO GitHub Wiki

Description

Abstract base class for equippable item templates, defining slot, attributes, and model data. Used for equipment items such as armor and weapons.


API Access

Fields

  • public ItemSlot Slot

    The equipment slot this item can be equipped to (e.g., head, chest, weapon).

  • public int MaxItemAttributes

    The maximum number of attributes the item will have when it's generated.

  • public ItemAttributeTemplateDatabase[] RandomAttributeDatabases

    The databases of random item attributes that can be added to the item when it's generated.

  • public uint ModelSeed

    The seed value used for model randomization and selection.

  • public int[] ModelPools

    Pools of models for different model variations. Used to select different visual models for the item.


Basic Usage

Setup

  1. Inherit from EquippableItemTemplate to create custom equipment item templates (e.g., armor, weapons).
  2. Assign the Slot field to specify where the item can be equipped.
  3. Set MaxItemAttributes and assign RandomAttributeDatabases for attribute generation.
  4. Configure ModelSeed and ModelPools for model selection and randomization.

Example

// Example 1: Creating a custom armor template
public class MyArmorTemplate : EquippableItemTemplate {
    // Custom logic or additional fields
}

// Example 2: Accessing slot and attributes
EquippableItemTemplate template = ...;
ItemSlot slot = template.Slot;
int maxAttrs = template.MaxItemAttributes;
ItemAttributeTemplateDatabase[] dbs = template.RandomAttributeDatabases;

Best Practices

  • Assign the correct ItemSlot for each equipment item to ensure proper equipping logic.
  • Use RandomAttributeDatabases to provide variety and replayability for generated items.
  • Document the intended use and configuration of each field in the asset's Inspector description.
  • Use ModelSeed and ModelPools to diversify item appearance and avoid visual repetition.
⚠️ **GitHub.com Fallback** ⚠️