Class SharedMaterialStorageSystem
This handles storing materials and modifying their amounts MaterialStorageComponent
Namespace: Content.Shared.Materials
Assembly: Content.Shared.dll
Syntax
public abstract class SharedMaterialStorageSystem : EntitySystem
Methods
| Improve this Doc View SourceCanChangeMaterialAmount(EntityUid, String, Int32, MaterialStorageComponent)
Checks if the specified material can be changed by the specified volume.
Declaration
public bool CanChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String | materialId | |
System.Int32 | volume | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Boolean | If the amount can be changed |
CanTakeVolume(EntityUid, Int32, MaterialStorageComponent)
Tests if a specific amount of volume will fit in the storage.
Declaration
public bool CanTakeVolume(EntityUid uid, int volume, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.Int32 | volume | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Boolean | If the specified volume will fit |
GetMaterialAmount(EntityUid, MaterialPrototype, MaterialStorageComponent)
Gets the volume of a specified material contained in this storage.
Declaration
public int GetMaterialAmount(EntityUid uid, MaterialPrototype material, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
MaterialPrototype | material | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Int32 | The volume of the material |
GetMaterialAmount(EntityUid, String, MaterialStorageComponent)
Gets the volume of a specified material contained in this storage.
Declaration
public int GetMaterialAmount(EntityUid uid, string material, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String | material | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Int32 | The volume of the material |
GetTotalMaterialAmount(EntityUid, MaterialStorageComponent)
Gets the total volume of all materials in the storage.
Declaration
public int GetTotalMaterialAmount(EntityUid uid, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Int32 | The volume of all materials in the storage |
Initialize()
Declaration
public override void Initialize()
TryChangeMaterialAmount(EntityUid, String, Int32, MaterialStorageComponent)
Changes the amount of a specific material in the storage. Still respects the filters in place.
Declaration
public bool TryChangeMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
System.String | materialId | |
System.Int32 | volume | |
MaterialStorageComponent | component |
Returns
Type | Description |
---|---|
System.Boolean | If it was successful |
TryInsertMaterialEntity(EntityUid, EntityUid, EntityUid, MaterialStorageComponent, MaterialComponent, PhysicalCompositionComponent)
Tries to insert an entity into the material storage.
Declaration
public virtual bool TryInsertMaterialEntity(EntityUid user, EntityUid toInsert, EntityUid receiver, MaterialStorageComponent storage = null, MaterialComponent material = null, PhysicalCompositionComponent composition = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | user | |
EntityUid | toInsert | |
EntityUid | receiver | |
MaterialStorageComponent | storage | |
MaterialComponent | material | |
PhysicalCompositionComponent | composition |
Returns
Type | Description |
---|---|
System.Boolean |
TrySetMaterialAmount(EntityUid, String, Int32, MaterialStorageComponent)
Tries to set the amount of material in the storage to a specific value. Still respects the filters in place.
Declaration
public bool TrySetMaterialAmount(EntityUid uid, string materialId, int volume, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | The entity to change the material storage on. |
System.String | materialId | The ID of the material to change. |
System.Int32 | volume | The stored material volume to set the storage to. |
MaterialStorageComponent | component | The storage component on |
Returns
Type | Description |
---|---|
System.Boolean | True if it was successful (enough space etc). |
Update(Single)
Declaration
public override void Update(float frameTime)
Parameters
Type | Name | Description |
---|---|---|
System.Single | frameTime |
UpdateMaterialWhitelist(EntityUid, MaterialStorageComponent)
Broadcasts an event that will collect a list of which materials are allowed to be inserted into the materialStorage.
Declaration
public void UpdateMaterialWhitelist(EntityUid uid, MaterialStorageComponent component = null)
Parameters
Type | Name | Description |
---|---|---|
EntityUid | uid | |
MaterialStorageComponent | component |