Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream sync #571

Merged
merged 99 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
3c1ec9a
Add Hardhats to Station Engineer Loadouts (#27044)
Pangogie Apr 18, 2024
9b1a8b0
Fix loadouts UI not refreshing on char change (#27075)
metalgearsloth Apr 18, 2024
d9ee160
Automatic changelog update
PJBot Apr 18, 2024
8d21ef0
Rebalance: From Insuzine recipe removed Benzene (#26829)
TokenStyle Apr 18, 2024
a3750f0
Nukie Medivisor REAL (#26218)
Golinth Apr 18, 2024
020f322
Automatic changelog update
PJBot Apr 18, 2024
460b588
Refactor status icons take 2, cyborgs don't see criminal status (#26207)
Krunklehorn Apr 18, 2024
31f88ec
Automatic changelog update
PJBot Apr 18, 2024
94aa61b
Add recipe of beverage jug (#25681)
ArZarLordOfMango Apr 18, 2024
24a0298
Automatic changelog update
PJBot Apr 18, 2024
7120e87
Cleanup in HumanoidCharacterAppearance (#26974)
Errant-4 Apr 18, 2024
20452ba
Update submodule to 219.0.0 (#27077)
metalgearsloth Apr 18, 2024
ee96d8a
Content changes for MapManager/System refactor (#26994)
ElectroJr Apr 18, 2024
126f64a
Fix merg conflict (#27080)
metalgearsloth Apr 18, 2024
b1136c9
Chatfactor: Chat Repository, Admin Commands, Chat Created Events (#26…
FairlySadPanda Apr 18, 2024
3af744e
Flash buff (#25730)
EmoGarbage404 Apr 18, 2024
5b9e0fb
Fixing the cryogenic section of the guidebook (#26803)
Detintinto Apr 18, 2024
7b94e24
Ports a fuckton of vox clothing from Paradise and /vg/station (#27021)
Flareguy Apr 18, 2024
ebf87be
Emergency Lights now changes color depending on alert level and wheth…
superjj18 Apr 18, 2024
394390b
Adds plasma windoors for Armory, Sec, Command, and Atmos (#26149)
IamVelcroboy Apr 18, 2024
a66e233
Automatic changelog update
PJBot Apr 18, 2024
73a5a38
Chemists now start with chemical analysis goggles (#27047)
Dutch-VanDerLinde Apr 18, 2024
0b0e20e
Automatic changelog update
PJBot Apr 18, 2024
f3a97fc
Killer tomatoes (#26053)
TheShuEd Apr 18, 2024
403852c
Automatic changelog update
PJBot Apr 18, 2024
e82034c
Component of planet initialization on the map (#26510)
TheShuEd Apr 18, 2024
b14e6e3
Automatic changelog update
PJBot Apr 18, 2024
5769bf3
Revert #26994 and #27077 (#27090)
VasilisThePikachu Apr 18, 2024
77612e8
Nerfs the Experimental Research Hardsuit's size (#27094)
Flareguy Apr 18, 2024
10beb47
Automatic changelog update
PJBot Apr 18, 2024
f801a86
fix RD hardsuit description (#27094) (#27095)
QuietlyWhisper Apr 18, 2024
620a6de
Fix duplicate science backpack for reserach assistant (#27096)
Dutch-VanDerLinde Apr 18, 2024
71d5d2a
atlas update (#27070)
deltanedas Apr 18, 2024
4509235
saltern update (#27071)
deltanedas Apr 18, 2024
d5e187d
Changes to frills axolotl (#27104)
lzk228 Apr 18, 2024
c8202dd
add roboticist gear to science loadout (#27045)
Dutch-VanDerLinde Apr 18, 2024
5a89fe0
Automatic changelog update
PJBot Apr 18, 2024
7decf64
Raise difficulty class of RD hardsuit objective (#27103)
QuietlyWhisper Apr 18, 2024
77090fc
Automatic changelog update
PJBot Apr 18, 2024
f563733
Made glass more opaque (#26948)
iztokbajcar Apr 18, 2024
f9f098f
Automatic changelog update
PJBot Apr 18, 2024
6ec4090
Fix fixgridatmos command (#27113)
ElectroJr Apr 19, 2024
45df595
Fix storage fill giving no reason for failing (#27122)
DrSmugleaf Apr 19, 2024
8245caa
Hide some map related logs from clients (#27127)
ElectroJr Apr 19, 2024
36eaa8c
Make station components use StationPostInitEvent (#27126)
ElectroJr Apr 19, 2024
5146853
Fix Mindshield positioning (#27120)
Golinth Apr 19, 2024
94f296f
"make thief" admin action: fix missing icon (#27119)
pissdemon Apr 19, 2024
7aa4bee
Fix lizard snouts disappearing when wearing masks (#25716)
SlamBamActionman Apr 19, 2024
350843d
add dirty calls to mask system (#27128)
deltanedas Apr 19, 2024
8703a30
Automatic changelog update
PJBot Apr 19, 2024
1bfcc06
Stunprod rework (#25922)
shampunj Apr 19, 2024
33abb6b
webedit ops (#27131)
deltanedas Apr 19, 2024
5b62724
Automatic changelog update
PJBot Apr 19, 2024
299da35
Make YAML Linter validate server/client-only components (#26809)
Tayrtahn Apr 19, 2024
6373454
Fix emergency shuttle initialization
ElectroJr Apr 19, 2024
7aa1818
Update EmergencyShuttleSystem.cs
ElectroJr Apr 19, 2024
a47c556
add fuel costs back to finishing welding (#27030)
EmoGarbage404 Apr 19, 2024
c6f8cf0
Automatic changelog update
PJBot Apr 19, 2024
fdf04c2
Reduced Pneumatic Cannon inventory space by 75%, removed cannon black…
superjj18 Apr 19, 2024
610e735
Automatic changelog update
PJBot Apr 19, 2024
aa0fc72
Add new jukebox song. (#27074)
Sadie-silly Apr 19, 2024
fa9abba
No More Bartender Incendiaries on Meta (#27142)
Aexxie Apr 20, 2024
cff8083
Disable Communication Console Announcement Button for Too Long Messag…
dffdff2423 Apr 20, 2024
ce5934b
Automatic changelog update
PJBot Apr 20, 2024
acb112b
Wallmount substations can once again be created (#27138)
osjarw Apr 20, 2024
7000974
Automatic changelog update
PJBot Apr 20, 2024
b2b1926
More storage tweaks (#25970)
metalgearsloth Apr 20, 2024
fa5b938
chili/chilly peppers sprite alignment fix & minor refactorization (#2…
Gyrandola Apr 20, 2024
5a5167d
Automatic changelog update
PJBot Apr 20, 2024
349f78d
Try fix emergency shuttle not spawning (#27144)
ElectroJr Apr 20, 2024
533453e
Automatic changelog update
PJBot Apr 20, 2024
6be204e
Adds non randomized rod velocity (#27123)
keronshb Apr 20, 2024
ef7f0b8
Optimise immovable rod mapinit (#27149)
metalgearsloth Apr 20, 2024
e5a5196
make filled inventory slots blank (#27150)
EmoGarbage404 Apr 20, 2024
b22c062
fix cryopod volume (#27148)
slarticodefast Apr 20, 2024
fc7839e
Automatic changelog update
PJBot Apr 20, 2024
4594700
Fixed debug assert while getting network state in ClothingSystem (#27…
Tayrtahn Apr 20, 2024
12bb476
Add evac shuttle test. (#27152)
ElectroJr Apr 20, 2024
3f2e158
Floor trap (#26314)
Nimfar11 Apr 20, 2024
8eab1f4
Guidebook update for the Space Ninja (#26650)
UBlueberry Apr 20, 2024
c85bdef
Automatic changelog update
PJBot Apr 20, 2024
089c9cb
You can bless more containers with a bible (#26526)
Vermidia Apr 20, 2024
238c87c
Automatic changelog update
PJBot Apr 20, 2024
95c66b4
Glass shards damage (#26783)
SoulFN Apr 20, 2024
16ed6ee
Automatic changelog update
PJBot Apr 20, 2024
58e21a8
Add medical gloves and sterile masks to medical loadouts (#27029)
Vermidia Apr 20, 2024
812abd3
Fix crates masks (#27137)
MilenVolf Apr 20, 2024
3c6722b
Move storage binds and slot click handling to shared (#27135)
DrSmugleaf Apr 20, 2024
de9c234
Automatic changelog update
PJBot Apr 20, 2024
2da53d9
Windoors now contain proper electronics (#27133)
MilenVolf Apr 20, 2024
f395c45
Automatic changelog update
PJBot Apr 20, 2024
5c69031
Admin log shuttle gibbing + Make shuttle gibbing and immovable rods d…
pissdemon Apr 20, 2024
396c613
Adds the option to fit the viewport to vertical screenspace (#27061)
deathride58 Apr 20, 2024
ddaaadd
Automatic changelog update
PJBot Apr 20, 2024
5eae633
Make remaining IPrototypes partial (#27157)
DrSmugleaf Apr 20, 2024
85c7cc5
Merge remote-tracking branch 'wizard/master' into upstream-sync
Rxup Apr 20, 2024
3f63f51
upd
Rxup Apr 20, 2024
599e480
fix centcom
Rxup Apr 20, 2024
70ff3d3
upd
Rxup Apr 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,15 @@ void IPostInjectInit.PostInject()

public AdminData? GetAdminData(EntityUid uid, bool includeDeAdmin = false)
{
return uid == _player.LocalEntity ? _adminData : null;
if (uid == _player.LocalEntity && (_adminData?.Active ?? includeDeAdmin))
return _adminData;

return null;
}

public AdminData? GetAdminData(ICommonSession session, bool includeDeAdmin = false)
{
if (_player.LocalUser == session.UserId)
if (_player.LocalUser == session.UserId && (_adminData?.Active ?? includeDeAdmin))
return _adminData;

return null;
Expand Down
8 changes: 8 additions & 0 deletions Content.Client/Backmen/Magic/BkmMagicSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Content.Shared.Backmen.Magic;

namespace Content.Client.Backmen.Magic;

public sealed class BkmMagicSystem : SharedBkmMagicSystem
{

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using Content.Client.UserInterface.Controls;
using System.Threading;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Utility;
using Timer = Robust.Shared.Timing.Timer;

Expand All @@ -13,6 +15,8 @@ public sealed partial class CommunicationsConsoleMenu : FancyWindow
private CommunicationsConsoleBoundUserInterface Owner { get; set; }
private readonly CancellationTokenSource _timerCancelTokenSource = new();

[Dependency] private readonly IConfigurationManager _cfg = default!;

public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner)
{
IoCManager.InjectDependencies(this);
Expand All @@ -23,6 +27,22 @@ public CommunicationsConsoleMenu(CommunicationsConsoleBoundUserInterface owner)
var loc = IoCManager.Resolve<ILocalizationManager>();
MessageInput.Placeholder = new Rope.Leaf(loc.GetString("comms-console-menu-announcement-placeholder"));

var maxAnnounceLength = _cfg.GetCVar(CCVars.ChatMaxAnnouncementLength);
MessageInput.OnTextChanged += (args) =>
{
if (args.Control.TextLength > maxAnnounceLength)
{
AnnounceButton.Disabled = true;
AnnounceButton.ToolTip = Loc.GetString("comms-console-message-too-long");
}
else
{
AnnounceButton.Disabled = !owner.CanAnnounce;
AnnounceButton.ToolTip = null;

}
};

AnnounceButton.OnPressed += (_) => Owner.AnnounceButtonPressed(Rope.Collapse(MessageInput.TextRope));
AnnounceButton.Disabled = !owner.CanAnnounce;

Expand Down
38 changes: 29 additions & 9 deletions Content.Client/GameTicking/Managers/ClientGameTicker.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Client.Administration.Managers;
using Content.Client.Gameplay;
using Content.Client.Lobby;
using Content.Client.RoundEnd;
Expand All @@ -14,7 +15,9 @@ namespace Content.Client.GameTicking.Managers
public sealed class ClientGameTicker : SharedGameTicker
{
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IClientAdminManager _admin = default!;
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly SharedMapSystem _map = default!;

[ViewVariables] private bool _initialized;
private Dictionary<NetEntity, Dictionary<string, uint?>> _jobsAvailable = new();
Expand Down Expand Up @@ -44,23 +47,40 @@ public sealed class ClientGameTicker : SharedGameTicker

public override void Initialize()
{
DebugTools.Assert(!_initialized);

SubscribeNetworkEvent<TickerJoinLobbyEvent>(JoinLobby);
SubscribeNetworkEvent<TickerJoinGameEvent>(JoinGame);
SubscribeNetworkEvent<TickerConnectionStatusEvent>(ConnectionStatus);
SubscribeNetworkEvent<TickerLobbyStatusEvent>(LobbyStatus);
SubscribeNetworkEvent<TickerLobbyInfoEvent>(LobbyInfo);
SubscribeNetworkEvent<TickerLobbyCountdownEvent>(LobbyCountdown);
SubscribeNetworkEvent<RoundEndMessageEvent>(RoundEnd);
SubscribeNetworkEvent<RequestWindowAttentionEvent>(msg =>
{
IoCManager.Resolve<IClyde>().RequestWindowAttention();
});
SubscribeNetworkEvent<RequestWindowAttentionEvent>(OnAttentionRequest);
SubscribeNetworkEvent<TickerLateJoinStatusEvent>(LateJoinStatus);
SubscribeNetworkEvent<TickerJobsAvailableEvent>(UpdateJobsAvailable);

_initialized = true;
_admin.AdminStatusUpdated += OnAdminUpdated;
OnAdminUpdated();
}

public override void Shutdown()
{
_admin.AdminStatusUpdated -= OnAdminUpdated;
base.Shutdown();
}

private void OnAdminUpdated()
{
// Hide some map/grid related logs from clients. This is to try prevent some easy metagaming by just
// reading the console. E.g., logs like this one could leak the nuke station/grid:
// > Grid NT-Arrivals 1101 (122/n25896) changed parent. Old parent: map 10 (121/n25895). New parent: FTL (123/n26470)
#if !DEBUG
_map.Log.Level = _admin.IsAdmin() ? LogLevel.Info : LogLevel.Warning;
#endif
}

private void OnAttentionRequest(RequestWindowAttentionEvent ev)
{
_clyde.RequestWindowAttention();
}

private void LateJoinStatus(TickerLateJoinStatusEvent message)
Expand Down Expand Up @@ -137,7 +157,7 @@ private void RoundEnd(RoundEndMessageEvent message)
return;

//This is not ideal at all, but I don't see an immediately better fit anywhere else.
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, EntityManager);
}
}
}
2 changes: 1 addition & 1 deletion Content.Client/Guidebook/GuideEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class GuideEntry
}

[Prototype("guideEntry")]
public sealed class GuideEntryPrototype : GuideEntry, IPrototype
public sealed partial class GuideEntryPrototype : GuideEntry, IPrototype
{
public string ID => Id;
}
3 changes: 2 additions & 1 deletion Content.Client/Inventory/ClientInventorySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void UIInventoryActivate(string slot)

public void UIInventoryStorageActivate(string slot)
{
EntityManager.EntityNetManager?.SendSystemNetworkMessage(new OpenSlotStorageNetworkMessage(slot));
EntityManager.RaisePredictiveEvent(new OpenSlotStorageNetworkMessage(slot));
}

public void UIInventoryExamine(string slot, EntityUid uid)
Expand Down Expand Up @@ -251,6 +251,7 @@ public sealed class SlotData
public string SlotGroup => SlotDef.SlotGroup;
public string SlotDisplayName => SlotDef.DisplayName;
public string TextureName => "Slots/" + SlotDef.TextureName;
public string FullTextureName => SlotDef.FullTextureName;

public SlotData(SlotDefinition slotDef, ContainerSlot? container = null, bool highlighted = false,
bool blocked = false)
Expand Down
4 changes: 2 additions & 2 deletions Content.Client/Inventory/StrippableBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ private void UpdateEntityIcon(SlotControl button, EntityUid? entity)

if (entity == null)
{
button.SpriteView.SetEntity(null);
button.SetEntity(null);
return;
}

Expand All @@ -231,7 +231,7 @@ private void UpdateEntityIcon(SlotControl button, EntityUid? entity)
else
return;

button.SpriteView.SetEntity(viewEnt);
button.SetEntity(viewEnt);
}
}
}
3 changes: 3 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<CheckBox Name="IntegerScalingCheckBox"
Text="{Loc 'ui-options-vp-integer-scaling'}"
ToolTip="{Loc 'ui-options-vp-integer-scaling-tooltip'}" />
<CheckBox Name="ViewportVerticalFitCheckBox"
Text="{Loc 'ui-options-vp-vertical-fit'}"
ToolTip="{Loc 'ui-options-vp-vertical-fit-tooltip'}" />
<CheckBox Name="ViewportLowResCheckBox" Text="{Loc 'ui-options-vp-low-res'}" />
<CheckBox Name="ParallaxLowQualityCheckBox" Text="{Loc 'ui-options-parallax-low-quality'}" />
<CheckBox Name="FpsCounterCheckBox" Text="{Loc 'ui-options-fps-counter'}" />
Expand Down
12 changes: 12 additions & 0 deletions Content.Client/Options/UI/Tabs/GraphicsTab.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public GraphicsTab()
UpdateApplyButton();
};

ViewportVerticalFitCheckBox.OnToggled += _ =>
{
UpdateViewportScale();
UpdateApplyButton();
};

IntegerScalingCheckBox.OnToggled += OnCheckBoxToggled;
ViewportLowResCheckBox.OnToggled += OnCheckBoxToggled;
ParallaxLowQualityCheckBox.OnToggled += OnCheckBoxToggled;
Expand All @@ -79,6 +85,7 @@ public GraphicsTab()
ViewportScaleSlider.Value = _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
ViewportStretchCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportStretch);
IntegerScalingCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0;
ViewportVerticalFitCheckBox.Pressed = _cfg.GetCVar(CCVars.ViewportVerticalFit);
ViewportLowResCheckBox.Pressed = !_cfg.GetCVar(CCVars.ViewportScaleRender);
ParallaxLowQualityCheckBox.Pressed = _cfg.GetCVar(CCVars.ParallaxLowQuality);
FpsCounterCheckBox.Pressed = _cfg.GetCVar(CCVars.HudFpsCounterVisible);
Expand Down Expand Up @@ -111,6 +118,7 @@ private void OnApplyButtonPressed(BaseButton.ButtonEventArgs args)
_cfg.SetCVar(CCVars.ViewportFixedScaleFactor, (int) ViewportScaleSlider.Value);
_cfg.SetCVar(CCVars.ViewportSnapToleranceMargin,
IntegerScalingCheckBox.Pressed ? CCVars.ViewportSnapToleranceMargin.DefaultValue : 0);
_cfg.SetCVar(CCVars.ViewportVerticalFit, ViewportVerticalFitCheckBox.Pressed);
_cfg.SetCVar(CCVars.ViewportScaleRender, !ViewportLowResCheckBox.Pressed);
_cfg.SetCVar(CCVars.ParallaxLowQuality, ParallaxLowQualityCheckBox.Pressed);
_cfg.SetCVar(CCVars.HudFpsCounterVisible, FpsCounterCheckBox.Pressed);
Expand Down Expand Up @@ -140,6 +148,7 @@ private void UpdateApplyButton()
var isVPStretchSame = ViewportStretchCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportStretch);
var isVPScaleSame = (int) ViewportScaleSlider.Value == _cfg.GetCVar(CCVars.ViewportFixedScaleFactor);
var isIntegerScalingSame = IntegerScalingCheckBox.Pressed == (_cfg.GetCVar(CCVars.ViewportSnapToleranceMargin) != 0);
var isVPVerticalFitSame = ViewportVerticalFitCheckBox.Pressed == _cfg.GetCVar(CCVars.ViewportVerticalFit);
var isVPResSame = ViewportLowResCheckBox.Pressed == !_cfg.GetCVar(CCVars.ViewportScaleRender);
var isPLQSame = ParallaxLowQualityCheckBox.Pressed == _cfg.GetCVar(CCVars.ParallaxLowQuality);
var isFpsCounterVisibleSame = FpsCounterCheckBox.Pressed == _cfg.GetCVar(CCVars.HudFpsCounterVisible);
Expand All @@ -152,6 +161,7 @@ private void UpdateApplyButton()
isVPStretchSame &&
isVPScaleSame &&
isIntegerScalingSame &&
isVPVerticalFitSame &&
isVPResSame &&
isPLQSame &&
isFpsCounterVisibleSame &&
Expand Down Expand Up @@ -235,6 +245,8 @@ private void UpdateViewportScale()
{
ViewportScaleBox.Visible = !ViewportStretchCheckBox.Pressed;
IntegerScalingCheckBox.Visible = ViewportStretchCheckBox.Pressed;
ViewportVerticalFitCheckBox.Visible = ViewportStretchCheckBox.Pressed;
ViewportWidthSlider.Visible = ViewportWidthSliderDisplay.Visible = !ViewportStretchCheckBox.Pressed || ViewportStretchCheckBox.Pressed && !ViewportVerticalFitCheckBox.Pressed;
ViewportScaleText.Text = Loc.GetString("ui-options-vp-scale", ("scale", ViewportScaleSlider.Value));
}

Expand Down
28 changes: 28 additions & 0 deletions Content.Client/Overlays/ShowCriminalRecordIconsSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Overlays;
using Content.Shared.Security.Components;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;

namespace Content.Client.Overlays;

public sealed class ShowCriminalRecordIconsSystem : EquipmentHudSystem<ShowCriminalRecordIconsComponent>
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<CriminalRecordComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, CriminalRecordComponent component, ref GetStatusIconsEvent ev)
{
if (!IsActive || ev.InContainer)
return;

if (_prototype.TryIndex<StatusIconPrototype>(component.StatusIcon.Id, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
}
}
43 changes: 6 additions & 37 deletions Content.Client/Overlays/ShowHungerIconsSystem.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using Content.Shared.Nutrition.EntitySystems;
using Content.Shared.Nutrition.Components;
using Content.Shared.Overlays;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Shared.Prototypes;

namespace Content.Client.Overlays;

public sealed class ShowHungerIconsSystem : EquipmentHudSystem<ShowHungerIconsComponent>
{
[Dependency] private readonly IPrototypeManager _prototypeMan = default!;
[Dependency] private readonly HungerSystem _hunger = default!;

public override void Initialize()
{
Expand All @@ -17,42 +16,12 @@ public override void Initialize()
SubscribeLocalEvent<HungerComponent, GetStatusIconsEvent>(OnGetStatusIconsEvent);
}

private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent hungerComponent, ref GetStatusIconsEvent args)
private void OnGetStatusIconsEvent(EntityUid uid, HungerComponent component, ref GetStatusIconsEvent ev)
{
if (!IsActive || args.InContainer)
if (!IsActive || ev.InContainer)
return;

var hungerIcons = DecideHungerIcon(uid, hungerComponent);

args.StatusIcons.AddRange(hungerIcons);
}

private IReadOnlyList<StatusIconPrototype> DecideHungerIcon(EntityUid uid, HungerComponent hungerComponent)
{
var result = new List<StatusIconPrototype>();

switch (hungerComponent.CurrentThreshold)
{
case HungerThreshold.Overfed:
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconOverfed", out var overfed))
{
result.Add(overfed);
}
break;
case HungerThreshold.Peckish:
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconPeckish", out var peckish))
{
result.Add(peckish);
}
break;
case HungerThreshold.Starving:
if (_prototypeMan.TryIndex<StatusIconPrototype>("HungerIconStarving", out var starving))
{
result.Add(starving);
}
break;
}

return result;
if (_hunger.TryGetStatusIconPrototype(component, out var iconPrototype))
ev.StatusIcons.Add(iconPrototype);
}
}
Loading
Loading