diff --git a/Content.Client/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Client/GameObjects/Components/Projectiles/ProjectileComponent.cs
index d991ca7d97..934a49f13b 100644
--- a/Content.Client/GameObjects/Components/Projectiles/ProjectileComponent.cs
+++ b/Content.Client/GameObjects/Components/Projectiles/ProjectileComponent.cs
@@ -4,16 +4,14 @@ using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.Components.Projectiles
{
[RegisterComponent]
+ [ComponentReference(typeof(SharedProjectileComponent))]
public class ProjectileComponent : SharedProjectileComponent
{
- protected override EntityUid Shooter => _shooter;
- private EntityUid _shooter;
-
public override void HandleComponentState(ComponentState? curState, ComponentState? nextState)
{
if (curState is ProjectileComponentState compState)
{
- _shooter = compState.Shooter;
+ Shooter = compState.Shooter;
IgnoreShooter = compState.IgnoreShooter;
}
}
diff --git a/Content.Client/GameObjects/EntitySystems/BuckleSystem.cs b/Content.Client/GameObjects/EntitySystems/BuckleSystem.cs
new file mode 100644
index 0000000000..9175333750
--- /dev/null
+++ b/Content.Client/GameObjects/EntitySystems/BuckleSystem.cs
@@ -0,0 +1,9 @@
+using Content.Shared.GameObjects.EntitySystems;
+
+namespace Content.Client.GameObjects.EntitySystems
+{
+ internal sealed class BuckleSystem : SharedBuckleSystem
+ {
+
+ }
+}
diff --git a/Content.Client/GameObjects/EntitySystems/ClientDoorSystem.cs b/Content.Client/GameObjects/EntitySystems/DoorSystem.cs
similarity index 95%
rename from Content.Client/GameObjects/EntitySystems/ClientDoorSystem.cs
rename to Content.Client/GameObjects/EntitySystems/DoorSystem.cs
index b5b86592f8..fc6c8f0f7d 100644
--- a/Content.Client/GameObjects/EntitySystems/ClientDoorSystem.cs
+++ b/Content.Client/GameObjects/EntitySystems/DoorSystem.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using Content.Client.GameObjects.Components.Doors;
using Content.Shared.GameObjects.Components.Doors;
+using Content.Shared.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
namespace Content.Client.GameObjects.EntitySystems
@@ -9,7 +10,7 @@ namespace Content.Client.GameObjects.EntitySystems
///
/// Used by the client to "predict" when doors will change how collideable they are as part of their opening / closing.
///
- public class ClientDoorSystem : EntitySystem
+ internal sealed class DoorSystem : SharedDoorSystem
{
///
/// List of doors that need to be periodically checked.
diff --git a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
index 0aa22a85db..56e4c0b706 100644
--- a/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
+++ b/Content.Server/GameObjects/Components/Buckle/BuckleComponent.cs
@@ -413,12 +413,12 @@ namespace Content.Server.GameObjects.Components.Buckle
return new BuckleComponentState(Buckled, drawDepth, LastEntityBuckledTo, DontCollide);
}
- public void Update()
+ public void Update(PhysicsComponent physics)
{
- if (!DontCollide || Physics == null)
+ if (!DontCollide)
return;
- Physics.WakeBody();
+ physics.WakeBody();
if (!IsOnStrapEntityThisFrame && DontCollide)
{
diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs
index f17a5aa917..a80bc237ab 100644
--- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs
+++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs
@@ -231,7 +231,7 @@ namespace Content.Server.GameObjects.Components.Doors
// Disabled because it makes it suck hard to walk through double doors.
TryOpen(otherFixture.Body.Owner);
-
+
}
#region Opening
@@ -266,14 +266,14 @@ namespace Content.Server.GameObjects.Components.Doors
return true;
}
- var doorSystem = EntitySystem.Get();
+ var doorSystem = EntitySystem.Get();
var isAirlockExternal = HasAccessType("External");
return doorSystem.AccessType switch
{
- ServerDoorSystem.AccessTypes.AllowAll => true,
- ServerDoorSystem.AccessTypes.AllowAllIdExternal => isAirlockExternal || access.IsAllowed(user),
- ServerDoorSystem.AccessTypes.AllowAllNoExternal => !isAirlockExternal,
+ DoorSystem.AccessTypes.AllowAll => true,
+ DoorSystem.AccessTypes.AllowAllIdExternal => isAirlockExternal || access.IsAllowed(user),
+ DoorSystem.AccessTypes.AllowAllNoExternal => !isAirlockExternal,
_ => access.IsAllowed(user)
};
}
diff --git a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs
index db5f6bb54d..291d3418ef 100644
--- a/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs
+++ b/Content.Server/GameObjects/Components/Projectiles/ProjectileComponent.cs
@@ -15,11 +15,9 @@ using Robust.Shared.ViewVariables;
namespace Content.Server.GameObjects.Components.Projectiles
{
[RegisterComponent]
+ [ComponentReference(typeof(SharedProjectileComponent))]
public class ProjectileComponent : SharedProjectileComponent, IStartCollide
{
- protected override EntityUid Shooter => _shooter;
-
- private EntityUid _shooter = EntityUid.Invalid;
[DataField("damages")] private Dictionary _damages = new();
@@ -49,7 +47,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
///
public void IgnoreEntity(IEntity shooter)
{
- _shooter = shooter.Uid;
+ Shooter = shooter.Uid;
Dirty();
}
@@ -77,7 +75,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
if (damage != null)
{
- Owner.EntityManager.TryGetEntity(_shooter, out var shooter);
+ Owner.EntityManager.TryGetEntity(Shooter, out var shooter);
foreach (var (damageType, amount) in _damages)
{
@@ -100,7 +98,7 @@ namespace Content.Server.GameObjects.Components.Projectiles
public override ComponentState GetComponentState(ICommonSession player)
{
- return new ProjectileComponentState(NetID!.Value, _shooter, IgnoreShooter);
+ return new ProjectileComponentState(Shooter, IgnoreShooter);
}
}
}
diff --git a/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs b/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs
index fe728426cd..20c0e7b712 100644
--- a/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs
@@ -2,6 +2,7 @@
using Content.Server.GameObjects.Components.Buckle;
using Content.Server.GameObjects.Components.Strap;
using Content.Server.GameObjects.EntitySystems.Click;
+using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.Interfaces.GameObjects.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
@@ -11,7 +12,7 @@ using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
- internal sealed class BuckleSystem : EntitySystem
+ internal sealed class BuckleSystem : SharedBuckleSystem
{
public override void Initialize()
{
@@ -40,9 +41,9 @@ namespace Content.Server.GameObjects.EntitySystems
public override void Update(float frameTime)
{
- foreach (var comp in ComponentManager.EntityQuery())
+ foreach (var (buckle, physics) in ComponentManager.EntityQuery())
{
- comp.Update();
+ buckle.Update(physics);
}
}
diff --git a/Content.Server/GameObjects/EntitySystems/ServerDoorSystem.cs b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs
similarity index 92%
rename from Content.Server/GameObjects/EntitySystems/ServerDoorSystem.cs
rename to Content.Server/GameObjects/EntitySystems/DoorSystem.cs
index fa36dd111e..f02fd14dd0 100644
--- a/Content.Server/GameObjects/EntitySystems/ServerDoorSystem.cs
+++ b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs
@@ -1,4 +1,5 @@
#nullable enable
+using Content.Shared.GameObjects.EntitySystems;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
@@ -7,7 +8,7 @@ namespace Content.Server.GameObjects.EntitySystems
///
/// Used on the server side to manage global access level overrides.
///
- class ServerDoorSystem : EntitySystem
+ internal sealed class DoorSystem : SharedDoorSystem
{
///
/// Determines the base access behavior of all doors on the station.
diff --git a/Content.Server/GameTicking/GameRules/RuleSuspicion.cs b/Content.Server/GameTicking/GameRules/RuleSuspicion.cs
index be3fb1c94f..64a468f3a9 100644
--- a/Content.Server/GameTicking/GameRules/RuleSuspicion.cs
+++ b/Content.Server/GameTicking/GameRules/RuleSuspicion.cs
@@ -53,7 +53,7 @@ namespace Content.Server.GameTicking.GameRules
SoundSystem.Play(filter, "/Audio/Misc/tatoralert.ogg", AudioParams.Default);
EntitySystem.Get().EndTime = _endTime;
- EntitySystem.Get().AccessType = ServerDoorSystem.AccessTypes.AllowAllNoExternal;
+ EntitySystem.Get().AccessType = DoorSystem.AccessTypes.AllowAllNoExternal;
Timer.SpawnRepeating(DeadCheckDelay, CheckWinConditions, _checkTimerCancel.Token);
}
@@ -62,7 +62,7 @@ namespace Content.Server.GameTicking.GameRules
{
base.Removed();
- EntitySystem.Get().AccessType = ServerDoorSystem.AccessTypes.Id;
+ EntitySystem.Get().AccessType = DoorSystem.AccessTypes.Id;
EntitySystem.Get().EndTime = null;
_checkTimerCancel.Cancel();
diff --git a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
index 0d8a414779..613e9e7aa8 100644
--- a/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
+++ b/Content.Shared/GameObjects/Components/Buckle/SharedBuckleComponent.cs
@@ -13,14 +13,12 @@ using Robust.Shared.ViewVariables;
namespace Content.Shared.GameObjects.Components.Buckle
{
- public abstract class SharedBuckleComponent : Component, IActionBlocker, IEffectBlocker, IDraggable, ICollideSpecial
+ public abstract class SharedBuckleComponent : Component, IActionBlocker, IEffectBlocker, IDraggable
{
public sealed override string Name => "Buckle";
public sealed override uint? NetID => ContentNetIDs.BUCKLE;
- [ComponentDependency] protected readonly IPhysBody? Physics;
-
///
/// The range from which this entity can buckle to a .
///
@@ -41,17 +39,6 @@ namespace Content.Shared.GameObjects.Components.Buckle
public abstract bool TryBuckle(IEntity? user, IEntity to);
- bool ICollideSpecial.PreventCollide(IPhysBody collidedwith)
- {
- if (collidedwith.Owner.Uid == LastEntityBuckledTo)
- {
- IsOnStrapEntityThisFrame = true;
- return Buckled || DontCollide;
- }
-
- return false;
- }
-
bool IActionBlocker.CanMove()
{
return !Buckled;
diff --git a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs
index d69becb5f1..c3792ea86c 100644
--- a/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs
+++ b/Content.Shared/GameObjects/Components/Disposal/SharedDisposalUnitComponent.cs
@@ -1,25 +1,20 @@
#nullable enable
using System;
-using System.Collections.Generic;
using Content.Shared.GameObjects.Components.Body;
using Content.Shared.GameObjects.Components.Mobs.State;
using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.Interfaces.GameObjects.Components;
-using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
-using Robust.Shared.IoC;
using Robust.Shared.Physics;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Shared.GameObjects.Components.Disposal
{
- public abstract class SharedDisposalUnitComponent : Component, ICollideSpecial, IDragDropOn
+ public abstract class SharedDisposalUnitComponent : Component, IDragDropOn
{
public override string Name => "DisposalUnit";
- private readonly List _intersecting = new();
-
[ViewVariables]
public bool Anchored =>
!Owner.TryGetComponent(out IPhysBody? physics) ||
@@ -73,44 +68,9 @@ namespace Content.Shared.GameObjects.Components.Disposal
Pressurizing
}
- bool ICollideSpecial.PreventCollide(IPhysBody collided)
- {
- if (IsExiting(collided.Owner)) return true;
- if (!Owner.TryGetComponent(out IContainerManager? manager)) return false;
-
- if (manager.ContainsEntity(collided.Owner))
- {
- if (!_intersecting.Contains(collided.Owner))
- {
- _intersecting.Add(collided.Owner);
- }
- return true;
- }
- return false;
- }
-
public virtual void Update(float frameTime)
{
- UpdateIntersecting();
- }
-
- private bool IsExiting(IEntity entity)
- {
- return _intersecting.Contains(entity);
- }
-
- private void UpdateIntersecting()
- {
- if(_intersecting.Count == 0) return;
-
- // TODO: Yeah look this sucks but we'll fix it someday.
- for (var i = _intersecting.Count - 1; i >= 0; i--)
- {
- var entity = _intersecting[i];
-
- if (IoCManager.Resolve().IsIntersecting(entity, Owner))
- _intersecting.RemoveAt(i);
- }
+ return;
}
[Serializable, NetSerializable]
diff --git a/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs b/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs
index 94dd75340d..fcd8257514 100644
--- a/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs
+++ b/Content.Shared/GameObjects/Components/Doors/SharedDoorComponent.cs
@@ -11,7 +11,7 @@ using Robust.Shared.ViewVariables;
namespace Content.Shared.GameObjects.Components.Doors
{
- public abstract class SharedDoorComponent : Component, ICollideSpecial
+ public abstract class SharedDoorComponent : Component
{
public override string Name => "Door";
public override uint? NetID => ContentNetIDs.DOOR;
@@ -94,17 +94,16 @@ namespace Content.Shared.GameObjects.Components.Doors
///
protected List CurrentlyCrushing = new();
+ public bool IsCrushing(IEntity entity)
+ {
+ return CurrentlyCrushing.Contains(entity.Uid);
+ }
+
protected void SetAppearance(DoorVisualState state)
{
AppearanceComponent?.SetData(DoorVisuals.VisualState, state);
}
- // stops us colliding with people we're crushing, to prevent hitbox clipping and jank
- public bool PreventCollide(IPhysBody collidedwith)
- {
- return CurrentlyCrushing.Contains(collidedwith.Owner.Uid);
- }
-
///
/// Called when the door is partially opened.
///
diff --git a/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs b/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs
index a5938e482d..a2539c6b8e 100644
--- a/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs
+++ b/Content.Shared/GameObjects/Components/Projectiles/SharedProjectileComponent.cs
@@ -6,13 +6,13 @@ using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Projectiles
{
- public abstract class SharedProjectileComponent : Component, ICollideSpecial
+ public abstract class SharedProjectileComponent : Component
{
private bool _ignoreShooter = true;
public override string Name => "Projectile";
public override uint? NetID => ContentNetIDs.PROJECTILE;
- protected abstract EntityUid Shooter { get; }
+ public EntityUid Shooter { get; protected set; }
public bool IgnoreShooter
{
@@ -29,7 +29,7 @@ namespace Content.Shared.GameObjects.Components.Projectiles
[NetSerializable, Serializable]
protected class ProjectileComponentState : ComponentState
{
- public ProjectileComponentState(uint netId, EntityUid shooter, bool ignoreShooter) : base(netId)
+ public ProjectileComponentState(EntityUid shooter, bool ignoreShooter) : base(ContentNetIDs.PROJECTILE)
{
Shooter = shooter;
IgnoreShooter = ignoreShooter;
@@ -38,10 +38,5 @@ namespace Content.Shared.GameObjects.Components.Projectiles
public EntityUid Shooter { get; }
public bool IgnoreShooter { get; }
}
-
- public bool PreventCollide(IPhysBody collidedwith)
- {
- return IgnoreShooter && collidedwith.Owner.Uid == Shooter;
- }
}
}
diff --git a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs
index 604d6a9b46..0588496c4e 100644
--- a/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs
+++ b/Content.Shared/GameObjects/Components/Pulling/SharedPullableComponent.cs
@@ -18,7 +18,7 @@ using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Pulling
{
- public abstract class SharedPullableComponent : Component, ICollideSpecial, IRelayMoveInput
+ public abstract class SharedPullableComponent : Component, IRelayMoveInput
{
public override string Name => "Pullable";
public override uint? NetID => ContentNetIDs.PULLABLE;
@@ -358,16 +358,6 @@ namespace Content.Shared.GameObjects.Components.Pulling
base.OnRemove();
}
- public bool PreventCollide(IPhysBody collidedWith)
- {
- if (_puller == null || _physics == null)
- {
- return false;
- }
-
- return (_physics.CollisionLayer & collidedWith.CollisionMask) == (int) CollisionGroup.MobImpassable;
- }
-
// TODO: Need a component bus relay so all entities can use this and not just players
void IRelayMoveInput.MoveInputPressed(ICommonSession session)
{
diff --git a/Content.Shared/GameObjects/EntitySystems/ProjectileSystem.cs b/Content.Shared/GameObjects/EntitySystems/ProjectileSystem.cs
new file mode 100644
index 0000000000..d7f3fa49c7
--- /dev/null
+++ b/Content.Shared/GameObjects/EntitySystems/ProjectileSystem.cs
@@ -0,0 +1,24 @@
+using Content.Shared.GameObjects.Components.Projectiles;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Physics.Dynamics;
+
+namespace Content.Shared.GameObjects.EntitySystems
+{
+ public sealed class ProjectileSystem : EntitySystem
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent(PreventCollision);
+ }
+
+ private void PreventCollision(EntityUid uid, SharedProjectileComponent component, PreventCollideEvent args)
+ {
+ if (component.IgnoreShooter && args.BodyB.Owner.Uid == component.Shooter)
+ {
+ args.Cancel();
+ return;
+ }
+ }
+ }
+}
diff --git a/Content.Shared/GameObjects/EntitySystems/SharedBuckleSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedBuckleSystem.cs
new file mode 100644
index 0000000000..1634ff79c0
--- /dev/null
+++ b/Content.Shared/GameObjects/EntitySystems/SharedBuckleSystem.cs
@@ -0,0 +1,26 @@
+using Content.Shared.GameObjects.Components.Buckle;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Physics.Dynamics;
+
+namespace Content.Shared.GameObjects.EntitySystems
+{
+ public abstract class SharedBuckleSystem : EntitySystem
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent(PreventCollision);
+ }
+
+ private void PreventCollision(EntityUid uid, SharedBuckleComponent component, PreventCollideEvent args)
+ {
+ if (args.BodyB.Owner.Uid != component.LastEntityBuckledTo) return;
+
+ component.IsOnStrapEntityThisFrame = true;
+ if (component.Buckled || component.DontCollide)
+ {
+ args.Cancel();
+ }
+ }
+ }
+}
diff --git a/Content.Shared/GameObjects/EntitySystems/SharedDoorSystem.cs b/Content.Shared/GameObjects/EntitySystems/SharedDoorSystem.cs
new file mode 100644
index 0000000000..3fcd90dbee
--- /dev/null
+++ b/Content.Shared/GameObjects/EntitySystems/SharedDoorSystem.cs
@@ -0,0 +1,23 @@
+using Content.Shared.GameObjects.Components.Doors;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Physics.Dynamics;
+
+namespace Content.Shared.GameObjects.EntitySystems
+{
+ public abstract class SharedDoorSystem : EntitySystem
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ SubscribeLocalEvent(PreventCollision);
+ }
+
+ private void PreventCollision(EntityUid uid, SharedDoorComponent component, PreventCollideEvent args)
+ {
+ if (component.IsCrushing(args.BodyB.Owner))
+ {
+ args.Cancel();
+ }
+ }
+ }
+}