Skip to content

Commit

Permalink
Merge branch 'upstream-merge' into 'arumoon-server'
Browse files Browse the repository at this point in the history
Upstream (Now with replays) + TG Maps update

See merge request Workbench-Team/space-station-14!92
  • Loading branch information
AruMoon committed Jul 28, 2023
2 parents 350ef8f + 5740e63 commit e91564a
Show file tree
Hide file tree
Showing 717 changed files with 206,133 additions and 215,508 deletions.
6 changes: 4 additions & 2 deletions Content.Client/Access/AccessOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ public sealed class AccessOverlay : Overlay
{
private readonly IEntityManager _entityManager;
private readonly EntityLookupSystem _lookup;
private readonly SharedTransformSystem _xform;
private readonly Font _font;

public override OverlaySpace Space => OverlaySpace.ScreenSpace;

public AccessOverlay(IEntityManager entManager, IResourceCache cache, EntityLookupSystem lookup)
public AccessOverlay(IEntityManager entManager, IResourceCache cache, EntityLookupSystem lookup, SharedTransformSystem xform)
{
_entityManager = entManager;
_lookup = lookup;
_xform = xform;

_font = cache.GetFont("/Fonts/NotoSans/NotoSans-Regular.ttf", 12);
}
Expand Down Expand Up @@ -71,7 +73,7 @@ protected override void Draw(in OverlayDrawArgs args)
textStr = "";
}

var screenPos = args.ViewportControl.WorldToScreen(xform.WorldPosition);
var screenPos = args.ViewportControl.WorldToScreen(_xform.GetWorldPosition(xform));

args.ScreenHandle.DrawString(_font, screenPos, textStr, Color.Gold);
}
Expand Down
4 changes: 3 additions & 1 deletion Content.Client/Access/AccessSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

namespace Content.Client.Access;

public sealed class AccessSystem : SharedAccessSystem {}
public sealed class AccessSystem : SharedAccessSystem
{
}
8 changes: 5 additions & 3 deletions Content.Client/Access/Commands/ShowAccessReadersCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var collection = IoCManager.Instance;

if (collection == null) return;
if (collection == null)
return;

var overlay = collection.Resolve<IOverlayManager>();

Expand All @@ -25,9 +26,10 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)

var entManager = collection.Resolve<IEntityManager>();
var cache = collection.Resolve<IResourceCache>();
var system = entManager.EntitySysManager.GetEntitySystem<EntityLookupSystem>();
var lookup = entManager.System<EntityLookupSystem>();
var xform = entManager.System<SharedTransformSystem>();

overlay.AddOverlay(new AccessOverlay(entManager, cache, system));
overlay.AddOverlay(new AccessOverlay(entManager, cache, lookup, xform));
shell.WriteLine($"Set access reader debug overlay to true");
}
}
5 changes: 3 additions & 2 deletions Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ protected override void UpdateState(BoundUserInterfaceState state)
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
if (!disposing)
return;

_window?.Dispose();
}
}

}
4 changes: 3 additions & 1 deletion Content.Client/Access/UI/IdCardConsoleBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ protected override void Open()
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
if (!disposing)
return;

_window?.Dispose();
}

Expand Down
5 changes: 4 additions & 1 deletion Content.Client/Access/UI/IdCardConsoleWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Content.Client.Access.UI
public sealed partial class IdCardConsoleWindow : DefaultWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly ILogManager _logManager = default!;
private readonly ISawmill _logMill = default!;

private readonly IdCardConsoleBoundUserInterface _owner;

Expand All @@ -30,6 +32,7 @@ public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeMana
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_logMill = _logManager.GetSawmill(SharedIdCardConsoleSystem.Sawmill);

_owner = owner;

Expand Down Expand Up @@ -67,7 +70,7 @@ public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeMana
{
if (!prototypeManager.TryIndex<AccessLevelPrototype>(access, out var accessLevel))
{
Logger.ErrorS(SharedIdCardConsoleSystem.Sawmill, $"Unable to find accesslevel for {access}");
_logMill.Error($"Unable to find accesslevel for {access}");
continue;
}

Expand Down
38 changes: 38 additions & 0 deletions Content.Client/Administration/UI/AdminRemarks/AdminMessageEui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Content.Client.Eui;
using Content.Shared.Administration.Notes;
using Content.Shared.Eui;
using JetBrains.Annotations;
using static Content.Shared.Administration.Notes.AdminMessageEuiMsg;

namespace Content.Client.Administration.UI.AdminRemarks;

[UsedImplicitly]
public sealed class AdminMessageEui : BaseEui
{
private readonly AdminMessagePopupWindow _popup;

public AdminMessageEui()
{
_popup = new AdminMessagePopupWindow();
_popup.OnAcceptPressed += () => SendMessage(new Accept());
_popup.OnDismissPressed += () => SendMessage(new Dismiss());
_popup.OnClose += () => SendMessage(new CloseEuiMessage());
}

public override void HandleState(EuiStateBase state)
{
if (state is not AdminMessageEuiState s)
{
return;
}

_popup.SetMessage(s.Message);
_popup.SetDetails(s.AdminName, s.AddedOn);
_popup.Timer = s.Time;
}

public override void Opened()
{
_popup.OpenCentered();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<ui:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
VerticalExpand="True" HorizontalExpand="True"
Title="{Loc admin-notes-message-window-title}"
MinSize="600 170">
<PanelContainer VerticalExpand="True" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#25252A" />
</PanelContainer.PanelOverride>
<ScrollContainer HScrollEnabled="False" VerticalExpand="True" HorizontalExpand="True" Margin="4">
<BoxContainer Orientation="Vertical" SeparationOverride="10" VerticalAlignment="Bottom">
<Label Name="AdminLabel" Text="Loading..." />
<RichTextLabel Name="MessageLabel" />
<Label Name="WaitLabel" />
<BoxContainer Orientation="Horizontal">
<Button Name="DismissButton"
Text="{Loc 'admin-notes-message-dismiss'}" />
<Button Name="AcceptButton"
Text="{Loc 'admin-notes-message-accept'}"
Disabled="True" />
</BoxContainer>
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</ui:FancyWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Timing;

namespace Content.Client.Administration.UI.AdminRemarks;

[GenerateTypedNameReferences]
public sealed partial class AdminMessagePopupWindow : FancyWindow
{
private float _timer = float.MaxValue;
public float Timer
{
get => _timer;
set
{
WaitLabel.Text = Loc.GetString("admin-notes-message-wait", ("time", MathF.Floor(value)));
_timer = value;
}
}

public event Action? OnDismissPressed;
public event Action? OnAcceptPressed;

public AdminMessagePopupWindow()
{
RobustXamlLoader.Load(this);

AcceptButton.OnPressed += OnAcceptButtonPressed;
DismissButton.OnPressed += OnDismissButtonPressed;
}

public void SetMessage(string message)
{
MessageLabel.SetMessage(message);
}

public void SetDetails(string adminName, DateTime addedOn)
{
AdminLabel.Text = Loc.GetString("admin-notes-message-admin", ("admin", adminName), ("date", addedOn));
}

private void OnDismissButtonPressed(BaseButton.ButtonEventArgs obj)
{
OnDismissPressed?.Invoke();
Close();
}

private void OnAcceptButtonPressed(BaseButton.ButtonEventArgs obj)
{
OnAcceptPressed?.Invoke();
Close();
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

if (!AcceptButton.Disabled)
return;

if (Timer > 0.0)
{
if (Timer - args.DeltaSeconds < 0)
Timer = 0;
else
Timer -= args.DeltaSeconds;
}
else
{
AcceptButton.Disabled = false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<ui:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
VerticalExpand="True" HorizontalExpand="True"
Title="{Loc admin-remarks-title}"
SetSize="600 400">
<PanelContainer>
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#25252A" />
</PanelContainer.PanelOverride>
<BoxContainer Orientation="Vertical" Margin="4">
<ScrollContainer VerticalExpand="True" HorizontalExpand="True" HScrollEnabled="False">
<BoxContainer Orientation="Vertical" Name="NotesContainer" Access="Public" VerticalExpand="True" />
</ScrollContainer>
</BoxContainer>
</PanelContainer>
</ui:FancyWindow>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System.Linq;
using Content.Client.Administration.UI.Notes;
using Content.Client.UserInterface.Controls;
using Content.Shared.Administration.Notes;
using Content.Shared.Database;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.XAML;

namespace Content.Client.Administration.UI.AdminRemarks;

[GenerateTypedNameReferences]
public sealed partial class AdminRemarksWindow : FancyWindow
{
[Dependency] private readonly IEntitySystemManager _entitySystem = default!;
private readonly SpriteSystem _sprites;
private readonly Dictionary<(int, NoteType), AdminNotesLine> _inputs = new();

public AdminRemarksWindow()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprites = _entitySystem.GetEntitySystem<SpriteSystem>();
}

public void SetNotes(Dictionary<(int, NoteType), SharedAdminNote> notes)
{
foreach (var (id, input) in _inputs)
{
if (notes.ContainsKey(id))
continue;
NotesContainer.RemoveChild(input);
_inputs.Remove(id);
}

foreach (var note in notes.Values.OrderByDescending(note => note.CreatedAt))
{
if (_inputs.TryGetValue((note.Id, note.NoteType), out var input))
{
input.UpdateNote(note);
continue;
}

input = new AdminNotesLine(_sprites, note);
NotesContainer.AddChild(input);
_inputs[(note.Id, note.NoteType)] = input;
}
}
}
34 changes: 34 additions & 0 deletions Content.Client/Administration/UI/AdminRemarks/UserNotesEui.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Content.Client.Administration.UI.Notes;
using Content.Client.Eui;
using Content.Shared.Administration.Notes;
using Content.Shared.Eui;
using JetBrains.Annotations;

namespace Content.Client.Administration.UI.AdminRemarks;

[UsedImplicitly]
public sealed class UserNotesEui : BaseEui
{
public UserNotesEui()
{
NoteWindow = new AdminRemarksWindow();
NoteWindow.OnClose += () => SendMessage(new CloseEuiMessage());
}

private AdminRemarksWindow NoteWindow { get; }

public override void HandleState(EuiStateBase state)
{
if (state is not UserNotesEuiState s)
{
return;
}

NoteWindow.SetNotes(s.Notes);
}

public override void Opened()
{
NoteWindow.OpenCentered();
}
}
Loading

0 comments on commit e91564a

Please sign in to comment.