diff --git a/Content.Server/Recycling/Components/RecyclerComponent.cs b/Content.Server/Recycling/Components/RecyclerComponent.cs
index fe3c60ed93..1b321641e6 100644
--- a/Content.Server/Recycling/Components/RecyclerComponent.cs
+++ b/Content.Server/Recycling/Components/RecyclerComponent.cs
@@ -27,7 +27,7 @@ namespace Content.Server.Recycling.Components
{
// TODO: Add sound and safe beep
[RegisterComponent]
- public class RecyclerComponent : Component, IStartCollide, ISuicideAct
+ public class RecyclerComponent : Component, ISuicideAct
{
public override string Name => "Recycler";
@@ -37,26 +37,18 @@ namespace Content.Server.Recycling.Components
/// Whether or not sentient beings will be recycled
///
[ViewVariables(VVAccess.ReadWrite)] [DataField("safe")]
- private bool _safe = true;
+ internal bool Safe = true;
///
/// The percentage of material that will be recovered
///
[ViewVariables(VVAccess.ReadWrite)] [DataField("efficiency")]
- private float _efficiency = 0.25f;
+ internal float Efficiency = 0.25f;
- private bool Powered =>
+ internal bool Powered =>
!Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) ||
receiver.Powered;
- private void Bloodstain()
- {
- if (Owner.TryGetComponent(out AppearanceComponent? appearance))
- {
- appearance.SetData(RecyclerVisuals.Bloody, true);
- }
- }
-
private void Clean()
{
if (Owner.TryGetComponent(out AppearanceComponent? appearance))
@@ -65,35 +57,6 @@ namespace Content.Server.Recycling.Components
}
}
- private bool CanGib(IEntity entity)
- {
- // We suppose this entity has a Recyclable component.
- return entity.HasComponent() && !_safe && Powered;
- }
-
- private void Recycle(IEntity entity)
- {
- if (!Intersecting.Contains(entity))
- {
- Intersecting.Add(entity);
- }
-
- // TODO: Prevent collision with recycled items
-
- // Can only recycle things that are recyclable... And also check the safety of the thing to recycle.
- if (!entity.TryGetComponent(out RecyclableComponent? recyclable) || !recyclable.Safe && _safe) return;
-
- // Mobs are a special case!
- if (CanGib(entity))
- {
- entity.GetComponent().Gib(true);
- Bloodstain();
- return;
- }
-
- recyclable.Recycle(_efficiency);
- }
-
public bool CanRun()
{
if (Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) &&
@@ -141,11 +104,6 @@ namespace Content.Server.Recycling.Components
return true;
}
- void IStartCollide.CollideWith(Fixture ourFixture, Fixture otherFixture, in Manifold manifold)
- {
- Recycle(otherFixture.Body.Owner);
- }
-
SuicideKind ISuicideAct.Suicide(IEntity victim, IChatManager chat)
{
var mind = victim.PlayerSession()?.ContentData()?.Mind;
@@ -163,7 +121,7 @@ namespace Content.Server.Recycling.Components
body.Gib(true);
}
- Bloodstain();
+ EntitySystem.Get().Bloodstain(this);
return SuicideKind.Bloodloss;
}
diff --git a/Content.Server/Recycling/RecyclerSystem.cs b/Content.Server/Recycling/RecyclerSystem.cs
new file mode 100644
index 0000000000..050f09a44c
--- /dev/null
+++ b/Content.Server/Recycling/RecyclerSystem.cs
@@ -0,0 +1,59 @@
+using Content.Server.Recycling.Components;
+using Content.Shared.Body.Components;
+using Content.Shared.Recycling;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Physics.Dynamics;
+
+namespace Content.Server.Recycling
+{
+ internal sealed class RecyclerSystem: EntitySystem
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent(HandleCollide);
+ }
+
+ private void HandleCollide(EntityUid uid, RecyclerComponent component, StartCollideEvent args)
+ {
+ Recycle(component, args.OtherFixture.Body.Owner);
+ }
+
+ private void Recycle(RecyclerComponent component, IEntity entity)
+ {
+ if (!component.Intersecting.Contains(entity))
+ {
+ component.Intersecting.Add(entity);
+ }
+
+ // TODO: Prevent collision with recycled items
+
+ // Can only recycle things that are recyclable... And also check the safety of the thing to recycle.
+ if (!entity.TryGetComponent(out RecyclableComponent? recyclable) || !recyclable.Safe && component.Safe) return;
+
+ // Mobs are a special case!
+ if (CanGib(component, entity))
+ {
+ entity.GetComponent().Gib(true);
+ Bloodstain(component);
+ return;
+ }
+
+ recyclable.Recycle(component.Efficiency);
+ }
+
+ private bool CanGib(RecyclerComponent component, IEntity entity)
+ {
+ // We suppose this entity has a Recyclable component.
+ return entity.HasComponent() && !component.Safe && component.Powered;
+ }
+
+ public void Bloodstain(RecyclerComponent component)
+ {
+ if (component.Owner.TryGetComponent(out SharedAppearanceComponent? appearance))
+ {
+ appearance.SetData(RecyclerVisuals.Bloody, true);
+ }
+ }
+ }
+}