* Add data field for id card microwave behaviour (#28087) * Move replacement chance from ReplacementAccentComponent to ReplacementAccentPrototype (#28049) Move replacement chance to ReplacementAccentPrototype * Resolves Bible summon message being sent to all users (#28104) * Changed PopupEntity overload used to ensure message is only sent to user * Updated uid for PopupEntity call * Updating _popupSystem.PopupEntity call in AttemptSummon * Random book story generator refactor (#28082) * Randomized book overhaul * Fix prototype names * Improved setting paper content * Praise Ratvar * Fix activatable UI popup message spam (#28123) Fixed activatable UI popup message spam * Modify battery assert to avoid floating point errors (#28007) * Update component query benchmarks (#27967) * Add more component query benchmarks. * Rename benchmark * Use non-generic `TryComp()` for metadata & transform (#28133) * sleeper agent appear later into the round and only once (#28160) --------- Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: double_b <40827162+benjamin-burges@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using Content.Server.Shuttles.Components;
|
|
using Content.Shared.Shuttles.BUIStates;
|
|
using Content.Shared.Shuttles.Components;
|
|
using Content.Shared.Shuttles.Events;
|
|
|
|
namespace Content.Server.Shuttles.Systems;
|
|
|
|
public sealed partial class ShuttleSystem
|
|
{
|
|
private void InitializeIFF()
|
|
{
|
|
SubscribeLocalEvent<IFFConsoleComponent, AnchorStateChangedEvent>(OnIFFConsoleAnchor);
|
|
SubscribeLocalEvent<IFFConsoleComponent, IFFShowIFFMessage>(OnIFFShow);
|
|
SubscribeLocalEvent<IFFConsoleComponent, IFFShowVesselMessage>(OnIFFShowVessel);
|
|
}
|
|
|
|
private void OnIFFShow(EntityUid uid, IFFConsoleComponent component, IFFShowIFFMessage args)
|
|
{
|
|
if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid == null ||
|
|
(component.AllowedFlags & IFFFlags.HideLabel) == 0x0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!args.Show)
|
|
{
|
|
AddIFFFlag(xform.GridUid.Value, IFFFlags.HideLabel);
|
|
}
|
|
else
|
|
{
|
|
RemoveIFFFlag(xform.GridUid.Value, IFFFlags.HideLabel);
|
|
}
|
|
}
|
|
|
|
private void OnIFFShowVessel(EntityUid uid, IFFConsoleComponent component, IFFShowVesselMessage args)
|
|
{
|
|
if (!TryComp(uid, out TransformComponent? xform) || xform.GridUid == null ||
|
|
(component.AllowedFlags & IFFFlags.Hide) == 0x0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!args.Show)
|
|
{
|
|
AddIFFFlag(xform.GridUid.Value, IFFFlags.Hide);
|
|
}
|
|
else
|
|
{
|
|
RemoveIFFFlag(xform.GridUid.Value, IFFFlags.Hide);
|
|
}
|
|
}
|
|
|
|
private void OnIFFConsoleAnchor(EntityUid uid, IFFConsoleComponent component, ref AnchorStateChangedEvent args)
|
|
{
|
|
// If we anchor / re-anchor then make sure flags up to date.
|
|
if (!args.Anchored ||
|
|
!TryComp(uid, out TransformComponent? xform) ||
|
|
!TryComp<IFFComponent>(xform.GridUid, out var iff))
|
|
{
|
|
_uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState()
|
|
{
|
|
AllowedFlags = component.AllowedFlags,
|
|
Flags = IFFFlags.None,
|
|
});
|
|
}
|
|
else
|
|
{
|
|
_uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState()
|
|
{
|
|
AllowedFlags = component.AllowedFlags,
|
|
Flags = iff.Flags,
|
|
});
|
|
}
|
|
}
|
|
|
|
protected override void UpdateIFFInterfaces(EntityUid gridUid, IFFComponent component)
|
|
{
|
|
base.UpdateIFFInterfaces(gridUid, component);
|
|
|
|
var query = AllEntityQuery<IFFConsoleComponent, TransformComponent>();
|
|
while (query.MoveNext(out var uid, out var comp, out var xform))
|
|
{
|
|
if (xform.GridUid != gridUid)
|
|
continue;
|
|
|
|
_uiSystem.SetUiState(uid, IFFConsoleUiKey.Key, new IFFConsoleBoundUserInterfaceState()
|
|
{
|
|
AllowedFlags = comp.AllowedFlags,
|
|
Flags = component.Flags,
|
|
});
|
|
}
|
|
}
|
|
}
|