Various UI warnings cleanup (#36169)

* Various UI warnings cleanup

* Revert unnecessary change

* Redoing SpriteSystem as it's non-injectable

* Missed one

* Better entity instantiation

* General cleanup of warnings changes

* Wrong class name!
This commit is contained in:
J
2025-04-10 10:47:05 +00:00
committed by GitHub
parent 48004bfad7
commit 3c307f3b36
21 changed files with 54 additions and 45 deletions

View File

@@ -8,8 +8,6 @@ using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.XAML;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
namespace Content.Client.Changelog
@@ -19,7 +17,6 @@ namespace Content.Client.Changelog
{
[Dependency] private readonly ChangelogManager _changelog = default!;
[Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
public ChangelogWindow()
{

View File

@@ -1,4 +1,4 @@
using Content.Shared.Chasm;
using Content.Shared.Chasm;
using Robust.Client.Animations;
using Robust.Client.GameObjects;
using Robust.Shared.Animations;
@@ -32,7 +32,9 @@ public sealed class ChasmFallingVisualsSystem : EntitySystem
component.OriginalScale = sprite.Scale;
var player = EnsureComp<AnimationPlayerComponent>(uid);
if (!TryComp<AnimationPlayerComponent>(uid, out var player))
return;
if (_anim.HasRunningAnimation(player, _chasmFallAnimationKey))
return;
@@ -44,11 +46,13 @@ public sealed class ChasmFallingVisualsSystem : EntitySystem
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
var player = EnsureComp<AnimationPlayerComponent>(uid);
if (_anim.HasRunningAnimation(player, _chasmFallAnimationKey))
_anim.Stop(player, _chasmFallAnimationKey);
sprite.Scale = component.OriginalScale;
if (!TryComp<AnimationPlayerComponent>(uid, out var player))
return;
if (_anim.HasRunningAnimation(player, _chasmFallAnimationKey))
_anim.Stop((uid, player), _chasmFallAnimationKey);
}
private Animation GetFallingAnimation(ChasmFallingComponent component)

View File

@@ -125,7 +125,7 @@ namespace Content.Client.Chat.UI
_verticalOffsetAchieved = MathHelper.Lerp(_verticalOffsetAchieved, VerticalOffset, 10 * args.DeltaSeconds);
}
if (!_entityManager.TryGetComponent<TransformComponent>(_senderEntity, out var xform) || xform.MapID != _eyeManager.CurrentMap)
if (!_entityManager.TryGetComponent<TransformComponent>(_senderEntity, out var xform) || xform.MapID != _eyeManager.CurrentEye.Position.MapId)
{
Modulate = Color.White.WithAlpha(0);
return;

View File

@@ -1,4 +1,4 @@
using System.Globalization;
using System.Globalization;
using Content.Client.UserInterface.Controls;
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
@@ -91,7 +91,7 @@ namespace Content.Client.Communications.UI
if (alerts == null)
{
var name = currentAlert;
if (Loc.TryGetString($"alert-level-{currentAlert}", out var locName))
if (_loc.TryGetString($"alert-level-{currentAlert}", out var locName))
{
name = locName;
}
@@ -103,7 +103,7 @@ namespace Content.Client.Communications.UI
foreach (var alert in alerts)
{
var name = alert;
if (Loc.TryGetString($"alert-level-{alert}", out var locName))
if (_loc.TryGetString($"alert-level-{alert}", out var locName))
{
name = locName;
}

View File

@@ -111,7 +111,7 @@ public sealed class DecalPlacementSystem : EntitySystem
if (args.Handled)
return;
if (args.Target.GetGridUid(EntityManager) == null)
if (_transform.GetGrid(args.Target) == null)
return;
args.Handled = true;

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Client.Stylesheets;
using Content.Shared.Decals;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -19,6 +20,7 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
[Dependency] private readonly IEntityManager _e = default!;
private readonly DecalPlacementSystem _decalPlacementSystem;
private readonly SpriteSystem _sprite;
public FloatSpinBox RotationSpinBox;
@@ -41,6 +43,7 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
IoCManager.InjectDependencies(this);
_decalPlacementSystem = _e.System<DecalPlacementSystem>();
_sprite = _e.System<SpriteSystem>();
// This needs to be done in C# so we can have custom stuff passed in the constructor
// and thus have a proper step size
@@ -204,7 +207,7 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
foreach (var decalPrototype in prototypes)
{
if (decalPrototype.ShowMenu)
_decals.Add(decalPrototype.ID, decalPrototype.Sprite.Frame0());
_decals.Add(decalPrototype.ID, _sprite.Frame0(decalPrototype.Sprite));
}
RefreshList();

View File

@@ -10,10 +10,7 @@ using Content.Shared.Tag;
using Content.Shared.Verbs;
using Robust.Client.GameObjects;
using Robust.Client.Player;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
@@ -27,7 +24,6 @@ public sealed class GuidebookSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly VerbSystem _verbSystem = default!;
[Dependency] private readonly RgbLightControllerSystem _rgbLightControllerSystem = default!;
[Dependency] private readonly SharedPointLightSystem _pointLightSystem = default!;

View File

@@ -1,6 +1,5 @@
using Content.Shared.Holopad;
using Content.Shared.Silicons.StationAi;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Shared.Player;
using System.Numerics;
@@ -10,7 +9,6 @@ namespace Content.Client.Holopad;
public sealed class HolopadBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
[Dependency] private readonly IClyde _displayManager = default!;
[ViewVariables]
private HolopadWindow? _window;

View File

@@ -3,6 +3,7 @@ using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -18,6 +19,9 @@ public sealed partial class MarkingPicker : Control
{
[Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SpriteSystem _sprite;
public Action<MarkingSet>? OnMarkingAdded;
public Action<MarkingSet>? OnMarkingRemoved;
@@ -124,6 +128,8 @@ public sealed partial class MarkingPicker : Control
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprite = _entityManager.System<SpriteSystem>();
CMarkingCategoryButton.OnItemSelected += OnCategoryChange;
CMarkingsUnused.OnItemSelected += item =>
_selectedUnusedMarking = CMarkingsUnused[item.ItemIndex];
@@ -222,7 +228,7 @@ public sealed partial class MarkingPicker : Control
continue;
}
var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", marking.Sprites[0].Frame0());
var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", _sprite.Frame0(marking.Sprites[0]));
item.Metadata = marking;
}
@@ -256,7 +262,7 @@ public sealed partial class MarkingPicker : Control
var _item = new ItemList.Item(CMarkingsUsed)
{
Text = text,
Icon = newMarking.Sprites[0].Frame0(),
Icon = _sprite.Frame0(newMarking.Sprites[0]),
Selectable = true,
Metadata = newMarking,
IconModulate = marking.MarkingColors[0]
@@ -512,7 +518,7 @@ public sealed partial class MarkingPicker : Control
var item = new ItemList.Item(CMarkingsUsed)
{
Text = Loc.GetString("marking-used", ("marking-name", $"{GetMarkingName(marking)}"), ("marking-category", Loc.GetString($"markings-category-{marking.MarkingCategory}"))),
Icon = marking.Sprites[0].Frame0(),
Icon = _sprite.Frame0(marking.Sprites[0]),
Selectable = true,
Metadata = marking,
};
@@ -536,7 +542,7 @@ public sealed partial class MarkingPicker : Control
if (marking.MarkingCategory == _selectedMarkingCategory)
{
var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", marking.Sprites[0].Frame0());
var item = CMarkingsUnused.AddItem($"{GetMarkingName(marking)}", _sprite.Frame0(marking.Sprites[0]));
item.Metadata = marking;
}
_selectedMarking = null;

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Shared.Humanoid.Markings;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
@@ -11,6 +12,9 @@ namespace Content.Client.Humanoid;
public sealed partial class SingleMarkingPicker : BoxContainer
{
[Dependency] private readonly MarkingManager _markingManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SpriteSystem _sprite;
/// <summary>
/// What happens if a marking is selected.
@@ -123,6 +127,7 @@ public sealed partial class SingleMarkingPicker : BoxContainer
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_sprite = _entityManager.System<SpriteSystem>();
MarkingList.OnItemSelected += SelectMarking;
AddButton.OnPressed += _ =>
{
@@ -188,7 +193,7 @@ public sealed partial class SingleMarkingPicker : BoxContainer
foreach (var (id, marking) in sortedMarkings)
{
var item = MarkingList.AddItem(Loc.GetString($"marking-{id}"), marking.Sprites[0].Frame0());
var item = MarkingList.AddItem(Loc.GetString($"marking-{id}"), _sprite.Frame0(marking.Sprites[0]));
item.Metadata = marking.ID;
if (_markings[Slot].MarkingId == id)

View File

@@ -1,13 +1,10 @@
using Content.Shared.Implants;
using Robust.Client.UserInterface;
using Robust.Shared.Prototypes;
namespace Content.Client.Implants.UI;
public sealed class DeimplantBoundUserInterface : BoundUserInterface
{
[Dependency] private readonly IPrototypeManager _protomanager = default!;
[ViewVariables]
private DeimplantChoiceWindow? _window;

View File

@@ -31,7 +31,7 @@ namespace Content.Client.Jittering
var animationPlayer = EnsureComp<AnimationPlayerComponent>(uid);
jittering.StartOffset = sprite.Offset;
_animationPlayer.Play(uid, animationPlayer, GetAnimation(jittering, sprite), _jitterAnimationKey);
_animationPlayer.Play((uid, animationPlayer), GetAnimation(jittering, sprite), _jitterAnimationKey);
}
private void OnShutdown(EntityUid uid, JitteringComponent jittering, ComponentShutdown args)
@@ -53,7 +53,7 @@ namespace Content.Client.Jittering
if (TryComp(uid, out AnimationPlayerComponent? animationPlayer)
&& TryComp(uid, out SpriteComponent? sprite))
_animationPlayer.Play(uid, animationPlayer, GetAnimation(jittering, sprite), _jitterAnimationKey);
_animationPlayer.Play((uid, animationPlayer), GetAnimation(jittering, sprite), _jitterAnimationKey);
}
private Animation GetAnimation(JitteringComponent jittering, SpriteComponent sprite)

View File

@@ -21,6 +21,7 @@ using Content.Shared.Preferences.Loadouts;
using Content.Shared.Roles;
using Content.Shared.Traits;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface;
@@ -50,6 +51,8 @@ namespace Content.Client.Lobby.UI
private readonly JobRequirementsManager _requirements;
private readonly LobbyUIController _controller;
private readonly SpriteSystem _sprite;
private FlavorText.FlavorText? _flavorText;
private TextEdit? _flavorTextEdit;
@@ -127,7 +130,7 @@ namespace Content.Client.Lobby.UI
_resManager = resManager;
_requirements = requirements;
_controller = UserInterfaceManager.GetUIController<LobbyUIController>();
_sprite = _entManager.System<SpriteSystem>();
ImportButton.OnPressed += args =>
{
ImportProfile();
@@ -906,7 +909,7 @@ namespace Content.Client.Lobby.UI
VerticalAlignment = VAlignment.Center
};
var jobIcon = _prototypeManager.Index(job.Icon);
icon.Texture = jobIcon.Icon.Frame0();
icon.Texture = _sprite.Frame0(jobIcon.Icon);
selector.Setup(items, job.LocalizedName, 200, job.LocalizedDescription, icon, job.Guides);
if (!_requirements.IsAllowed(job, (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter, out var reason))

View File

@@ -132,7 +132,7 @@ public sealed class TargetOutlineSystem : EntitySystem
// TODO: Duplicated in SpriteSystem and DragDropSystem. Should probably be cached somewhere for a frame?
var mousePos = _eyeManager.PixelToMap(_inputManager.MouseScreenPosition).Position;
var bounds = new Box2(mousePos - LookupVector, mousePos + LookupVector);
var pvsEntities = _lookup.GetEntitiesIntersecting(_eyeManager.CurrentMap, bounds, LookupFlags.Approximate | LookupFlags.Static);
var pvsEntities = _lookup.GetEntitiesIntersecting(_eyeManager.CurrentEye.Position.MapId, bounds, LookupFlags.Approximate | LookupFlags.Static);
var spriteQuery = GetEntityQuery<SpriteComponent>();
foreach (var entity in pvsEntities)

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Threading;
using System.Collections.Generic;
using System.Diagnostics;

View File

@@ -85,7 +85,7 @@ public sealed class PopupOverlay : Overlay
foreach (var popup in _popup.WorldLabels)
{
var mapPos = popup.InitialPos.ToMap(_entManager, _transform);
var mapPos = _transform.ToMapCoordinates(popup.InitialPos);
if (mapPos.MapId != args.MapId)
continue;

View File

@@ -56,10 +56,10 @@ public sealed class RadiationCollectorSystem : VisualizerSystem<RadiationCollect
switch (targetState)
{
case RadiationCollectorVisualState.Activating:
AnimationSystem.Play(uid, animPlayer, comp.ActivateAnimation, RadiationCollectorComponent.AnimationKey);
AnimationSystem.Play((uid, animPlayer), comp.ActivateAnimation, RadiationCollectorComponent.AnimationKey);
break;
case RadiationCollectorVisualState.Deactivating:
AnimationSystem.Play(uid, animPlayer, comp.DeactiveAnimation, RadiationCollectorComponent.AnimationKey);
AnimationSystem.Play((uid, animPlayer), comp.DeactiveAnimation, RadiationCollectorComponent.AnimationKey);
break;
case RadiationCollectorVisualState.Active:

View File

@@ -11,6 +11,8 @@ namespace Content.Client.SprayPainter.UI;
public sealed partial class SprayPainterWindow : DefaultWindow
{
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;
private readonly SpriteSystem _spriteSystem;
public Action<ItemList.ItemListSelectedEventArgs>? OnSpritePicked;
@@ -32,17 +34,17 @@ public sealed partial class SprayPainterWindow : DefaultWindow
_spriteSystem = _sysMan.GetEntitySystem<SpriteSystem>();
}
private static string GetColorLocString(string? colorKey)
private string GetColorLocString(string? colorKey)
{
if (string.IsNullOrEmpty(colorKey))
return Loc.GetString("pipe-painter-no-color-selected");
var locKey = colorLocKeyPrefix + colorKey;
if (!Loc.TryGetString(locKey, out var locString))
if (!_loc.TryGetString(locKey, out var locString))
locString = colorKey;
return locString;
}
}
public string? IndexToColorKey(int index)
{

View File

@@ -482,7 +482,7 @@ public sealed class ChatUIController : UIController
private void EnqueueSpeechBubble(EntityUid entity, ChatMessage message, SpeechBubble.SpeechType speechType)
{
// Don't enqueue speech bubbles for other maps. TODO: Support multiple viewports/maps?
if (EntityManager.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentMap)
if (EntityManager.GetComponent<TransformComponent>(entity).MapID != _eye.CurrentEye.Position.MapId)
return;
if (!_queuedSpeechBubbles.TryGetValue(entity, out var queueData))

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Numerics;
using Content.Client.Hands.Systems;

View File

@@ -3,7 +3,6 @@ using Content.Client.UserInterface.Systems.Gameplay;
using Content.Shared.CCVar;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
@@ -17,7 +16,6 @@ public sealed class ViewportUIController : UIController
[Dependency] private readonly IPlayerManager _playerMan = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
[UISystemDependency] private readonly SharedTransformSystem? _transformSystem = default!;
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
public const int ViewportHeight = 15;
private MainViewport? Viewport => UIManager.ActiveScreen?.GetWidget<MainViewport>();