Enchantable
A class in Root.Township, Alta.Enchantments.
Component on an item that holds its enchantments and syncs their trigger and effect messages to clients. The server adds the prefab's initial enchantments; loading ignores the saved list.
- Listed in Crafting and making
- Inherits or implements
NetworkEntityBehaviour,ISavable<EnchantableData>,ISavableSave<EnchantableData>,ISavableSaveBase - Derived types
EnchantableData - Documented in Other systems
Constructors
| Member | What it is |
|---|---|
Enchantable() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
9 private and internal fields
| Member | What it is |
|---|---|
private IEnchantmentEffectApplication effectApplication | Private: the effect whose message is being sent or received. |
private Dictionary<Enchantment, EnchantmentApplication> enchantments | Private: the active enchantments and their applications. |
private Enchantment[] initial | Enchantments added when the server spawns the item. Also filled with the current ones when saving. |
private Pickup pickup | Backing field for Pickup. |
private int sendingEffectIndex | Private: index of the effect in the message, or -1. |
private Enchantment sendingEnchantment | Private: the enchantment the message is for. |
private int sendingTriggerIndex | Private: index of the trigger in the message, or -1. |
private MethodSync syncMessage | Private: message used by SendTriggerMessage and SendEffectMessage. |
private IEnchantmentTriggerApplication triggerApplication | Private: the trigger whose message is being sent or received. |
Properties
| Member | What it is |
|---|---|
Pickup Pickup { get; } | The item's pickup. |
Methods
| Member | What it is |
|---|---|
EnchantmentApplication Add(Enchantment enchantment) | Adds an enchantment and returns its application, or null if the item already has it. |
EnchantmentApplication Get(Enchantment enchantment) | Returns the application of an enchantment on this item, or null. |
override void Initialize() | Creates the enchantment list and the sync message. |
override void InitializeAsServer(SpawnData spawnData) | Server: adds the initial enchantments. |
void SendEffectMessage(IEnchantmentEffectApplication effectApplication) | Sends one effect application's message to players in the chunk. |
void SendTriggerMessage(IEnchantmentTriggerApplication triggerApplication) | Sends one trigger application's message to players in the chunk. |
2 private and internal methods
| Member | What it is |
|---|---|
private void EnchantmentRemoved(EnchantmentApplication application) | Private: drops an enchantment from the list when its application is removed. |
private void SyncEffect(IPlayer player, Stream stream) | Private: sends or receives one enchantment trigger or effect message, by enchantment and index, and passes the stream to it. |
Used in
Members of other types that take, return or hold a Enchantable: