Add logging for hacking (#12861)
This commit is contained in:
@@ -13,6 +13,11 @@ public sealed class AccessWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "ACC";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
[DataField("pulseTimeout")]
|
||||
private int _pulseTimeout = 30;
|
||||
@@ -39,6 +44,7 @@ public sealed class AccessWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access))
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
@@ -50,6 +56,7 @@ public sealed class AccessWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access))
|
||||
{
|
||||
access.Enabled = true;
|
||||
@@ -60,6 +67,7 @@ public sealed class AccessWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AccessReaderComponent>(wire.Owner, out var access))
|
||||
{
|
||||
access.Enabled = false;
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace Content.Server.Arcade;
|
||||
public sealed class ArcadePlayerInvincibleWireAction : BaseToggleWireAction
|
||||
{
|
||||
private string _text = "MNGR";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
private Color _color = Color.Purple;
|
||||
|
||||
public override object? StatusKey { get; } = SharedSpaceVillainArcadeComponent.Indicators.HealthManager;
|
||||
|
||||
@@ -10,6 +10,11 @@ public sealed class ArcadeOverflowWireAction : BaseToggleWireAction
|
||||
{
|
||||
private Color _color = Color.Red;
|
||||
private string _text = "LMTR";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
public override object? StatusKey { get; } = SharedSpaceVillainArcadeComponent.Indicators.HealthLimiter;
|
||||
|
||||
|
||||
@@ -11,6 +11,11 @@ namespace Content.Server.Atmos.Monitor;
|
||||
public sealed class AirAlarmPanicWire : BaseWireAction
|
||||
{
|
||||
private string _text = "PANC";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
private Color _color = Color.Red;
|
||||
|
||||
private AirAlarmSystem _airAlarmSystem = default!;
|
||||
@@ -42,6 +47,7 @@ public sealed class AirAlarmPanicWire : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet))
|
||||
{
|
||||
_airAlarmSystem.SetMode(wire.Owner, devNet.Address, AirAlarmMode.Panic, false);
|
||||
@@ -52,6 +58,7 @@ public sealed class AirAlarmPanicWire : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet)
|
||||
&& EntityManager.TryGetComponent<AirAlarmComponent>(wire.Owner, out var alarm)
|
||||
&& alarm.CurrentMode == AirAlarmMode.Panic)
|
||||
@@ -65,6 +72,7 @@ public sealed class AirAlarmPanicWire : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<DeviceNetworkComponent>(wire.Owner, out var devNet))
|
||||
{
|
||||
_airAlarmSystem.SetMode(wire.Owner, devNet.Address, AirAlarmMode.Panic, false);
|
||||
|
||||
@@ -15,6 +15,11 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
private bool _alarmOnPulse = false;
|
||||
|
||||
private string _text = "NETW";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
private Color _color = Color.Orange;
|
||||
|
||||
private AtmosAlarmableSystem _atmosAlarmableSystem = default!;
|
||||
@@ -52,6 +57,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AtmosAlarmableComponent>(wire.Owner, out var monitor))
|
||||
{
|
||||
monitor.IgnoreAlarms = true;
|
||||
@@ -62,6 +68,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AtmosAlarmableComponent>(wire.Owner, out var monitor))
|
||||
{
|
||||
monitor.IgnoreAlarms = false;
|
||||
@@ -72,6 +79,7 @@ public sealed class AtmosMonitorDeviceNetWire : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (_alarmOnPulse)
|
||||
{
|
||||
_atmosAlarmableSystem.ForceAlert(wire.Owner, AtmosAlarmType.Danger);
|
||||
|
||||
@@ -13,6 +13,11 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "BLIT";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
public override StatusLightData? GetStatusLightData(Wire wire)
|
||||
{
|
||||
@@ -34,6 +39,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = false;
|
||||
@@ -44,6 +50,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = true;
|
||||
@@ -54,6 +61,7 @@ public sealed class DoorBoltLightWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltLightsVisible = !door.BoltLightsEnabled;
|
||||
|
||||
@@ -13,6 +13,11 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "BOLT";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
public override StatusLightData? GetStatusLightData(Wire wire)
|
||||
{
|
||||
@@ -36,6 +41,7 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.BoltWireCut = true;
|
||||
@@ -48,6 +54,7 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
door.BoltWireCut = false;
|
||||
|
||||
@@ -56,6 +63,7 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
if (IsPowered(wire.Owner))
|
||||
|
||||
@@ -13,6 +13,11 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "SAFE";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
[DataField("timeout")]
|
||||
private int _timeout = 30;
|
||||
@@ -38,6 +43,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
@@ -49,6 +55,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.Safety = true;
|
||||
@@ -59,6 +66,7 @@ public sealed class DoorSafetyWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.Safety = false;
|
||||
|
||||
@@ -13,6 +13,11 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "TIMR";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
[DataField("timeout")]
|
||||
private int _timeout = 30;
|
||||
@@ -47,6 +52,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PulseTimeoutKey.Key);
|
||||
@@ -58,6 +64,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.AutoCloseDelayModifier = 1f;
|
||||
@@ -68,6 +75,7 @@ public sealed class DoorTimingWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
door.AutoCloseDelayModifier = 0.5f;
|
||||
|
||||
@@ -16,6 +16,11 @@ public sealed class PowerWireAction : BaseWireAction
|
||||
|
||||
[DataField("name")]
|
||||
private string _text = "POWR";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
|
||||
[DataField("pulseTimeout")]
|
||||
private int _pulseTimeout = 30;
|
||||
@@ -200,6 +205,7 @@ public sealed class PowerWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (!TrySetElectrocution(user, wire))
|
||||
return false;
|
||||
|
||||
@@ -212,6 +218,7 @@ public sealed class PowerWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (!TrySetElectrocution(user, wire))
|
||||
return false;
|
||||
|
||||
@@ -228,6 +235,7 @@ public sealed class PowerWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
WiresSystem.TryCancelWireAction(wire.Owner, PowerWireActionKey.ElectrifiedCancel);
|
||||
|
||||
var electrocuted = !TrySetElectrocution(user, wire, true);
|
||||
|
||||
@@ -11,6 +11,11 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
||||
|
||||
private Color _color = Color.Red;
|
||||
private string _text = "VEND";
|
||||
protected override string Text
|
||||
{
|
||||
get => _text;
|
||||
set => _text = value;
|
||||
}
|
||||
public override object? StatusKey { get; } = EjectWireKey.StatusKey;
|
||||
|
||||
public override StatusLightData? GetStatusLightData(Wire wire)
|
||||
@@ -40,6 +45,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
_vendingMachineSystem.SetShooting(wire.Owner, true, vending);
|
||||
@@ -50,6 +56,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
if (EntityManager.TryGetComponent(wire.Owner, out VendingMachineComponent? vending))
|
||||
{
|
||||
_vendingMachineSystem.SetShooting(wire.Owner, false, vending);
|
||||
@@ -60,6 +67,7 @@ public sealed class VendingMachineEjectItemWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
_vendingMachineSystem.EjectRandom(wire.Owner, true);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -29,6 +29,7 @@ public abstract class BaseToggleWireAction : BaseWireAction
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
ToggleValue(wire.Owner, false);
|
||||
|
||||
if (TimeoutKey != null)
|
||||
@@ -41,6 +42,7 @@ public abstract class BaseToggleWireAction : BaseWireAction
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
ToggleValue(wire.Owner, true);
|
||||
|
||||
return true;
|
||||
@@ -48,6 +50,7 @@ public abstract class BaseToggleWireAction : BaseWireAction
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
ToggleValue(wire.Owner, !GetValue(wire.Owner));
|
||||
|
||||
if (TimeoutKey != null)
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.EntitySystems;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.Wires;
|
||||
|
||||
namespace Content.Server.Wires;
|
||||
@@ -7,6 +9,13 @@ namespace Content.Server.Wires;
|
||||
/// <summary><see cref="IWireAction" /></summary>
|
||||
public abstract class BaseWireAction : IWireAction
|
||||
{
|
||||
private ISharedAdminLogManager _adminLogger = default!;
|
||||
protected virtual string Text
|
||||
{
|
||||
get => GetType().Name.Replace("WireAction", "");
|
||||
set { }
|
||||
}
|
||||
|
||||
public IEntityManager EntityManager = default!;
|
||||
public WiresSystem WiresSystem = default!;
|
||||
|
||||
@@ -17,14 +26,27 @@ public abstract class BaseWireAction : IWireAction
|
||||
public virtual void Initialize()
|
||||
{
|
||||
EntityManager = IoCManager.Resolve<IEntityManager>();
|
||||
_adminLogger = IoCManager.Resolve<ISharedAdminLogManager>();
|
||||
|
||||
WiresSystem = EntityManager.EntitySysManager.GetEntitySystem<WiresSystem>();
|
||||
}
|
||||
|
||||
public virtual bool AddWire(Wire wire, int count) => count == 1;
|
||||
public abstract bool Cut(EntityUid user, Wire wire);
|
||||
public abstract bool Mend(EntityUid user, Wire wire);
|
||||
public abstract bool Pulse(EntityUid user, Wire wire);
|
||||
public virtual bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{EntityManager.ToPrettyString(user):player} cut {wire.Color.Name()} {Text} in {EntityManager.ToPrettyString(wire.Owner)}");
|
||||
return false;
|
||||
}
|
||||
public virtual bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{EntityManager.ToPrettyString(user):player} mended {wire.Color.Name()} {Text} in {EntityManager.ToPrettyString(wire.Owner)}");
|
||||
return false;
|
||||
}
|
||||
public virtual bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
_adminLogger.Add(LogType.Action, LogImpact.Medium, $"{EntityManager.ToPrettyString(user):player} pulsed {wire.Color.Name()} {Text} in {EntityManager.ToPrettyString(wire.Owner)}");
|
||||
return false;
|
||||
}
|
||||
public virtual void Update(Wire wire)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -15,9 +15,24 @@ public sealed class DummyWireAction : BaseWireAction
|
||||
|
||||
public override StatusLightData? GetStatusLightData(Wire wire) => null;
|
||||
public override bool AddWire(Wire wire, int count) => true;
|
||||
public override bool Cut(EntityUid user, Wire wire) => true;
|
||||
public override bool Mend(EntityUid user, Wire wire) => true;
|
||||
public override bool Pulse(EntityUid user, Wire wire) => true;
|
||||
|
||||
public override bool Cut(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Cut(user, wire);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Mend(user, wire);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool Pulse(EntityUid user, Wire wire)
|
||||
{
|
||||
base.Pulse(user, wire);
|
||||
return true;
|
||||
}
|
||||
|
||||
// doesn't matter if you get any information off of this,
|
||||
// if you really want to mess with dummy wires, you should
|
||||
|
||||
Reference in New Issue
Block a user