mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
# Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> Ports https://github.com/space-wizards/space-station-14/pull/32294 Ports https://github.com/ss14-harmony/ss14-harmony/pull/310 (and everything needed for it to function) Early-merges https://github.com/space-wizards/space-station-14/pull/34302 Adds the ability for multiple central command maps that get randomly selected. Tested and works. --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 Several contributors - add: Added a new central command map that is randomly picked alongside the old one (thank you to Spanky from Harmony) - add: Added Advanced SMES for mappers. - add: Added the atmospheric network monitor for seeing what the temperature, moles, and pressure is on every pipe everywhere through a computer. - add: Nukie med bundle now contains a compact defibrillator. - add: Ported a better mapping editor. - add: Added the throngler plushie. - remove: Removed the Throngler as a possible loot spawn for gamble crates. --------- Signed-off-by: sleepyyapril <123355664+sleepyyapril@users.noreply.github.com> (cherry picked from commit 9272f65b64392f66a7cd4fd7c84bb152dc93b65a)
156 lines
5.1 KiB
C#
156 lines
5.1 KiB
C#
using Content.Client.Decals;
|
|
using Content.Client.Markers;
|
|
using Content.Client.SubFloor;
|
|
using Content.Shared.Atmos.Components;
|
|
using Content.Shared.Doors.Components;
|
|
using Content.Shared.Tag;
|
|
using Robust.Client.UserInterface.Controllers;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Mapping;
|
|
|
|
public sealed class MappingVisibilityUIController : UIController
|
|
{
|
|
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
|
[Dependency] private readonly ILightManager _lightManager = default!;
|
|
|
|
private MappingVisibilityWindow? _window;
|
|
|
|
[ValidatePrototypeId<TagPrototype>]
|
|
private const string WallTag = "Wall";
|
|
|
|
[ValidatePrototypeId<TagPrototype>]
|
|
private const string CableTag = "Cable";
|
|
|
|
[ValidatePrototypeId<TagPrototype>]
|
|
private const string DisposalTag = "Disposal";
|
|
|
|
public void ToggleWindow()
|
|
{
|
|
EnsureWindow();
|
|
|
|
if (_window!.IsOpen)
|
|
{
|
|
_window.Close();
|
|
}
|
|
else
|
|
{
|
|
_window.Open();
|
|
}
|
|
}
|
|
|
|
private void EnsureWindow()
|
|
{
|
|
if (_window is { Disposed: false })
|
|
return;
|
|
|
|
_window = UIManager.CreateWindow<MappingVisibilityWindow>();
|
|
|
|
_window.Light.Pressed = _lightManager.Enabled;
|
|
_window.Light.OnPressed += args => _lightManager.Enabled = args.Button.Pressed;
|
|
|
|
_window.Fov.Pressed = _eyeManager.CurrentEye.DrawFov;
|
|
_window.Fov.OnPressed += args => _eyeManager.CurrentEye.DrawFov = args.Button.Pressed;
|
|
|
|
_window.Shadows.Pressed = _lightManager.DrawShadows;
|
|
_window.Shadows.OnPressed += args => _lightManager.DrawShadows = args.Button.Pressed;
|
|
|
|
_window.Entities.Pressed = true;
|
|
_window.Entities.OnPressed += OnToggleEntitiesPressed;
|
|
|
|
_window.Markers.Pressed = _entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible;
|
|
_window.Markers.OnPressed += args =>
|
|
{
|
|
_entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible = args.Button.Pressed;
|
|
};
|
|
|
|
_window.Walls.Pressed = true;
|
|
_window.Walls.OnPressed += args => ToggleWithTag(args, WallTag);
|
|
|
|
_window.Airlocks.Pressed = true;
|
|
_window.Airlocks.OnPressed += ToggleWithComp<AirlockComponent>;
|
|
|
|
_window.Decals.Pressed = true;
|
|
_window.Decals.OnPressed += _ =>
|
|
{
|
|
_entitySystemManager.GetEntitySystem<DecalSystem>().ToggleOverlay();
|
|
};
|
|
|
|
_window.SubFloor.Pressed = _entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll;
|
|
_window.SubFloor.OnPressed += OnToggleSubfloorPressed;
|
|
|
|
_window.Cables.Pressed = true;
|
|
_window.Cables.OnPressed += args => ToggleWithTag(args, CableTag);
|
|
|
|
_window.Disposal.Pressed = true;
|
|
_window.Disposal.OnPressed += args => ToggleWithTag(args, DisposalTag);
|
|
|
|
_window.Atmos.Pressed = true;
|
|
_window.Atmos.OnPressed += ToggleWithComp<PipeAppearanceComponent>;
|
|
|
|
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
|
}
|
|
|
|
private void OnToggleEntitiesPressed(BaseButton.ButtonEventArgs args)
|
|
{
|
|
var query = _entityManager.AllEntityQueryEnumerator<SpriteComponent>();
|
|
|
|
if (args.Button.Pressed && _window != null)
|
|
{
|
|
_window.Markers.Pressed = true;
|
|
_window.Walls.Pressed = true;
|
|
_window.Airlocks.Pressed = true;
|
|
}
|
|
else if (_window != null)
|
|
{
|
|
_window.Markers.Pressed = false;
|
|
_window.Walls.Pressed = false;
|
|
_window.Airlocks.Pressed = false;
|
|
}
|
|
|
|
while (query.MoveNext(out _, out var sprite))
|
|
{
|
|
sprite.Visible = args.Button.Pressed;
|
|
}
|
|
}
|
|
|
|
private void OnToggleSubfloorPressed(BaseButton.ButtonEventArgs args)
|
|
{
|
|
_entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll = args.Button.Pressed;
|
|
|
|
if (args.Button.Pressed && _window != null)
|
|
{
|
|
_window.Cables.Pressed = true;
|
|
_window.Atmos.Pressed = true;
|
|
_window.Disposal.Pressed = true;
|
|
}
|
|
}
|
|
|
|
private void ToggleWithComp<TComp>(BaseButton.ButtonEventArgs args) where TComp : IComponent
|
|
{
|
|
var query = _entityManager.AllEntityQueryEnumerator<TComp, SpriteComponent>();
|
|
|
|
while (query.MoveNext(out _, out _, out var sprite))
|
|
{
|
|
sprite.Visible = args.Button.Pressed;
|
|
}
|
|
}
|
|
|
|
private void ToggleWithTag(BaseButton.ButtonEventArgs args, ProtoId<TagPrototype> tag)
|
|
{
|
|
var query = _entityManager.AllEntityQueryEnumerator<TagComponent, SpriteComponent>();
|
|
var tagSystem = _entityManager.EntitySysManager.GetEntitySystem<TagSystem>();
|
|
|
|
while (query.MoveNext(out var uid, out _, out var sprite))
|
|
{
|
|
if (tagSystem.HasTag(uid, tag))
|
|
sprite.Visible = args.Button.Pressed;
|
|
}
|
|
}
|
|
}
|