Files
tbd-station-14/Content.Client/Tools/ToolSystem.cs
Tayrtahn c5ac160ea8 Cleanup more SpriteComponent warnings (part 6) (#37607)
* 1 warning in MechAssemblyVisualizerSystem

* 2 warnings in RecyclerVisualizerSystem

* 1 warning in ClusterGrenadeVisualizerSystem

* 2 warnings in BarSignSystem

* 4 warnings in AlertControl

* 1 warning in ToolSystem

* 2 warnings in PinpointerSystem

* 2 warnings in ClientSpriteMovementSystem

* 2 warnings in OptionsVisualizerSystem

* 1 warning in FlatpackSystem

* 1 warning in ZombieSystem

* 1 warning in StackSystem

* 1 warning in MiningOverlay

* 1 warning in FlippableClothingVisualizerSystem

* Guard clause for MechAssemblyVisualizerSystem

* Get SpriteSystem in AlertControl constructor
2025-05-20 01:52:03 +02:00

46 lines
1.6 KiB
C#

using Content.Client.Items;
using Content.Client.Tools.Components;
using Content.Client.Tools.UI;
using Content.Shared.Tools.Components;
using Robust.Client.GameObjects;
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
namespace Content.Client.Tools
{
public sealed class ToolSystem : SharedToolSystem
{
[Dependency] private readonly SpriteSystem _sprite = default!;
public override void Initialize()
{
base.Initialize();
Subs.ItemStatus<WelderComponent>(ent => new WelderStatusControl(ent, EntityManager, this));
Subs.ItemStatus<MultipleToolComponent>(ent => new MultipleToolStatusControl(ent));
}
public override void SetMultipleTool(EntityUid uid,
MultipleToolComponent? multiple = null,
ToolComponent? tool = null,
bool playSound = false,
EntityUid? user = null)
{
if (!Resolve(uid, ref multiple))
return;
base.SetMultipleTool(uid, multiple, tool, playSound, user);
multiple.UiUpdateNeeded = true;
// TODO replace this with appearance + visualizer
// in order to convert this to a specifier, the manner in which the sprite is specified in yaml needs to be updated.
if (multiple.Entries.Length > multiple.CurrentEntry && TryComp(uid, out SpriteComponent? sprite))
{
var current = multiple.Entries[multiple.CurrentEntry];
if (current.Sprite != null)
_sprite.LayerSetSprite((uid, sprite), 0, current.Sprite);
}
}
}
}