Class BarricadeStateStore
- Namespace
- Uncreated.Warfare.FOBs.StateStorage
- Assembly
- Uncreated.Warfare.dll
A service for storing and fetching SDG.Unturned.BarricadeData states (byte arrays that contain information about its stored items) in yaml, so that a particular state can be loaded later.
public class BarricadeStateStore : ILayoutHostedService, IDisposable
- Inheritance
-
BarricadeStateStore
- Implements
- Inherited Members
Constructors
BarricadeStateStore(WarfareModule, ILogger<BarricadeStateStore>)
public BarricadeStateStore(WarfareModule warfareModule, ILogger<BarricadeStateStore> logger)
Parameters
warfareModuleWarfareModuleloggerILogger<BarricadeStateStore>
Properties
Spawns
List of all buildable save.
public IReadOnlyList<BarricadeStateSave> Spawns { get; }
Property Value
Remarks
Use SaveAsync(CancellationToken) or SaveAsync(ItemBarricadeAsset, byte[], FactionInfo?, CancellationToken) when making changes.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
FindBarricadeSave(ItemPlaceableAsset, FactionInfo?)
Find a barricade save from an asset an an optional faction. A faction match is prioritized over an unfiltered match.
public BarricadeStateSave? FindBarricadeSave(ItemPlaceableAsset matchingAsset, FactionInfo? matchingfactionInfo = null)
Parameters
matchingAssetItemPlaceableAssetmatchingfactionInfoFactionInfo
Returns
RemoveAsync(BarricadeStateSave, CancellationToken)
Delete the given barricade save if it exists.
public UniTask<bool> RemoveAsync(BarricadeStateSave save, CancellationToken token = default)
Parameters
saveBarricadeStateSavetokenCancellationToken
Returns
- UniTask<bool>
SaveAsync(ItemBarricadeAsset, byte[], FactionInfo?, CancellationToken)
Add a new barricade save or just save the list if it's already in the list.
public UniTask SaveAsync(ItemBarricadeAsset asset, byte[] state, FactionInfo? faction = null, CancellationToken token = default)
Parameters
assetItemBarricadeAssetstatebyte[]factionFactionInfotokenCancellationToken
Returns
- UniTask
SaveAsync(CancellationToken)
Save all barricade saves to disk.
public UniTask SaveAsync(CancellationToken token = default)
Parameters
tokenCancellationToken
Returns
- UniTask