Refactor actions to be entities with components (#19900)
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
using Content.Server.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.Inventory;
|
||||
using Content.Shared.Inventory.Events;
|
||||
using Content.Shared.Speech;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.VoiceMask;
|
||||
|
||||
@@ -12,7 +9,6 @@ public sealed partial class VoiceMaskSystem
|
||||
{
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly ActionsSystem _actions = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
private const string MaskSlot = "mask";
|
||||
|
||||
@@ -26,12 +22,7 @@ public sealed partial class VoiceMaskSystem
|
||||
var comp = EnsureComp<VoiceMaskComponent>(user);
|
||||
comp.VoiceName = component.LastSetName;
|
||||
|
||||
if (!_prototypeManager.TryIndex<InstantActionPrototype>(component.Action, out var action))
|
||||
{
|
||||
throw new ArgumentException("Could not get voice masking prototype.");
|
||||
}
|
||||
|
||||
_actions.AddAction(user, (InstantAction) action.Clone(), uid);
|
||||
_actions.AddAction(user, ref component.ActionEntity, component.Action, uid);
|
||||
}
|
||||
|
||||
private void OnUnequip(EntityUid uid, VoiceMaskerComponent compnent, GotUnequippedEvent args)
|
||||
|
||||
Reference in New Issue
Block a user