Material Reclaimer (#14969)
* Material Reclaimer * Fix this test * autostack output, tweak volume, add upgrade examine * whitelist AND blacklist support why not * trying so hard to get this fucking test to work * EmoGarbage delves into MaterialArbitrageTest, never to return * VV and restore cloth to glory * make the system more robust * even more stuff has composition; add blacklist for important items * fix test fails * convert recycling * forgor :sadge: * lol * simply a modiCUM of doc commentary
This commit is contained in:
@@ -48,9 +48,9 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
|
||||
return false;
|
||||
if (!base.TryInsertMaterialEntity(user, toInsert, receiver, component))
|
||||
return false;
|
||||
_audio.PlayPvs(component.InsertingSound, component.Owner);
|
||||
_popup.PopupEntity(Loc.GetString("machine-insert-item", ("user", user), ("machine", component.Owner),
|
||||
("item", toInsert)), component.Owner);
|
||||
_audio.PlayPvs(component.InsertingSound, receiver);
|
||||
_popup.PopupEntity(Loc.GetString("machine-insert-item", ("user", user), ("machine", receiver),
|
||||
("item", toInsert)), receiver);
|
||||
QueueDel(toInsert);
|
||||
|
||||
// Logging
|
||||
@@ -67,16 +67,9 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
|
||||
/// 1 biomass = 1 biomass in its stack,
|
||||
/// but 100 plasma = 1 sheet of plasma, etc.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public List<EntityUid> SpawnMultipleFromMaterial(int amount, string material, EntityCoordinates coordinates)
|
||||
{
|
||||
if (!_prototypeManager.TryIndex<MaterialPrototype>(material, out var stackType))
|
||||
{
|
||||
Logger.Error("Failed to index material prototype " + material);
|
||||
return new List<EntityUid>();
|
||||
}
|
||||
|
||||
return SpawnMultipleFromMaterial(amount, stackType, coordinates);
|
||||
return SpawnMultipleFromMaterial(amount, material, coordinates, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -85,8 +78,40 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
|
||||
/// 1 biomass = 1 biomass in its stack,
|
||||
/// but 100 plasma = 1 sheet of plasma, etc.
|
||||
/// </summary>
|
||||
public List<EntityUid> SpawnMultipleFromMaterial(int amount, string material, EntityCoordinates coordinates, out int overflowMaterial)
|
||||
{
|
||||
overflowMaterial = 0;
|
||||
if (!_prototypeManager.TryIndex<MaterialPrototype>(material, out var stackType))
|
||||
{
|
||||
Logger.Error("Failed to index material prototype " + material);
|
||||
return new List<EntityUid>();
|
||||
}
|
||||
|
||||
return SpawnMultipleFromMaterial(amount, stackType, coordinates, out overflowMaterial);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawn an amount of a material in stack entities.
|
||||
/// Note the 'amount' is material dependent.
|
||||
/// 1 biomass = 1 biomass in its stack,
|
||||
/// but 100 plasma = 1 sheet of plasma, etc.
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public List<EntityUid> SpawnMultipleFromMaterial(int amount, MaterialPrototype materialProto, EntityCoordinates coordinates)
|
||||
{
|
||||
return SpawnMultipleFromMaterial(amount, materialProto, coordinates, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Spawn an amount of a material in stack entities.
|
||||
/// Note the 'amount' is material dependent.
|
||||
/// 1 biomass = 1 biomass in its stack,
|
||||
/// but 100 plasma = 1 sheet of plasma, etc.
|
||||
/// </summary>
|
||||
public List<EntityUid> SpawnMultipleFromMaterial(int amount, MaterialPrototype materialProto, EntityCoordinates coordinates, out int overflowMaterial)
|
||||
{
|
||||
overflowMaterial = 0;
|
||||
|
||||
if (amount <= 0)
|
||||
return new List<EntityUid>();
|
||||
|
||||
@@ -96,6 +121,7 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
|
||||
|
||||
var materialPerStack = material.Materials[materialProto.ID];
|
||||
var amountToSpawn = amount / materialPerStack;
|
||||
overflowMaterial = amount - amountToSpawn * materialPerStack;
|
||||
return _stackSystem.SpawnMultiple(materialProto.StackEntity, amountToSpawn, coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user