| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 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);
- }
- }
|