Changes

Reword Terminology section and titles to make more sense
Line 21: Line 21:  
In the rest of this article, we will refer to these terms frequently, so make sure you are familiar with them.
 
In the rest of this article, we will refer to these terms frequently, so make sure you are familiar with them.
   −
* '''Capability''': the ability to perform something; in-code this is represented by the <code>Capability</code> class.
+
* '''Capability''': the ability to perform something. In-code this is represented by the <code>Capability</code> class.
* '''Capability Provider''': something that is able to support capabilities and provides a mean of accessing them; capability providers come in multiple kinds.
+
* '''Capability Provider''': something that is able to support capabilities and provides a mean of accessing them. In-code they are represented by implementations of <code>ICapabilityProvider</code>. There are multiple kinds of capability providers:
 
** ''Volatile Provider'': a provider that doesn't persist data to disk; once the provider ceases to exist for any number of reasons, all capability data gets deleted.
 
** ''Volatile Provider'': a provider that doesn't persist data to disk; once the provider ceases to exist for any number of reasons, all capability data gets deleted.
** ''Persistent Provider'': a provider that requires all capabilities to serialize data to disk, in order to persist data even across game restarts.
+
** ''Persistent Provider'': a provider that requires all capabilities to serialize data to disk, in order to persist data even across game restarts. They implement the <code>INBTSerializable</code> interface.
** ''Agnostic Provider'': a provider that isn't neither volatile nor persistent, rather delegates the decision either to the capability directly or to sub-implementations.
+
** ''Agnostic Provider'': a provider that isn't neither volatile nor persistent, rather delegates the decision either to the capability directly or to sub-implementations. They also implement the <code>INBTSerializable</code> interface.
 
* '''Capability Interface''': the interface that defines the contract of the capability, so what operations the capability exposes.
 
* '''Capability Interface''': the interface that defines the contract of the capability, so what operations the capability exposes.
 
* '''Capability Implementation''': one of the possibly many implementations of the capability interface, that actually carries out the work; one of the various implementations may also be considered the '''default capability implementation'''.
 
* '''Capability Implementation''': one of the possibly many implementations of the capability interface, that actually carries out the work; one of the various implementations may also be considered the '''default capability implementation'''.
 
* '''Capability Storage''': the manager that handles loading and storing persistent capabilities data from and to disk, guaranteeing preservation of information; in-code this is represented by an implementation of the <code>Capability.IStorage</code> interface.
 
* '''Capability Storage''': the manager that handles loading and storing persistent capabilities data from and to disk, guaranteeing preservation of information; in-code this is represented by an implementation of the <code>Capability.IStorage</code> interface.
 +
 +
The wary reader may note that both ''persistent'' and ''agnostic'' providers are represented the same way in code. In fact, the only difference between them comes from pure semantics in how their serialization methods are designed. This will be further discussed in their respective sections.
    
== Forge-provided Capabilities and Providers ==
 
== Forge-provided Capabilities and Providers ==
Line 43: Line 45:  
=== <code>IEnergyStorage</code> ===
 
=== <code>IEnergyStorage</code> ===
   −
== Operating with Capabilities ==
+
== Working with Capabilities ==
   −
=== Exposing ===
+
=== Exposing a Capability ===
   −
=== Attaching ===
+
=== Attaching a Capability ===
 +
 
 +
=== Accessing a Capability ===
    
== Creating Custom Capabilities ==
 
== Creating Custom Capabilities ==
 +
 +
=== The Capability Interface and the Capability Implementation ===
 +
 +
=== The Capability Storage ===
 +
 +
=== The Capability Provider ===
 +
 +
=== Tying it All Together ===
    
== Code Examples ==
 
== Code Examples ==