2021-12-30 22:56:10 +01:00
|
|
|
using Content.Server.Atmos.Components;
|
2021-10-05 14:29:03 +11:00
|
|
|
using Content.Server.Clothing.Components;
|
2021-12-30 22:56:10 +01:00
|
|
|
using Content.Shared.Alert;
|
2022-02-26 18:24:08 +13:00
|
|
|
using Content.Shared.Clothing;
|
2021-12-30 22:56:10 +01:00
|
|
|
using Content.Shared.Inventory.Events;
|
2021-10-05 14:29:03 +11:00
|
|
|
|
|
|
|
|
namespace Content.Server.Clothing
|
|
|
|
|
{
|
2022-02-26 18:24:08 +13:00
|
|
|
public sealed class MagbootsSystem : SharedMagbootsSystem
|
2021-10-05 14:29:03 +11:00
|
|
|
{
|
2022-01-05 00:19:23 -08:00
|
|
|
[Dependency] private readonly AlertsSystem _alertsSystem = default!;
|
|
|
|
|
|
2021-10-05 14:29:03 +11:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2021-12-30 22:56:10 +01:00
|
|
|
SubscribeLocalEvent<MagbootsComponent, GotEquippedEvent>(OnGotEquipped);
|
|
|
|
|
SubscribeLocalEvent<MagbootsComponent, GotUnequippedEvent>(OnGotUnequipped);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void UpdateMagbootEffects(EntityUid parent, EntityUid uid, bool state, MagbootsComponent? component)
|
|
|
|
|
{
|
|
|
|
|
if (!Resolve(uid, ref component))
|
|
|
|
|
return;
|
|
|
|
|
state = state && component.On;
|
|
|
|
|
|
|
|
|
|
if (TryComp(parent, out MovedByPressureComponent? movedByPressure))
|
|
|
|
|
{
|
2022-04-23 15:47:30 +12:00
|
|
|
movedByPressure.Enabled = !state;
|
2021-12-30 22:56:10 +01:00
|
|
|
}
|
|
|
|
|
|
2022-01-05 00:19:23 -08:00
|
|
|
if (state)
|
|
|
|
|
{
|
|
|
|
|
_alertsSystem.ShowAlert(parent, AlertType.Magboots);
|
|
|
|
|
}
|
|
|
|
|
else
|
2021-12-30 22:56:10 +01:00
|
|
|
{
|
2022-01-05 00:19:23 -08:00
|
|
|
_alertsSystem.ClearAlert(parent, AlertType.Magboots);
|
2021-12-30 22:56:10 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnGotUnequipped(EntityUid uid, MagbootsComponent component, GotUnequippedEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Slot == "shoes")
|
|
|
|
|
{
|
2021-12-31 10:41:08 +01:00
|
|
|
UpdateMagbootEffects(args.Equipee, uid, false, component);
|
2021-12-30 22:56:10 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnGotEquipped(EntityUid uid, MagbootsComponent component, GotEquippedEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Slot == "shoes")
|
|
|
|
|
{
|
2021-12-31 10:41:08 +01:00
|
|
|
UpdateMagbootEffects(args.Equipee, uid, true, component);
|
2021-12-30 22:56:10 +01:00
|
|
|
}
|
2021-11-07 22:17:35 -07:00
|
|
|
}
|
2021-10-05 14:29:03 +11:00
|
|
|
}
|
|
|
|
|
}
|