mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 14:07:53 +03:00
Uses the following Cherry-Picks: https://github.com/space-wizards/space-station-14/pull/26994 https://github.com/space-wizards/space-station-14/pull/26518 https://github.com/space-wizards/space-station-14/pull/26279 https://github.com/space-wizards/space-station-14/pull/24946 https://github.com/space-wizards/space-station-14/pull/27188 Requires: https://github.com/Simple-Station/Einstein-Engines/pull/535 https://github.com/Simple-Station/Einstein-Engines/pull/534 --------- Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Jake Huxell <JakeHuxell@pm.me> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: 0x6273 <0x40@keemail.me> Co-authored-by: DEATHB4DEFEAT <zachcaffee@outlook.com>
89 lines
2.4 KiB
C#
89 lines
2.4 KiB
C#
using Content.Shared.Shuttles.Components;
|
|
using JetBrains.Annotations;
|
|
|
|
namespace Content.Shared.Shuttles.Systems;
|
|
|
|
public abstract partial class SharedShuttleSystem
|
|
{
|
|
/*
|
|
* Handles the label visibility on radar controls. This can be hiding the label or applying other effects.
|
|
*/
|
|
|
|
protected virtual void UpdateIFFInterfaces(EntityUid gridUid, IFFComponent component) {}
|
|
|
|
public Color GetIFFColor(EntityUid gridUid, bool self = false, IFFComponent? component = null)
|
|
{
|
|
if (self)
|
|
{
|
|
return IFFComponent.SelfColor;
|
|
}
|
|
|
|
if (!Resolve(gridUid, ref component, false))
|
|
{
|
|
return IFFComponent.IFFColor;
|
|
}
|
|
|
|
return component.Color;
|
|
}
|
|
|
|
public string? GetIFFLabel(EntityUid gridUid, bool self = false, IFFComponent? component = null)
|
|
{
|
|
var entName = MetaData(gridUid).EntityName;
|
|
|
|
if (self)
|
|
{
|
|
return entName;
|
|
}
|
|
|
|
if (Resolve(gridUid, ref component, false) && (component.Flags & (IFFFlags.HideLabel | IFFFlags.Hide)) != 0x0)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return string.IsNullOrEmpty(entName) ? Loc.GetString("shuttle-console-unknown") : entName;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Sets the color for this grid to appear as on radar.
|
|
/// </summary>
|
|
[PublicAPI]
|
|
public void SetIFFColor(EntityUid gridUid, Color color, IFFComponent? component = null)
|
|
{
|
|
component ??= EnsureComp<IFFComponent>(gridUid);
|
|
|
|
if (component.Color.Equals(color))
|
|
return;
|
|
|
|
component.Color = color;
|
|
Dirty(gridUid, component);
|
|
UpdateIFFInterfaces(gridUid, component);
|
|
}
|
|
|
|
[PublicAPI]
|
|
public void AddIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? component = null)
|
|
{
|
|
component ??= EnsureComp<IFFComponent>(gridUid);
|
|
|
|
if ((component.Flags & flags) == flags)
|
|
return;
|
|
|
|
component.Flags |= flags;
|
|
Dirty(gridUid, component);
|
|
UpdateIFFInterfaces(gridUid, component);
|
|
}
|
|
|
|
[PublicAPI]
|
|
public void RemoveIFFFlag(EntityUid gridUid, IFFFlags flags, IFFComponent? component = null)
|
|
{
|
|
if (!Resolve(gridUid, ref component, false))
|
|
return;
|
|
|
|
if ((component.Flags & flags) == 0x0)
|
|
return;
|
|
|
|
component.Flags &= ~flags;
|
|
Dirty(gridUid, component);
|
|
UpdateIFFInterfaces(gridUid, component);
|
|
}
|
|
}
|