Skip to content

Commit f78b7a9

Browse files
authored
Merge branch 'space-wizards:master' into master
2 parents a1851e3 + 212e942 commit f78b7a9

File tree

897 files changed

+65463
-33495
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

897 files changed

+65463
-33495
lines changed

Content.Benchmarks/ComponentQueryBenchmark.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
using Content.Shared.Clothing.Components;
1010
using Content.Shared.Doors.Components;
1111
using Content.Shared.Item;
12-
using Robust.Server.GameObjects;
1312
using Robust.Shared;
1413
using Robust.Shared.Analyzers;
14+
using Robust.Shared.EntitySerialization;
15+
using Robust.Shared.EntitySerialization.Systems;
1516
using Robust.Shared.GameObjects;
16-
using Robust.Shared.Map;
1717
using Robust.Shared.Map.Components;
1818
using Robust.Shared.Random;
19+
using Robust.Shared.Utility;
1920

2021
namespace Content.Benchmarks;
2122

@@ -32,7 +33,6 @@ public class ComponentQueryBenchmark
3233

3334
private TestPair _pair = default!;
3435
private IEntityManager _entMan = default!;
35-
private MapId _mapId = new(10);
3636
private EntityQuery<ItemComponent> _itemQuery;
3737
private EntityQuery<ClothingComponent> _clothingQuery;
3838
private EntityQuery<MapComponent> _mapQuery;
@@ -54,10 +54,10 @@ public void Setup()
5454
_pair.Server.ResolveDependency<IRobustRandom>().SetSeed(42);
5555
_pair.Server.WaitPost(() =>
5656
{
57-
var success = _entMan.System<MapLoaderSystem>().TryLoad(_mapId, Map, out _);
58-
if (!success)
57+
var map = new ResPath(Map);
58+
var opts = DeserializationOptions.Default with {InitializeMaps = true};
59+
if (!_entMan.System<MapLoaderSystem>().TryLoadMap(map, out _, out _, opts))
5960
throw new Exception("Map load failed");
60-
_pair.Server.MapMan.DoMapInitialize(_mapId);
6161
}).GetAwaiter().GetResult();
6262

6363
_items = new EntityUid[_entMan.Count<ItemComponent>()];

Content.Benchmarks/MapLoadBenchmark.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
using Content.IntegrationTests;
77
using Content.IntegrationTests.Pair;
88
using Content.Server.Maps;
9-
using Robust.Server.GameObjects;
109
using Robust.Shared;
1110
using Robust.Shared.Analyzers;
11+
using Robust.Shared.EntitySerialization.Systems;
1212
using Robust.Shared.GameObjects;
1313
using Robust.Shared.Map;
1414
using Robust.Shared.Prototypes;
15+
using Robust.Shared.Utility;
1516

1617
namespace Content.Benchmarks;
1718

@@ -20,7 +21,7 @@ public class MapLoadBenchmark
2021
{
2122
private TestPair _pair = default!;
2223
private MapLoaderSystem _mapLoader = default!;
23-
private IMapManager _mapManager = default!;
24+
private SharedMapSystem _mapSys = default!;
2425

2526
[GlobalSetup]
2627
public void Setup()
@@ -36,7 +37,7 @@ public void Setup()
3637
.ToDictionary(x => x.ID, x => x.MapPath.ToString());
3738

3839
_mapLoader = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<MapLoaderSystem>();
39-
_mapManager = server.ResolveDependency<IMapManager>();
40+
_mapSys = server.ResolveDependency<IEntitySystemManager>().GetEntitySystem<SharedMapSystem>();
4041
}
4142

4243
[GlobalCleanup]
@@ -52,27 +53,27 @@ public async Task Cleanup()
5253
public string Map;
5354

5455
public Dictionary<string, string> Paths;
56+
private MapId _mapId;
5557

5658
[Benchmark]
5759
public async Task LoadMap()
5860
{
59-
var mapPath = Paths[Map];
61+
var mapPath = new ResPath(Paths[Map]);
6062
var server = _pair.Server;
6163
await server.WaitPost(() =>
6264
{
63-
var success = _mapLoader.TryLoad(new MapId(10), mapPath, out _);
65+
var success = _mapLoader.TryLoadMap(mapPath, out var map, out _);
6466
if (!success)
6567
throw new Exception("Map load failed");
68+
_mapId = map.Value.Comp.MapId;
6669
});
6770
}
6871

6972
[IterationCleanup]
7073
public void IterationCleanup()
7174
{
7275
var server = _pair.Server;
73-
server.WaitPost(() =>
74-
{
75-
_mapManager.DeleteMap(new MapId(10));
76-
}).Wait();
76+
server.WaitPost(() => _mapSys.DeleteMap(_mapId))
77+
.Wait();
7778
}
7879
}

Content.Benchmarks/PvsBenchmark.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
using Content.IntegrationTests.Pair;
88
using Content.Server.Mind;
99
using Content.Server.Warps;
10-
using Robust.Server.GameObjects;
1110
using Robust.Shared;
1211
using Robust.Shared.Analyzers;
12+
using Robust.Shared.EntitySerialization;
13+
using Robust.Shared.EntitySerialization.Systems;
1314
using Robust.Shared.GameObjects;
1415
using Robust.Shared.Map;
1516
using Robust.Shared.Player;
1617
using Robust.Shared.Random;
18+
using Robust.Shared.Utility;
1719

1820
namespace Content.Benchmarks;
1921

@@ -34,7 +36,6 @@ public class PvsBenchmark
3436

3537
private TestPair _pair = default!;
3638
private IEntityManager _entMan = default!;
37-
private MapId _mapId = new(10);
3839
private ICommonSession[] _players = default!;
3940
private EntityCoordinates[] _spawns = default!;
4041
public int _cycleOffset = 0;
@@ -65,10 +66,10 @@ private async Task SetupAsync()
6566
_pair.Server.ResolveDependency<IRobustRandom>().SetSeed(42);
6667
await _pair.Server.WaitPost(() =>
6768
{
68-
var success = _entMan.System<MapLoaderSystem>().TryLoad(_mapId, Map, out _);
69-
if (!success)
69+
var path = new ResPath(Map);
70+
var opts = DeserializationOptions.Default with {InitializeMaps = true};
71+
if (!_entMan.System<MapLoaderSystem>().TryLoadMap(path, out _, out _, opts))
7072
throw new Exception("Map load failed");
71-
_pair.Server.MapMan.DoMapInitialize(_mapId);
7273
});
7374

7475
// Get list of ghost warp positions

Content.Client/Actions/ActionsSystem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ private void OnEntityTargetHandleState(EntityUid uid, EntityTargetActionComponen
8888
return;
8989

9090
component.Whitelist = state.Whitelist;
91+
component.Blacklist = state.Blacklist;
9192
component.CanTargetSelf = state.CanTargetSelf;
9293
BaseHandleState<EntityTargetActionComponent>(uid, component, state);
9394
}

Content.Client/Administration/AdminNameOverlay.cs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ protected override void Draw(in OverlayDrawArgs args)
5050

5151
//TODO make this adjustable via GUI
5252
var classic = _config.GetCVar(CCVars.AdminOverlayClassic);
53+
var playTime = _config.GetCVar(CCVars.AdminOverlayPlaytime);
54+
var startingJob = _config.GetCVar(CCVars.AdminOverlayStartingJob);
5355

5456
foreach (var playerInfo in _system.PlayerList)
5557
{
@@ -76,25 +78,44 @@ protected override void Draw(in OverlayDrawArgs args)
7678
}
7779

7880
var uiScale = _userInterfaceManager.RootControl.UIScale;
79-
var lineoffset = new Vector2(0f, 11f) * uiScale;
81+
var lineoffset = new Vector2(0f, 14f) * uiScale;
8082
var screenCoordinates = _eyeManager.WorldToScreen(aabb.Center +
8183
new Angle(-_eyeManager.CurrentEye.Rotation).RotateVec(
8284
aabb.TopRight - aabb.Center)) + new Vector2(1f, 7f);
8385

84-
if (classic && playerInfo.Antag)
86+
var currentOffset = Vector2.Zero;
87+
88+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White);
89+
currentOffset += lineoffset;
90+
91+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White);
92+
currentOffset += lineoffset;
93+
94+
if (!string.IsNullOrEmpty(playerInfo.PlaytimeString) && playTime)
8595
{
86-
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), _antagLabelClassic, uiScale, _antagColorClassic);
96+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, playerInfo.PlaytimeString, uiScale, playerInfo.Connected ? Color.Orange : Color.White);
97+
currentOffset += lineoffset;
8798
}
88-
else if (!classic && _filter.Contains(playerInfo.RoleProto.ID))
99+
100+
if (!string.IsNullOrEmpty(playerInfo.StartingJob) && startingJob)
89101
{
90-
var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper();
91-
var color = playerInfo.RoleProto.Color;
102+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, Loc.GetString(playerInfo.StartingJob), uiScale, playerInfo.Connected ? Color.GreenYellow : Color.White);
103+
currentOffset += lineoffset;
104+
}
92105

93-
args.ScreenHandle.DrawString(_font, screenCoordinates + (lineoffset * 2), label, uiScale, color);
106+
if (classic && playerInfo.Antag)
107+
{
108+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, _antagLabelClassic, uiScale, Color.OrangeRed);
109+
currentOffset += lineoffset;
94110
}
111+
else if (!classic && _filter.Contains(playerInfo.RoleProto))
112+
{
113+
var label = Loc.GetString(playerInfo.RoleProto.Name).ToUpper();
114+
var color = playerInfo.RoleProto.Color;
95115

96-
args.ScreenHandle.DrawString(_font, screenCoordinates + lineoffset, playerInfo.Username, uiScale, playerInfo.Connected ? Color.Yellow : Color.White);
97-
args.ScreenHandle.DrawString(_font, screenCoordinates, playerInfo.CharacterName, uiScale, playerInfo.Connected ? Color.Aquamarine : Color.White);
116+
args.ScreenHandle.DrawString(_font, screenCoordinates + currentOffset, label, uiScale, color);
117+
currentOffset += lineoffset;
118+
}
98119
}
99120
}
100121
}

Content.Client/Administration/Systems/BwoinkSystem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ protected override void OnBwoinkTextMessage(BwoinkTextMessage message, EntitySes
1919
OnBwoinkTextMessageRecieved?.Invoke(this, message);
2020
}
2121

22-
public void Send(NetUserId channelId, string text, bool playSound)
22+
public void Send(NetUserId channelId, string text, bool playSound, bool adminOnly)
2323
{
2424
// Reuse the channel ID as the 'true sender'.
2525
// Server will ignore this and if someone makes it not ignore this (which is bad, allows impersonation!!!), that will help.
26-
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound));
26+
RaiseNetworkEvent(new BwoinkTextMessage(channelId, channelId, text, playSound: playSound, adminOnly: adminOnly));
2727
SendInputTextUpdated(channelId, false);
2828
}
2929

Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
<BoxContainer Orientation="Vertical" HorizontalExpand="True" SizeFlagsStretchRatio="2">
88
<BoxContainer Access="Public" Name="BwoinkArea" VerticalExpand="True" />
99
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
10-
<CheckBox Visible="True" Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
10+
<CheckBox Name="AdminOnly" Access="Public" Text="{Loc 'admin-ahelp-admin-only'}" ToolTip="{Loc 'admin-ahelp-admin-only-tooltip'}" />
11+
<Control HorizontalExpand="True" MinWidth="5" />
12+
<CheckBox Name="PlaySound" Access="Public" Text="{Loc 'admin-bwoink-play-sound'}" Pressed="True" />
1113
<Control HorizontalExpand="True" MinWidth="5" />
1214
<Button Visible="True" Name="PopOut" Access="Public" Text="{Loc 'admin-logs-pop-out'}" StyleClasses="OpenBoth" HorizontalAlignment="Left" />
1315
<Control HorizontalExpand="True" />

Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ public BwoinkControl()
4545
_adminManager.AdminStatusUpdated += UpdateButtons;
4646
UpdateButtons();
4747

48+
AdminOnly.OnToggled += args => PlaySound.Disabled = args.Pressed;
49+
4850
ChannelSelector.OnSelectionChanged += sel =>
4951
{
5052
_currentPlayer = sel;

Content.Client/Atmos/Consoles/AtmosAlertsComputerBoundUserInterface.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public AtmosAlertsComputerBoundUserInterface(EntityUid owner, Enum uiKey) : base
1111

1212
protected override void Open()
1313
{
14+
base.Open();
15+
1416
_menu = new AtmosAlertsComputerWindow(this, Owner);
1517
_menu.OpenCentered();
1618
_menu.OnClose += Close;

Content.Client/Atmos/Consoles/AtmosAlertsComputerWindow.xaml.cs

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -512,39 +512,15 @@ private void AutoScrollToFocus()
512512
if (scroll == null)
513513
return;
514514

515-
if (!TryGetVerticalScrollbar(scroll, out var vScrollbar))
516-
return;
517-
518515
if (!TryGetNextScrollPosition(out float? nextScrollPosition))
519516
return;
520517

521-
vScrollbar.ValueTarget = nextScrollPosition.Value;
518+
scroll.VScrollTarget = nextScrollPosition.Value;
522519

523-
if (MathHelper.CloseToPercent(vScrollbar.Value, vScrollbar.ValueTarget))
520+
if (MathHelper.CloseToPercent(scroll.VScroll, scroll.VScrollTarget))
524521
_autoScrollActive = false;
525522
}
526523

527-
private bool TryGetVerticalScrollbar(ScrollContainer scroll, [NotNullWhen(true)] out VScrollBar? vScrollBar)
528-
{
529-
vScrollBar = null;
530-
531-
foreach (var child in scroll.Children)
532-
{
533-
if (child is not VScrollBar)
534-
continue;
535-
536-
var castChild = child as VScrollBar;
537-
538-
if (castChild != null)
539-
{
540-
vScrollBar = castChild;
541-
return true;
542-
}
543-
}
544-
545-
return false;
546-
}
547-
548524
private bool TryGetNextScrollPosition([NotNullWhen(true)] out float? nextScrollPosition)
549525
{
550526
nextScrollPosition = null;

0 commit comments

Comments
 (0)