mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-10 10:51:14 +03:00
# Conflicts: # Content.Server/GameTicking/Rules/NukeopsRuleSystem.cs # Resources/Prototypes/Catalog/VendingMachines/Inventories/detdrobe.yml # Resources/Prototypes/Entities/Clothing/Masks/specific.yml # Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml # Resources/Prototypes/GameRules/midround.yml # Resources/Prototypes/Roles/Jobs/Security/head_of_security.yml # Resources/Prototypes/Roles/Jobs/Security/warden.yml # Resources/Prototypes/StatusEffects/health.yml # Resources/Prototypes/StatusIcon/antag.yml # Resources/ServerInfo/Guidebook/Antagonist/Antagonists.xml # Resources/ServerInfo/Guidebook/Antagonist/SpaceNinja.xml # Resources/ServerInfo/Guidebook/Engineering/AME.xml # Resources/ServerInfo/Guidebook/Engineering/AccessConfigurator.xml # Resources/ServerInfo/Guidebook/Engineering/AirlockSecurity.xml # Resources/ServerInfo/Guidebook/Engineering/Atmospherics.xml # Resources/ServerInfo/Guidebook/Engineering/Construction.xml # Resources/ServerInfo/Guidebook/Engineering/Engineering.xml # Resources/ServerInfo/Guidebook/Engineering/Fires.xml # Resources/ServerInfo/Guidebook/Engineering/NetworkConfigurator.xml # Resources/ServerInfo/Guidebook/Engineering/Networking.xml # Resources/ServerInfo/Guidebook/Engineering/PortableGenerator.xml # Resources/ServerInfo/Guidebook/Engineering/Power.xml # Resources/ServerInfo/Guidebook/Engineering/Shuttlecraft.xml # Resources/ServerInfo/Guidebook/Engineering/Singularity.xml # Resources/ServerInfo/Guidebook/Engineering/TEG.xml # Resources/ServerInfo/Guidebook/Science/ArtifactReports.xml # Resources/ServerInfo/Guidebook/Science/TraversalDistorter.xml # Resources/ServerInfo/Guidebook/Science/Xenoarchaeology.xml # Resources/ServerInfo/Guidebook/Security/Forensics.xml # Resources/Textures/Objects/Specific/Hydroponics/chili.rsi/produce.png
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
using Content.Server.Actions;
|
|
using Content.Shared.Clothing;
|
|
using Content.Shared.Inventory;
|
|
|
|
namespace Content.Server.VoiceMask;
|
|
|
|
// This partial deals with equipment, i.e., the syndicate voice mask.
|
|
public sealed partial class VoiceMaskSystem
|
|
{
|
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
|
[Dependency] private readonly ActionsSystem _actions = default!;
|
|
|
|
private const string MaskSlot = "mask";
|
|
|
|
private void OnEquip(EntityUid uid, VoiceMaskerComponent component, ClothingGotEquippedEvent args)
|
|
{
|
|
var user = args.Wearer;
|
|
var comp = EnsureComp<VoiceMaskComponent>(user);
|
|
comp.VoiceName = component.LastSetName;
|
|
comp.SpeechVerb = component.LastSpeechVerb;
|
|
// Corvax-TTS-Start
|
|
if (component.LastSetVoice != null)
|
|
comp.VoiceId = component.LastSetVoice;
|
|
// Corvax-TTS-End
|
|
|
|
_actions.AddAction(user, ref component.ActionEntity, component.Action, uid);
|
|
}
|
|
|
|
private void OnUnequip(EntityUid uid, VoiceMaskerComponent compnent, ClothingGotUnequippedEvent args)
|
|
{
|
|
RemComp<VoiceMaskComponent>(args.Wearer);
|
|
}
|
|
|
|
private VoiceMaskerComponent? TryGetMask(EntityUid user)
|
|
{
|
|
if (!HasComp<VoiceMaskComponent>(user) || !_inventory.TryGetSlotEntity(user, MaskSlot, out var maskEntity))
|
|
return null;
|
|
|
|
return CompOrNull<VoiceMaskerComponent>(maskEntity);
|
|
}
|
|
|
|
private void TrySetLastKnownName(EntityUid user, string name)
|
|
{
|
|
if (TryGetMask(user) is {} comp)
|
|
comp.LastSetName = name;
|
|
}
|
|
|
|
private void TrySetLastSpeechVerb(EntityUid user, string? verb)
|
|
{
|
|
if (TryGetMask(user) is {} comp)
|
|
comp.LastSpeechVerb = verb;
|
|
}
|
|
}
|