ECSatize AlertsSystem (#5559)

This commit is contained in:
Acruid
2022-01-05 00:19:23 -08:00
committed by GitHub
parent 36d4de5e61
commit 5b1cd2dd96
59 changed files with 1069 additions and 1038 deletions

View File

@@ -14,11 +14,11 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class RemoveCuffs : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player, out CuffableComponent? cuffableComponent))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out CuffableComponent? cuffableComponent))
{
cuffableComponent.TryUncuff(args.Player);
cuffableComponent.TryUncuff(player);
}
}
}

View File

@@ -1,4 +1,4 @@
using Content.Server.Atmos.Components;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Alert;
using JetBrains.Annotations;
@@ -15,11 +15,11 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class ResistFire : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player, out FlammableComponent? flammable))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out FlammableComponent? flammable))
{
EntitySystem.Get<FlammableSystem>().Resist(args.Player, flammable);
EntitySystem.Get<FlammableSystem>().Resist(player, flammable);
}
}
}

View File

@@ -16,12 +16,12 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class StopBeingPulled : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Player))
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(player))
return;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullableComponent?>(args.Player, out var playerPullable))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<SharedPullableComponent?>(player, out var playerPullable))
{
EntitySystem.Get<SharedPullingSystem>().TryStopPull(playerPullable);
}

View File

@@ -1,4 +1,4 @@
using Content.Server.Shuttles;
using Content.Server.Shuttles;
using Content.Server.Shuttles.EntitySystems;
using Content.Shared.Alert;
using Content.Shared.Shuttles;
@@ -17,9 +17,9 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class StopPiloting : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player, out PilotComponent? pilotComponent) &&
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out PilotComponent? pilotComponent) &&
pilotComponent.Console != null)
{
EntitySystem.Get<ShuttleConsoleSystem>().RemovePilot(pilotComponent);

View File

@@ -15,10 +15,10 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class StopPulling : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
var ps = EntitySystem.Get<SharedPullingSystem>();
var playerTarget = ps.GetPulled(args.Player);
var playerTarget = ps.GetPulled(player);
if (playerTarget != default && IoCManager.Resolve<IEntityManager>().TryGetComponent(playerTarget, out SharedPullableComponent playerPullable))
{
ps.TryStopPull(playerPullable);

View File

@@ -1,4 +1,4 @@
using Content.Server.Buckle.Components;
using Content.Server.Buckle.Components;
using Content.Shared.Alert;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
@@ -14,11 +14,11 @@ namespace Content.Server.Alert.Click
[DataDefinition]
public class Unbuckle : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
public void AlertClicked(EntityUid player)
{
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(args.Player, out BuckleComponent? buckle))
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(player, out BuckleComponent? buckle))
{
buckle.TryUnbuckle(args.Player);
buckle.TryUnbuckle(player);
}
}
}