mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # 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]? --> port bar sings selection, as well as corrections for the same from wizards. prs: https://github.com/space-wizards/space-station-14/pull/29068 https://github.com/space-wizards/space-station-14/pull/33467 https://github.com/space-wizards/space-station-14/pull/35490 https://github.com/space-wizards/space-station-14/pull/31517 https://github.com/space-wizards/space-station-14/pull/35296 --- # TODO <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [x] Task - [x] Completed Task --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p>   </p> </details> --- # 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 --> 🆑 EmoGarbage404, Winkarst-cpu, robinthedragon, spderman3333, lzk228 and Will-Oliver-Br - add: The design on the bar sign can now be changed via a menu. - add: Bar signs now have a maintenance panel and AI can interact with them. - add: New barsign Maltroach (based on sign by MoffNyan, from tgstation) - tweak: Electronic bar signs can now be destroyed. - fix: Fix stray pixel in officer beersky barsign --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com> Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: spderman3333 <118777573+spderman3333@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: robinthedragon <92946919+robinthedragon@users.noreply.github.com> (cherry picked from commit 7f00e12904dee186ca356c8df3a8577b6c8d8ceb)
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Linq;
|
|
using Content.Shared.BarSign;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.BarSign.Ui;
|
|
|
|
[UsedImplicitly]
|
|
public sealed class BarSignBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey)
|
|
{
|
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
|
|
|
private BarSignMenu? _menu;
|
|
|
|
protected override void Open()
|
|
{
|
|
base.Open();
|
|
|
|
var sign = EntMan.GetComponentOrNull<BarSignComponent>(Owner)?.Current is { } current
|
|
? _prototype.Index(current)
|
|
: null;
|
|
var allSigns = Shared.BarSign.BarSignSystem.GetAllBarSigns(_prototype)
|
|
.OrderBy(p => Loc.GetString(p.Name))
|
|
.ToList();
|
|
_menu = new(sign, allSigns);
|
|
|
|
_menu.OnSignSelected += id =>
|
|
{
|
|
SendMessage(new SetBarSignMessage(id));
|
|
};
|
|
|
|
_menu.OnClose += Close;
|
|
_menu.OpenCentered();
|
|
}
|
|
|
|
public void Update(ProtoId<BarSignPrototype>? sign)
|
|
{
|
|
if (_prototype.TryIndex(sign, out var signPrototype))
|
|
_menu?.UpdateState(signPrototype);
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
if (!disposing)
|
|
return;
|
|
_menu?.Dispose();
|
|
}
|
|
}
|
|
|