fix voice mask working in pockets (#14743)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -18,7 +18,12 @@ public sealed partial class VoiceMaskSystem
|
|||||||
|
|
||||||
private void OnEquip(EntityUid uid, VoiceMaskerComponent component, GotEquippedEvent args)
|
private void OnEquip(EntityUid uid, VoiceMaskerComponent component, GotEquippedEvent args)
|
||||||
{
|
{
|
||||||
var comp = EnsureComp<VoiceMaskComponent>(args.Equipee);
|
var user = args.Equipee;
|
||||||
|
// have to be wearing the mask to use it, duh.
|
||||||
|
if (!_inventory.TryGetSlotEntity(user, MaskSlot, out var maskEntity) || maskEntity != uid)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var comp = EnsureComp<VoiceMaskComponent>(user);
|
||||||
comp.VoiceName = component.LastSetName;
|
comp.VoiceName = component.LastSetName;
|
||||||
|
|
||||||
if (!_prototypeManager.TryIndex<InstantActionPrototype>(component.Action, out var action))
|
if (!_prototypeManager.TryIndex<InstantActionPrototype>(component.Action, out var action))
|
||||||
@@ -26,7 +31,7 @@ public sealed partial class VoiceMaskSystem
|
|||||||
throw new ArgumentException("Could not get voice masking prototype.");
|
throw new ArgumentException("Could not get voice masking prototype.");
|
||||||
}
|
}
|
||||||
|
|
||||||
_actions.AddAction(args.Equipee, (InstantAction) action.Clone(), uid);
|
_actions.AddAction(user, (InstantAction) action.Clone(), uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnUnequip(EntityUid uid, VoiceMaskerComponent compnent, GotUnequippedEvent args)
|
private void OnUnequip(EntityUid uid, VoiceMaskerComponent compnent, GotUnequippedEvent args)
|
||||||
|
|||||||
Reference in New Issue
Block a user