Singularity fixes (#4383)

* Singularity fixes

* Fix the rest

* Woops

* ahh

* Nerf singulo for now

* Final touchups for now

* Review
This commit is contained in:
metalgearsloth
2021-08-23 00:54:03 +10:00
committed by GitHub
parent 106a5078de
commit f472bbab88
17 changed files with 279 additions and 162 deletions

View File

@@ -4,11 +4,14 @@ using Content.Shared.Singularity.Components;
using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Dynamics;
namespace Content.Shared.Singularity
{
public abstract class SharedSingularitySystem : EntitySystem
{
public const string DeleteFixture = "DeleteCircle";
private float GetFalloff(int level)
{
return level switch
@@ -72,8 +75,7 @@ namespace Content.Shared.Singularity
}
if (physics != null &&
singularity.DeleteFixtureId != null &&
physics.GetFixture(singularity.DeleteFixtureId) is {Shape: PhysShapeCircle circle})
physics.GetFixture(DeleteFixture) is {Shape: PhysShapeCircle circle})
{
circle.Radius = value - 0.5f;
}
@@ -86,5 +88,24 @@ namespace Content.Shared.Singularity
singularity.Dirty();
}
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedSingularityComponent, PreventCollideEvent>(HandleFieldCollision);
}
private void HandleFieldCollision(EntityUid uid, SharedSingularityComponent component, PreventCollideEvent args)
{
var other = args.BodyB.Owner;
if ((!other.HasComponent<SharedContainmentFieldComponent>() &&
!other.HasComponent<SharedContainmentFieldGeneratorComponent>()) ||
component.Level >= 4)
{
args.Cancel();
return;
}
}
}
}