GlobalCommunalStorageValues
A class in Root.Township, Alta.Inventory.
Server: keeps communal storage contents across server wipes, saved in the Global Communal Storage file. Static methods use a single instance set in Awake.
- Listed in Items, inventory and logic
- Inherits or implements
NetworkEntityBehaviour
Constructors
| Member | What it is |
|---|---|
GlobalCommunalStorageValues() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|---|
private List<StorageData> availableData | Stored quantities shared by item and physical material. |
private GlobalCommunalStorageValuesData data | The loaded save data, or null if there was no file. |
private IAltaFile file | The save file. |
private static GlobalCommunalStorageValues instance | The single instance the static methods use. |
private static Logger logger | Logger for this class. |
private Task readingTask | The file read in progress; the static methods wait for it first. |
private Dictionary<CommunalStorageUniqueIdentifier, int> uniqueStorages | Stored quantities for unique storages, by identifier. |
Methods
| Member | What it is |
|---|---|
override async void Initialize() | Server: sets up the lists, hooks the wipe-finished event and reads the save file. |
static async Task<int> Load(CommunalStorageUniqueIdentifier identifier) | Takes and returns the stored quantity for an identifier or item, removing it and saving the file. Returns 0 if none. |
static async Task<int> Load(Pickup docked) | Takes and returns the stored quantity for an identifier or item, removing it and saving the file. Returns 0 if none. |
static async void Save(CommunalStorageUniqueIdentifier identifier, int quantity) | Records a quantity in memory, by unique identifier or added to the matching item and material. Written on FinishWipe. |
static async void Save(Pickup docked, int quantity) | Records a quantity in memory, by unique identifier or added to the matching item and material. Written on FinishWipe. |
static async Task Wipe() | Deletes the save file and clears everything. Used by the wipe-storage command. |