Skip to content

Commit

Permalink
Merge pull request #21 from impstation/master
Browse files Browse the repository at this point in the history
Please fix
  • Loading branch information
AirFryerBuyOneGetOneFree authored Oct 21, 2024
2 parents 4bf6bf5 + 3956879 commit 0563748
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 29 deletions.
48 changes: 48 additions & 0 deletions Content.IntegrationTests/Tests/_Impstation/VoiceMaskTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Content.Server.VoiceMask;
using Content.Shared.Chat;
using Content.Shared.Inventory;
using Robust.Shared.GameObjects;

namespace Content.IntegrationTests.Tests._Impstation;

[TestFixture, TestOf(typeof(VoiceMaskSystem))]
public sealed class VoiceMaskTests
{
[Test]
public async Task TestVoiceMaskTransform()
{
await using var pair = await PoolManager.GetServerClient();
var server = pair.Server;
var entMan = server.ResolveDependency<IEntityManager>();

var invSys = entMan.System<InventorySystem>();

await server.WaitAssertion(() =>
{
var urist = entMan.Spawn("MobHuman");
var meta = (MetaDataComponent)entMan.GetComponent(urist, typeof(MetaDataComponent));
var mask = entMan.Spawn("ClothingMaskGasVoiceChameleon");
var maskVoice = entMan.GetComponent<VoiceMaskComponent>(mask);
maskVoice.VoiceMaskName = "Urist McVoicemask";

// Fire a transform name event
var nameEv = new TransformSpeakerNameEvent(urist, meta.EntityName);
entMan.EventBus.RaiseLocalEvent(urist, nameEv, false);

// Mask has not been equipped, name should be same as entity name
Assert.That(nameEv.VoiceName, Is.EqualTo(meta.EntityName));

// Equip the voice mask
Assert.That(invSys.TryEquip(urist, mask, "head", force: true), Is.True);

// Fire another transform name event
nameEv = new TransformSpeakerNameEvent(urist, meta.EntityName);
entMan.EventBus.RaiseLocalEvent(urist, nameEv, false);

// Mask is equipped, name should be transformed to mask name
Assert.That(nameEv.VoiceName, Is.EqualTo(maskVoice.VoiceMaskName));
});

await pair.CleanReturnAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
using Content.Server.Kitchen.EntitySystems;
using Content.Server.Mind;
using Content.Server.Revenant.Components;
using Content.Server.VoiceMask;
using Content.Server.Speech.Components;
using Content.Shared.Alert;
using Content.Shared.Chat;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Interaction;
Expand All @@ -20,6 +21,7 @@
using Content.Shared.StatusEffect;
using Content.Shared.Tag;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;

namespace Content.Server.Revenant.EntitySystems;

Expand All @@ -34,6 +36,7 @@ public sealed partial class RevenantStasisSystem : EntitySystem
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
[Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!;
[Dependency] private readonly IPrototypeManager _protoMan = default!;

[ValidatePrototypeId<StatusEffectPrototype>]
private const string RevenantStasisId = "Stasis";
Expand All @@ -49,6 +52,7 @@ public override void Initialize()
SubscribeLocalEvent<RevenantStasisComponent, ExaminedEvent>(OnExamine);
SubscribeLocalEvent<RevenantStasisComponent, ConstructionConsumedObjectEvent>(OnCrafted);
SubscribeLocalEvent<RevenantStasisComponent, GrindAttemptEvent>(OnGrindAttempt);
SubscribeLocalEvent<RevenantStasisComponent, TransformSpeakerNameEvent>(OnTransformName);

SubscribeLocalEvent<RevenantStasisComponent, AfterInteractUsingEvent>(OnBibleInteract, before: [typeof(BibleSystem)]);
SubscribeLocalEvent<RevenantStasisComponent, ExorciseRevenantDoAfterEvent>(OnExorcise);
Expand All @@ -69,13 +73,16 @@ private void OnStartup(EntityUid uid, RevenantStasisComponent component, Compone
speech.SpeechVerb = "Ghost";
Dirty(uid, speech);

var voice = EnsureComp<VoiceMaskComponent>(uid);
voice.VoiceMaskName = Comp<MetaDataComponent>(component.Revenant).EntityName;

if (TryComp<GhostRoleComponent>(uid, out var ghostRole))
_ghostRoles.UnregisterGhostRole((uid, ghostRole));
}

private void OnTransformName(EntityUid uid, RevenantStasisComponent comp, TransformSpeakerNameEvent args)
{
args.VoiceName = Name(comp.Revenant);
args.SpeechVerb = "Ghost";
}

private void OnShutdown(EntityUid uid, RevenantStasisComponent component, ComponentShutdown args)
{
if (_statusEffects.HasStatusEffect(uid, RevenantStasisId))
Expand Down Expand Up @@ -107,15 +114,11 @@ private void OnExamine(Entity<RevenantStasisComponent> entity, ref ExaminedEvent
private void OnCrafted(EntityUid uid, RevenantStasisComponent comp, ConstructionConsumedObjectEvent args)
{
// Permanently sealed into revenant plushie

var speech = EnsureComp<SpeechComponent>(args.New);
speech.SpeechVerb = "Ghost";
Dirty(args.New, speech);

EnsureComp<InputMoverComponent>(args.New);

var voice = EnsureComp<VoiceMaskComponent>(args.New);
voice.VoiceMaskName = Comp<MetaDataComponent>(comp.Revenant).EntityName;
var voice = EnsureComp<VoiceOverrideComponent>(args.New);
voice.SpeechVerbOverride = "Ghost";
voice.NameOverride = Name(comp.Revenant);

if (_mind.TryGetMind(uid, out var mindId, out var _))
_mind.TransferTo(mindId, args.New);
Expand Down
1 change: 1 addition & 0 deletions Content.Shared/Inventory/InventorySystem.Relay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void InitializeRelay()
SubscribeLocalEvent<InventoryComponent, ModifyChangedTemperatureEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, GetDefaultRadioChannelEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, RefreshNameModifiersEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, TransformSpeakerNameEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, CheckMagicItemEvent>(RelayInventoryEvent); // goob edit

// by-ref events
Expand Down
7 changes: 7 additions & 0 deletions Resources/Changelog/Impstation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3253,3 +3253,10 @@
id: 402
time: '2024-10-21T00:18:34.0000000+00:00'
url: https://github.com/impstation/imp-station-14/pull/522
- author: TGRCdev
changes:
- message: Voice masks actually work again
type: Fix
id: 403
time: '2024-10-21T00:54:11.0000000+00:00'
url: https://github.com/impstation/imp-station-14/pull/533
1 change: 1 addition & 0 deletions Resources/Prototypes/Entities/Objects/Fun/toys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
stash: !type:ContainerSlot {}
- type: Speech
speechVerb: Default # for pais (In the secret stash)
speechSounds: Plushie # impstation edit
- type: SecretStash
secretStashName: secret-stash-plushie
blacklist:
Expand Down
18 changes: 0 additions & 18 deletions Resources/Prototypes/Voice/speech_sounds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,3 @@
path: /Audio/Animals/chicken_cluck_happy.ogg
exclaimSound:
path: /Audio/Animals/chicken_cluck_happy.ogg

- type: speechSounds
id: Finfin
saySound:
path: /Audio/Animals/finfin1.ogg
askSound:
path: /Audio/Animals/finfin2.ogg
exclaimSound:
path: /Audio/Animals/finfin3.ogg

- type: speechSounds
id: Bros
saySound:
path: /Audio/Animals/bros_hit.ogg
askSound:
path: /Audio/Animals/bros_hit.ogg
exclaimSound:
path: /Audio/Animals/bros_hit.ogg
26 changes: 26 additions & 0 deletions Resources/Prototypes/_Impstation/Voice/speech_sounds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- type: speechSounds
id: Finfin
saySound:
path: /Audio/Animals/finfin1.ogg
askSound:
path: /Audio/Animals/finfin2.ogg
exclaimSound:
path: /Audio/Animals/finfin3.ogg

- type: speechSounds
id: Bros
saySound:
path: /Audio/Animals/bros_hit.ogg
askSound:
path: /Audio/Animals/bros_hit.ogg
exclaimSound:
path: /Audio/Animals/bros_hit.ogg

- type: speechSounds
id: Plushie
saySound:
collection: ToySqueak
askSound:
collection: ToySqueak
exclaimSound:
collection: ToySqueak

0 comments on commit 0563748

Please sign in to comment.