Skip to content

Commit ea2486a

Browse files
authored
Release (#5011)
Finally
2 parents db29e5a + 4b6f191 commit ea2486a

494 files changed

Lines changed: 446132 additions & 435011 deletions

File tree

Some content is hidden

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

Content.Client/Clothing/ClientClothingSystem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ protected override void OnGotEquipped(EntityUid uid, ClothingComponent component
225225
{
226226
base.OnGotEquipped(uid, component, args);
227227

228-
RenderEquipment(args.Equipee, uid, args.Slot, clothingComponent: component);
228+
RenderEquipment(args.EquipTarget, uid, args.Slot, clothingComponent: component);
229229
}
230230

231231
private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot,

Content.Client/Ghost/GhostSystem.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Robust.Shared.Configuration;
1010
using Content.Shared._Starlight.Administration.Events;
1111
using Content.Shared._Starlight.CCVar;
12+
using Content.Shared._Starlight.Ghost;
1213
#endregion
1314

1415
namespace Content.Client.Ghost
@@ -77,6 +78,7 @@ public override void Initialize()
7778
SubscribeLocalEvent<EyeComponent, ToggleLightingActionEvent>(OnToggleLighting);
7879
SubscribeLocalEvent<EyeComponent, ToggleFoVActionEvent>(OnToggleFoV);
7980
SubscribeLocalEvent<GhostComponent, ToggleGhostsActionEvent>(OnToggleGhosts);
81+
SubscribeNetworkEvent<GhostCorporealEvent>(OnCorporeal); // Starlight
8082
SubscribeNetworkEvent<AdminGhostEvent>(OnAdminGhost); // Starlight
8183
}
8284

@@ -219,13 +221,24 @@ public void ToggleGhostVisibility(bool? visibility = null)
219221
GhostVisibility = visibility ?? !GhostVisibility;
220222
}
221223

222-
// Starlight begin
224+
#region Starlight
225+
226+
private void OnCorporeal(GhostCorporealEvent ev)
227+
{
228+
var uid = GetEntity(ev.Uid);
229+
if (!TryComp<SpriteComponent>(uid, out var comp))
230+
return;
231+
232+
_sprite.SetVisible((uid, comp), ev.IsCorporeal || uid == _playerManager.LocalEntity || GhostVisibility);
233+
}
234+
223235
private void OnAdminGhost(AdminGhostEvent ev)
224236
{
225237
var value = _cfg.GetCVar(StarlightCCVars.AdminGhostScriptPath);
226238
if (value == string.Empty) return;
227239
_console.ExecuteCommand(null, $"exec /{value}");
228240
}
229-
// Starlight end
241+
242+
#endregion
230243
}
231244
}

Content.Client/Inventory/ClientInventorySystem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ public override void Update(float frameTime)
8282

8383
private void OnDidUnequip(InventorySlotsComponent component, DidUnequipEvent args)
8484
{
85-
UpdateSlot(args.Equipee, component, args.Slot);
86-
if (args.Equipee != _playerManager.LocalEntity)
85+
UpdateSlot(args.EquipTarget, component, args.Slot);
86+
if (args.EquipTarget != _playerManager.LocalEntity)
8787
return;
8888
var update = new SlotSpriteUpdate(null, args.SlotGroup, args.Slot, false);
8989
OnSpriteUpdate?.Invoke(update);
9090
}
9191

9292
private void OnDidEquip(InventorySlotsComponent component, DidEquipEvent args)
9393
{
94-
UpdateSlot(args.Equipee, component, args.Slot);
95-
if (args.Equipee != _playerManager.LocalEntity)
94+
UpdateSlot(args.EquipTarget, component, args.Slot);
95+
if (args.EquipTarget != _playerManager.LocalEntity)
9696
return;
9797
var update = new SlotSpriteUpdate(args.Equipment, args.SlotGroup, args.Slot,
9898
HasComp<StorageComponent>(args.Equipment));

Content.Client/SubFloor/TrayScannerSystem.cs

Lines changed: 109 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,49 @@
1-
using Content.Shared.Hands.EntitySystems;
1+
using Content.Client.Items;
2+
using Content.Client.Items.UI;
3+
using Content.Client.Message;
4+
using Content.Client.Power.Visualizers;
5+
using Content.Client.Stylesheets;
6+
using Content.Shared.Atmos.Components;
7+
using Content.Shared.Disposal.Components;
8+
using Content.Shared.Input;
29
using Content.Shared.Inventory;
310
using Content.Shared.SubFloor;
411
using Robust.Client.Animations;
512
using Robust.Client.GameObjects;
13+
using Robust.Client.Input;
614
using Robust.Client.Player;
15+
using Robust.Client.UserInterface;
16+
using Robust.Client.UserInterface.Controls;
717
using Robust.Shared.Timing;
818

919
namespace Content.Client.SubFloor;
1020

11-
public sealed partial class TrayScannerSystem : SharedTrayScannerSystem
21+
public sealed class TrayScannerSystem : SharedTrayScannerSystem
1222
{
13-
[Dependency] private IGameTiming _timing = default!;
14-
[Dependency] private IPlayerManager _player = default!;
15-
[Dependency] private AnimationPlayerSystem _animation = default!;
16-
[Dependency] private EntityLookupSystem _lookup = default!;
17-
[Dependency] private InventorySystem _inventory = default!;
18-
[Dependency] private SharedAppearanceSystem _appearance = default!;
19-
[Dependency] private SharedHandsSystem _hands = default!;
20-
[Dependency] private SharedTransformSystem _transform = default!;
21-
[Dependency] private SpriteSystem _sprite = default!;
22-
[Dependency] private TrayScanRevealSystem _trayScanReveal = default!;
23+
[Dependency] private IGameTiming _timing = default!; // starlight edit: removed readonly
24+
[Dependency] private IPlayerManager _player = default!; // starlight edit: removed readonly
25+
[Dependency] private AnimationPlayerSystem _animation = default!; // starlight edit: removed readonly
26+
[Dependency] private EntityLookupSystem _lookup = default!; // starlight edit: removed readonly
27+
[Dependency] private InventorySystem _inventory = default!; // starlight edit: removed readonly
28+
[Dependency] private SharedAppearanceSystem _appearance = default!; // starlight edit: removed readonly
29+
[Dependency] private SharedTransformSystem _transform = default!; // starlight edit: removed readonly
30+
[Dependency] private SpriteSystem _sprite = default!; // starlight edit: removed readonly
31+
[Dependency] private TrayScanRevealSystem _trayScanReveal = default!; // starlight edit: removed readonly
32+
[Dependency] private IInputManager _inputManager = default!; // starlight edit: removed readonly
33+
[Dependency] private EntityQuery<TrayScannerComponent> _trayScannerQuery = default!; // starlight edit: removed readonly
34+
[Dependency] private EntityQuery<SubFloorHideComponent> _subFloorHideQuery = default!; // starlight edit: removed readonly
2335

2436
private const string TRayAnimationKey = "trays";
2537
private const double AnimationLength = 0.3;
2638

2739
public const LookupFlags Flags = LookupFlags.Static | LookupFlags.Sundries | LookupFlags.Approximate;
2840

41+
public override void Initialize()
42+
{
43+
base.Initialize();
44+
Subs.ItemStatus<TrayScannerComponent>(OnCollectItemStatus);
45+
}
46+
2947
public override void Update(float frameTime)
3048
{
3149
base.Update(frameTime);
@@ -35,46 +53,27 @@ public override void Update(float frameTime)
3553

3654
// TODO: Multiple viewports or w/e
3755
var player = _player.LocalEntity;
38-
var xformQuery = GetEntityQuery<TransformComponent>();
3956

40-
if (!xformQuery.TryGetComponent(player, out var playerXform))
57+
if (!TryComp(player, out TransformComponent? playerXform))
4158
return;
4259

43-
var playerPos = _transform.GetWorldPosition(playerXform, xformQuery);
60+
var playerPos = _transform.GetWorldPosition(playerXform);
4461
var playerMap = playerXform.MapID;
4562
var range = 0f;
63+
var mode = TrayScannerMode.All;
4664
HashSet<Entity<SubFloorHideComponent>> inRange;
47-
var scannerQuery = GetEntityQuery<TrayScannerComponent>();
4865

4966
// TODO: Should probably sub to player attached changes / inventory changes but inventory's
5067
// API is extremely skrungly. If this ever shows up on dottrace ping me and laugh.
5168
var canSee = false;
5269

53-
// TODO: Common iterator for both systems.
54-
if (_inventory.TryGetContainerSlotEnumerator(player.Value, out var enumerator))
55-
{
56-
while (enumerator.MoveNext(out var slot))
57-
{
58-
foreach (var ent in slot.ContainedEntities)
59-
{
60-
if (!scannerQuery.TryGetComponent(ent, out var sneakScanner) || !sneakScanner.Enabled)
61-
continue;
62-
63-
canSee = true;
64-
range = MathF.Max(range, sneakScanner.Range);
65-
}
66-
}
67-
}
68-
69-
foreach (var hand in _hands.EnumerateHands(player.Value))
70+
foreach (var item in _inventory.GetHandOrInventoryEntities(player.Value, SlotFlags.POCKET))
7071
{
71-
if (!_hands.TryGetHeldItem(player.Value, hand, out var heldEntity))
72-
continue;
73-
74-
if (!scannerQuery.TryGetComponent(heldEntity, out var heldScanner) || !heldScanner.Enabled)
72+
if (!_trayScannerQuery.TryGetComponent(item, out var scanner) || !scanner.Enabled)
7573
continue;
7674

77-
range = MathF.Max(heldScanner.Range, range);
75+
range = MathF.Max(scanner.Range, range);
76+
mode = scanner.Mode;
7877
canSee = true;
7978
break;
8079
}
@@ -83,23 +82,28 @@ public override void Update(float frameTime)
8382

8483
if (canSee)
8584
{
86-
_lookup.GetEntitiesInRange(playerMap, playerPos, range, inRange, flags: Flags);
85+
var entitiesInRange = new HashSet<Entity<SubFloorHideComponent>>();
86+
_lookup.GetEntitiesInRange(playerMap, playerPos, range, entitiesInRange, flags: Flags);
8787

88-
foreach (var (uid, comp) in inRange)
88+
foreach (var (uid, comp) in entitiesInRange)
8989
{
90+
if (!MatchesMode(uid, mode))
91+
continue;
92+
93+
inRange.Add((uid, comp));
94+
9095
if (comp.IsUnderCover || _trayScanReveal.IsUnderRevealingEntity(uid))
9196
EnsureComp<TrayRevealedComponent>(uid);
9297
}
9398
}
9499

95100
var revealedQuery = AllEntityQuery<TrayRevealedComponent, SpriteComponent>();
96-
var subfloorQuery = GetEntityQuery<SubFloorHideComponent>();
97101

98102
while (revealedQuery.MoveNext(out var uid, out _, out var sprite))
99103
{
100104
// Revealing
101105
// Add buffer range to avoid flickers.
102-
if (subfloorQuery.TryGetComponent(uid, out var subfloor) &&
106+
if (_subFloorHideQuery.TryGetComponent(uid, out var subfloor) &&
103107
inRange.Contains((uid, subfloor)))
104108
{
105109
// Due to the fact client is predicting this server states will reset it constantly
@@ -174,4 +178,67 @@ private void SetRevealed(EntityUid uid, bool value)
174178
{
175179
_appearance.SetData(uid, SubFloorVisuals.ScannerRevealed, value);
176180
}
181+
182+
private bool MatchesMode(EntityUid uid, TrayScannerMode mode)
183+
{
184+
return mode switch
185+
{
186+
TrayScannerMode.All => true,
187+
TrayScannerMode.Wiring => HasComp<CableVisualizerComponent>(uid),
188+
// TODO: proper comp query after disposals refactor
189+
TrayScannerMode.Piping => HasComp<AtmosPipeLayersComponent>(uid) || _appearance.TryGetData(uid, DisposalTubeVisuals.VisualState, out _),
190+
_ => false,
191+
};
192+
}
193+
194+
#region UI
195+
private Control OnCollectItemStatus(Entity<TrayScannerComponent> entity)
196+
{
197+
_inputManager.TryGetKeyBinding((ContentKeyFunctions.AltUseItemInHand), out var binding);
198+
return new StatusControl(entity, binding?.GetKeyString() ?? "");
199+
}
200+
201+
private sealed class StatusControl : PollingItemStatusControl<StatusControl.TRayData>
202+
{
203+
private readonly RichTextLabel _label;
204+
private readonly TrayScannerComponent _scanner;
205+
private readonly string _keyBindingName;
206+
207+
public StatusControl(TrayScannerComponent scanner, string keyBindingName)
208+
{
209+
_scanner = scanner;
210+
_keyBindingName = keyBindingName;
211+
_label = new RichTextLabel { StyleClasses = { StyleClass.ItemStatus } };
212+
AddChild(_label);
213+
}
214+
215+
protected override TRayData PollData()
216+
{
217+
return new TRayData(_scanner.Enabled, _scanner.Mode);
218+
}
219+
220+
protected override void Update(in TRayData data)
221+
{
222+
if (!data.Enabled)
223+
{
224+
_label.SetMarkup(string.Empty);
225+
return;
226+
}
227+
228+
var modeLocString = data.Mode switch
229+
{
230+
TrayScannerMode.All => "tray-scanner-examine-mode-all",
231+
TrayScannerMode.Wiring => "tray-scanner-examine-mode-wiring",
232+
TrayScannerMode.Piping => "tray-scanner-examine-mode-piping",
233+
_ => "",
234+
};
235+
236+
_label.SetMarkup(Robust.Shared.Localization.Loc.GetString("tray-scanner-item-status-label",
237+
("mode", Robust.Shared.Localization.Loc.GetString(modeLocString)),
238+
("keybinding", _keyBindingName)));
239+
}
240+
241+
public readonly record struct TRayData(bool Enabled, TrayScannerMode Mode);
242+
}
243+
#endregion
177244
}

Content.Client/UserInterface/Systems/Chat/ChatUIController.cs

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Globalization;
1+
using System.Globalization; // Starlight: UTF-8 encode this file!
22
using System.Linq;
33
using System.Numerics;
44
using Content.Client.Administration.Managers;
@@ -398,14 +398,31 @@ private void FocusChat()
398398

399399
private void FocusChannel(ChatSelectChannel channel)
400400
{
401+
// Starlight BEGIN
402+
/*
403+
We added the "MainChannel" property to fix the admin chat window not being prioritized
404+
when the admin chat hotkey was pressed. This code was altered to prioritize a chat box
405+
whose MainChannel == channel. If no such chat box is found, whichever chat box is
406+
Main (the 'default' chat box) is used.
407+
408+
Note, I also tried to use the active chat filters to determine which box to select,
409+
but it seems there's several boxes in the background that break this, so I opted
410+
for this simpler approach of just having one "MainChannel".
411+
*/
412+
ChatBox? fallback = null;
401413
foreach (var chat in _chats)
402414
{
403-
if (!chat.Main)
404-
continue;
415+
if (chat.MainChannel == channel)
416+
{
417+
chat.Focus(channel);
418+
return;
419+
}
405420

406-
chat.Focus(channel);
407-
break;
421+
if (chat.Main)
422+
fallback ??= chat;
408423
}
424+
fallback?.Focus(channel);
425+
// Starlight END
409426
}
410427

411428
private void CycleChatChannel(bool forward)
@@ -793,7 +810,7 @@ public void UpdateSelectedChannel(ChatBox box)
793810

794811
if (chatChannel == ChatSelectChannel.Local)
795812
{
796-
if (_ghost?.IsGhost != true && _ghost?.Player?.BypassGhostChat != true) // Starlight edit
813+
if (_ghost?.IsGhost != true || _ghost?.Player?.BypassGhostChat == true) // Starlight edit
797814
return (chatChannel, text, null, null, language); //Starlight edit
798815
else
799816
chatChannel = ChatSelectChannel.Dead;
@@ -876,8 +893,11 @@ private void OnDamageForceSay(DamageForceSayEvent ev, EntitySessionEventArgs _)
876893
}
877894

878895
// Starlight begin: dumb event listener for updating channel permissions
879-
private void OnCorporealChanged(GhostCorporealEvent ev, EntitySessionEventArgs _) =>
896+
private void OnCorporealChanged(GhostCorporealEvent ev, EntitySessionEventArgs _)
897+
{
898+
if (EntityManager.GetEntity(ev.Uid) != _player.LocalEntity) return;
880899
UpdateChannelPermissions();
900+
}
881901
// Starlight end
882902

883903
private void OnChatMessage(MsgChatMessage message)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<controls:FancyWindow xmlns="https://spacestation14.io"
1+
<!-- Starlight --><chat:ChatWindow xmlns="https://spacestation14.io" xmlns:chat="clr-namespace:Content.Client.UserInterface.Systems.Chat"
22
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
33
xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Chat.Widgets"
44
Title="{Loc chat-window-title}"
55
MinSize="465 265">
66
<widgets:ChatBox Name="Chatbox"/>
7-
</controls:FancyWindow>
7+
</chat:ChatWindow><!-- Starlight -->

0 commit comments

Comments
 (0)