2022-08-16 22:19:54 +12:00
|
|
|
using Content.Client.Items;
|
2021-10-07 13:01:27 +02:00
|
|
|
using Content.Client.Tools.Components;
|
2022-09-11 08:53:17 +02:00
|
|
|
using Content.Client.Tools.UI;
|
2021-10-07 13:01:27 +02:00
|
|
|
using Content.Shared.Tools.Components;
|
2022-08-16 22:19:54 +12:00
|
|
|
using Robust.Client.GameObjects;
|
2023-10-24 00:20:33 +11:00
|
|
|
using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem;
|
2021-10-07 13:01:27 +02:00
|
|
|
|
|
|
|
|
namespace Content.Client.Tools
|
|
|
|
|
{
|
2022-08-16 22:19:54 +12:00
|
|
|
public sealed class ToolSystem : SharedToolSystem
|
2021-10-07 13:01:27 +02:00
|
|
|
{
|
2025-05-19 19:52:03 -04:00
|
|
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
|
|
|
|
|
2021-10-07 13:01:27 +02:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2024-04-21 15:16:23 +02:00
|
|
|
Subs.ItemStatus<WelderComponent>(ent => new WelderStatusControl(ent, EntityManager, this));
|
2024-01-12 01:14:13 +01:00
|
|
|
Subs.ItemStatus<MultipleToolComponent>(ent => new MultipleToolStatusControl(ent));
|
2022-08-16 22:19:54 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetMultipleTool(EntityUid uid,
|
2022-12-24 23:28:21 -05:00
|
|
|
MultipleToolComponent? multiple = null,
|
2022-08-16 22:19:54 +12:00
|
|
|
ToolComponent? tool = null,
|
|
|
|
|
bool playSound = false,
|
|
|
|
|
EntityUid? user = null)
|
|
|
|
|
{
|
|
|
|
|
if (!Resolve(uid, ref multiple))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
base.SetMultipleTool(uid, multiple, tool, playSound, user);
|
2022-12-24 23:28:21 -05:00
|
|
|
multiple.UiUpdateNeeded = true;
|
2022-08-16 22:19:54 +12:00
|
|
|
|
|
|
|
|
// 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)
|
2025-05-19 19:52:03 -04:00
|
|
|
_sprite.LayerSetSprite((uid, sprite), 0, current.Sprite);
|
2022-08-16 22:19:54 +12:00
|
|
|
}
|
|
|
|
|
}
|
2021-10-07 13:01:27 +02:00
|
|
|
}
|
|
|
|
|
}
|