Update trivial components to use auto comp states (#20539)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tools.Components;
|
||||
using Robust.Shared.GameStates;
|
||||
using Content.Shared.Prying.Components;
|
||||
|
||||
namespace Content.Shared.Tools;
|
||||
@@ -12,16 +11,11 @@ public abstract partial class SharedToolSystem : EntitySystem
|
||||
{
|
||||
SubscribeLocalEvent<MultipleToolComponent, ComponentStartup>(OnMultipleToolStartup);
|
||||
SubscribeLocalEvent<MultipleToolComponent, ActivateInWorldEvent>(OnMultipleToolActivated);
|
||||
SubscribeLocalEvent<MultipleToolComponent, ComponentGetState>(OnMultipleToolGetState);
|
||||
SubscribeLocalEvent<MultipleToolComponent, ComponentHandleState>(OnMultipleToolHandleState);
|
||||
SubscribeLocalEvent<MultipleToolComponent, AfterAutoHandleStateEvent>(OnMultipleToolHandleState);
|
||||
}
|
||||
|
||||
private void OnMultipleToolHandleState(EntityUid uid, MultipleToolComponent component, ref ComponentHandleState args)
|
||||
private void OnMultipleToolHandleState(EntityUid uid, MultipleToolComponent component, ref AfterAutoHandleStateEvent args)
|
||||
{
|
||||
if (args.Current is not MultipleToolComponentState state)
|
||||
return;
|
||||
|
||||
component.CurrentEntry = state.Selected;
|
||||
SetMultipleTool(uid, component);
|
||||
}
|
||||
|
||||
@@ -40,11 +34,6 @@ public abstract partial class SharedToolSystem : EntitySystem
|
||||
args.Handled = CycleMultipleTool(uid, multiple, args.User);
|
||||
}
|
||||
|
||||
private void OnMultipleToolGetState(EntityUid uid, MultipleToolComponent multiple, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new MultipleToolComponentState(multiple.CurrentEntry);
|
||||
}
|
||||
|
||||
public bool CycleMultipleTool(EntityUid uid, MultipleToolComponent? multiple = null, EntityUid? user = null)
|
||||
{
|
||||
if (!Resolve(uid, ref multiple))
|
||||
@@ -77,7 +66,7 @@ public abstract partial class SharedToolSystem : EntitySystem
|
||||
}
|
||||
|
||||
var current = multiple.Entries[multiple.CurrentEntry];
|
||||
tool.UseSound = current.Sound;
|
||||
tool.UseSound = current.UseSound;
|
||||
tool.Qualities = current.Behavior;
|
||||
|
||||
// TODO: Replace this with a better solution later
|
||||
|
||||
Reference in New Issue
Block a user