CatStation/Content.Server/Materials/ServerTileReclaimerSystem.cs
SlamBamActionman 0cd76c7bac
Add industrial smelters (admin only) (#43651)
* Initial commit with shredder base functionality

* Fix items being deleted and make items continue moving after a grid tile gets deleted

* Make a bunch of previously unpullable/unrecyclable things work

* temp commit

* Fix the recycling hitbox to actually be good code

* Fix material spawning via tiles

* Finish up the prototype visuals for the shredder

* SHRED EVERYTHING

* Add reduced efficiency for recycling with shreder

* Fix miss in conflict merge

* Make more things pullable

* Update shredder textures to look different to recyclers

* Remove unused

* "fix" repairability and sprites

* Update sprites, set up TODO-s

* Fix switches, description

* Fix up some comments

* Add "Do Not Map" to the smelter

* Add to meta.json

* Review fixes

* Review changes

* Review changes

* Remove readonly in new system

* Aaaand partial class

* Fix the final test issues

* Update and resolve merge conflicts

* Update the impulse strength to match new mass values

* Fix issues after merge conflict

* Update size, fix physics resolve errors, prevent computers/circuitboards from being deleted

* Review comments

* Fix tiles giving steel

* Add a todo about tilestacking
2026-09-22 09:04:21 +00:00

26 lines
894 B
C#

using Content.Shared.Materials;
using Content.Shared.Maps;
namespace Content.Server.Materials;
/// <inheritdoc/>
public sealed partial class ServerTileReclaimerSystem : TileReclaimerSystem
{
[Dependency] private MaterialStorageSystem _materialStorage = default!;
protected override void SpawnMaterialsFromComposition(Entity<MaterialStorageComponent?, TransformComponent?> ent,
ContentTileDefinition tileDefinition,
float efficiency)
{
if (!Resolve(ent, ref ent.Comp1, ref ent.Comp2))
return;
foreach (var (material, amount) in tileDefinition.MaterialComposition)
{
var outputAmount = (int) (amount * efficiency);
_materialStorage.TryChangeMaterialAmount(ent, material, outputAmount, ent.Comp1);
}
_materialStorage.EjectAllMaterial(ent, ent.Comp2.Coordinates, ent.Comp1, true);
}
}