conveyor & recycler ecs (#4537)

* conveyor done, recycler still todo

* done, just need to suss out the physics part. pinged sloth about it

* ship it
This commit is contained in:
Paul Ritter
2021-09-10 09:26:05 +02:00
committed by GitHub
parent 32d25431c0
commit 4c7670fe82
9 changed files with 208 additions and 300 deletions

View File

@@ -1,12 +1,17 @@
using System.Collections.Generic;
using Content.Server.Power.Components;
using Content.Server.Recycling.Components;
using Content.Shared.Body.Components;
using Content.Shared.Recycling;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Utility;
namespace Content.Server.Recycling
{
internal sealed class RecyclerSystem: EntitySystem
internal sealed class RecyclerSystem : EntitySystem
{
public override void Initialize()
{
@@ -21,11 +26,6 @@ namespace Content.Server.Recycling
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.
@@ -45,7 +45,8 @@ namespace Content.Server.Recycling
private bool CanGib(RecyclerComponent component, IEntity entity)
{
// We suppose this entity has a Recyclable component.
return entity.HasComponent<SharedBodyComponent>() && !component.Safe && component.Powered;
return entity.HasComponent<SharedBodyComponent>() && !component.Safe &&
component.Owner.TryGetComponent(out ApcPowerReceiverComponent? receiver) && receiver.Powered;
}
public void Bloodstain(RecyclerComponent component)