The disposals pushing and pulling update (#1875)
* Add collision to disposal unit and pipes Make disposal unit and pipes pullable Implement proper handling of collisions in disposals * Implement IsExiting Move DisposalSystem to shared * Change SharedDisosalUnitComponent to call manager.ContainsEntity directly * Update saltern.yml Co-authored-by: Julian Giebel <j.giebel@netrocks.info>
This commit is contained in:
@@ -24,7 +24,6 @@ using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
{
|
||||
// TODO: Make unanchored pipes pullable
|
||||
public abstract class DisposalTubeComponent : Component, IDisposalTubeComponent, IBreakAct
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
@@ -182,6 +181,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
return;
|
||||
}
|
||||
|
||||
collidable.CanCollide = !collidable.Anchored;
|
||||
|
||||
if (collidable.Anchored)
|
||||
{
|
||||
OnAnchor();
|
||||
@@ -220,6 +221,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
||||
|
||||
collidable.AnchoredChanged += AnchoredChanged;
|
||||
|
||||
collidable.CanCollide = !collidable.Anchored;
|
||||
}
|
||||
|
||||
protected override void Startup()
|
||||
|
||||
@@ -29,6 +29,7 @@ using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timers.Timer;
|
||||
@@ -36,6 +37,7 @@ using Timer = Robust.Shared.Timers.Timer;
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedDisposalUnitComponent))]
|
||||
[ComponentReference(typeof(IInteractUsing))]
|
||||
public class DisposalUnitComponent : SharedDisposalUnitComponent, IInteractHand, IInteractUsing, IDragDropOn
|
||||
{
|
||||
@@ -429,8 +431,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
: LightState.Ready);
|
||||
}
|
||||
|
||||
public void Update(float frameTime)
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
if (!Powered)
|
||||
{
|
||||
return;
|
||||
@@ -512,10 +515,15 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
Owner.EnsureComponent<AnchorableComponent>();
|
||||
if(!Owner.HasComponent<AnchorableComponent>())
|
||||
{
|
||||
Logger.WarningS("VitalComponentMissing", $"Disposal unit {Owner.Uid} is missing an anchorable component");
|
||||
}
|
||||
|
||||
var collidable = Owner.EnsureComponent<CollidableComponent>();
|
||||
collidable.AnchoredChanged += UpdateVisualState;
|
||||
if (Owner.TryGetComponent(out CollidableComponent? collidable))
|
||||
{
|
||||
collidable.AnchoredChanged += UpdateVisualState;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out PowerReceiverComponent? receiver))
|
||||
{
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
using Content.Server.GameObjects.Components.Disposal;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
|
||||
namespace Content.Server.GameObjects.EntitySystems
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class DisposalUnitSystem : EntitySystem
|
||||
{
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var comp in ComponentManager.EntityQuery<DisposalUnitComponent>())
|
||||
{
|
||||
comp.Update(frameTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user