Move MultipleTool to shared (#9964)
This commit is contained in:
@@ -1,17 +1,48 @@
|
||||
using Content.Client.Items;
|
||||
using Content.Client.Tools.Components;
|
||||
using Content.Shared.Tools;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Client.Tools
|
||||
{
|
||||
public sealed class ToolSystem : EntitySystem
|
||||
public sealed class ToolSystem : SharedToolSystem
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<WelderComponent, ComponentHandleState>(OnWelderHandleState);
|
||||
SubscribeLocalEvent<MultipleToolComponent, ItemStatusCollectMessage>(OnGetStatusMessage);
|
||||
}
|
||||
|
||||
public override void SetMultipleTool(EntityUid uid,
|
||||
SharedMultipleToolComponent? multiple = null,
|
||||
ToolComponent? tool = null,
|
||||
bool playSound = false,
|
||||
EntityUid? user = null)
|
||||
{
|
||||
if (!Resolve(uid, ref multiple))
|
||||
return;
|
||||
|
||||
base.SetMultipleTool(uid, multiple, tool, playSound, user);
|
||||
((MultipleToolComponent)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(0, current.Sprite);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetStatusMessage(EntityUid uid, MultipleToolComponent welder, ItemStatusCollectMessage args)
|
||||
{
|
||||
args.Controls.Add(new MultipleToolStatusControl(welder));
|
||||
}
|
||||
|
||||
private void OnWelderHandleState(EntityUid uid, WelderComponent welder, ref ComponentHandleState args)
|
||||
|
||||
Reference in New Issue
Block a user