2023-01-03 17:13:10 -06:00
|
|
|
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Components;
|
|
|
|
|
|
using Content.Server.Xenoarchaeology.XenoArtifacts.Events;
|
|
|
|
|
|
using Content.Shared.Physics;
|
|
|
|
|
|
using Robust.Shared.Physics;
|
2023-01-11 02:16:16 -06:00
|
|
|
|
using Robust.Shared.Physics.Components;
|
2023-01-03 17:13:10 -06:00
|
|
|
|
using Robust.Shared.Physics.Dynamics;
|
2023-01-11 02:16:16 -06:00
|
|
|
|
using Robust.Shared.Physics.Systems;
|
2023-01-03 17:13:10 -06:00
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Xenoarchaeology.XenoArtifacts.Effects.Systems;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Handles allowing activated artifacts to phase through walls.
|
|
|
|
|
|
/// </summary>
|
2023-01-11 02:16:16 -06:00
|
|
|
|
public sealed class PhasingArtifactSystem : EntitySystem
|
2023-01-03 17:13:10 -06:00
|
|
|
|
{
|
2023-01-11 02:16:16 -06:00
|
|
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
|
|
|
|
|
2023-01-03 17:13:10 -06:00
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
|
{
|
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
|
2023-01-11 02:16:16 -06:00
|
|
|
|
SubscribeLocalEvent<PhasingArtifactComponent, ArtifactActivatedEvent>(OnActivate);
|
2023-01-03 17:13:10 -06:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-11 02:16:16 -06:00
|
|
|
|
private void OnActivate(EntityUid uid, PhasingArtifactComponent component, ArtifactActivatedEvent args)
|
2023-01-03 17:13:10 -06:00
|
|
|
|
{
|
2023-01-15 15:38:59 +11:00
|
|
|
|
if (!TryComp<FixturesComponent>(uid, out var fixtures))
|
2023-01-03 17:13:10 -06:00
|
|
|
|
return;
|
|
|
|
|
|
|
2023-01-15 15:38:59 +11:00
|
|
|
|
foreach (var fixture in fixtures.Fixtures.Values)
|
2023-01-03 17:13:10 -06:00
|
|
|
|
{
|
2023-01-15 15:38:59 +11:00
|
|
|
|
_physics.SetHard(uid, fixture, false, fixtures);
|
2023-01-03 17:13:10 -06:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|