mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 05:27:38 +03:00
## Mirror of PR #25897: [Shuttle map IFF tweaks](https://github.com/space-wizards/space-station-14/pull/25897) from <img src="https://avatars.githubusercontent.com/u/10567778?v=4" alt="space-wizards" width="22"/> [space-wizards](https://github.com/space-wizards)/[space-station-14](https://github.com/space-wizards/space-station-14) ###### `a41772a006302bbe267793569b4b0d171eb82c87` PR opened by <img src="https://avatars.githubusercontent.com/u/31366439?v=4" width="16"/><a href="https://github.com/metalgearsloth"> metalgearsloth</a> at 2024-03-07 02:06:24 UTC PR merged by <img src="https://avatars.githubusercontent.com/u/19864447?v=4" width="16"/><a href="https://github.com/web-flow"> web-flow</a> at 2024-03-11 02:11:46 UTC --- PR changed 7 files with 32 additions and 9 deletions. The PR had the following labels: - Changes: UI --- <details open="true"><summary><h1>Original Body</h1></summary> > - HideLabel just means it won't have its name / button drawn whereas Hide will block it completely. > >  > > 🆑 > - tweak: Remove the buttons for generated debris from shuttle maps. > </details> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
94 lines
2.5 KiB
C#
94 lines
2.5 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)
|
|
{
|
|
if (!IFFComponent.ShowIFFDefault)
|
|
{
|
|
return 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);
|
|
}
|
|
}
|