diff --git a/Content.Server/Speech/Components/SecretMessageListenerComponent.cs b/Content.Server/Speech/Components/SecretMessageListenerComponent.cs new file mode 100644 index 00000000000..902ba61b1ce --- /dev/null +++ b/Content.Server/Speech/Components/SecretMessageListenerComponent.cs @@ -0,0 +1,6 @@ +namespace Content.Server.Speech.Components; + +[RegisterComponent] +public sealed partial class SecretMessageListenerComponent : Component +{ +} diff --git a/Content.Server/Speech/Components/SecretMessageSource.cs b/Content.Server/Speech/Components/SecretMessageSource.cs new file mode 100644 index 00000000000..3d220484083 --- /dev/null +++ b/Content.Server/Speech/Components/SecretMessageSource.cs @@ -0,0 +1,6 @@ +namespace Content.Server.Speech.Components; + +[RegisterComponent] +public sealed partial class SecretMessageSourceComponent : Component +{ +} diff --git a/Content.Server/Speech/EntitySystems/ListeningSystem.cs b/Content.Server/Speech/EntitySystems/ListeningSystem.cs index ea3569e055c..239fefa69ad 100644 --- a/Content.Server/Speech/EntitySystems/ListeningSystem.cs +++ b/Content.Server/Speech/EntitySystems/ListeningSystem.cs @@ -18,10 +18,13 @@ public override void Initialize() private void OnSpeak(EntitySpokeEvent ev) { - PingListeners(ev.Source, ev.Message, ev.ObfuscatedMessage); + if (HasComp(ev.Source)) + PingListeners(ev.Source, ev.Message, ev.ObfuscatedMessage, true); + else + PingListeners(ev.Source, ev.Message, ev.ObfuscatedMessage, false); } - public void PingListeners(EntityUid source, string message, string? obfuscatedMessage) + public void PingListeners(EntityUid source, string message, string? obfuscatedMessage, bool secretMessage) { // TODO whispering / audio volume? Microphone sensitivity? // for now, whispering just arbitrarily reduces the listener's max range. @@ -34,29 +37,56 @@ public void PingListeners(EntityUid source, string message, string? obfuscatedMe var ev = new ListenEvent(message, source); var obfuscatedEv = obfuscatedMessage == null ? null : new ListenEvent(obfuscatedMessage, source); var query = EntityQueryEnumerator(); + + if (secretMessage){ + while(query.MoveNext(out var listenerUid, out var listener, out var xform)) + { + if (xform.MapID != sourceXform.MapID) + continue; - while(query.MoveNext(out var listenerUid, out var listener, out var xform)) - { - if (xform.MapID != sourceXform.MapID) - continue; - - // range checks - // TODO proper speech occlusion - var distance = (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).LengthSquared(); - if (distance > listener.Range * listener.Range) - continue; - - RaiseLocalEvent(listenerUid, attemptEv); - if (attemptEv.Cancelled) - { - attemptEv.Uncancel(); - continue; - } - - if (obfuscatedEv != null && distance > ChatSystem.WhisperClearRange) - RaiseLocalEvent(listenerUid, obfuscatedEv); - else - RaiseLocalEvent(listenerUid, ev); - } + // range checks + // TODO proper speech occlusion + var distance = (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).LengthSquared(); + if ((distance > listener.Range * listener.Range) || HasComp(listenerUid)) + continue; + + RaiseLocalEvent(listenerUid, attemptEv); + if (attemptEv.Cancelled) + { + attemptEv.Uncancel(); + continue; + } + + if (obfuscatedEv != null && distance > ChatSystem.WhisperClearRange) + RaiseLocalEvent(listenerUid, obfuscatedEv); + else + RaiseLocalEvent(listenerUid, ev); + } + } + else{ + while(query.MoveNext(out var listenerUid, out var listener, out var xform)) + { + if (xform.MapID != sourceXform.MapID) + continue; + + // range checks + // TODO proper speech occlusion + var distance = (sourcePos - _xforms.GetWorldPosition(xform, xformQuery)).LengthSquared(); + if (distance > listener.Range * listener.Range) + continue; + + RaiseLocalEvent(listenerUid, attemptEv); + if (attemptEv.Cancelled) + { + attemptEv.Uncancel(); + continue; + } + + if (obfuscatedEv != null && distance > ChatSystem.WhisperClearRange) + RaiseLocalEvent(listenerUid, obfuscatedEv); + else + RaiseLocalEvent(listenerUid, ev); + } + } } } diff --git a/Content.Server/Testing/Components/ChangeSkinColorComponent.cs b/Content.Server/Testing/Components/ChangeSkinColorComponent.cs new file mode 100644 index 00000000000..f7300440733 --- /dev/null +++ b/Content.Server/Testing/Components/ChangeSkinColorComponent.cs @@ -0,0 +1,8 @@ +namespace Content.Server.Testing.Components; + + +[RegisterComponent] +public sealed partial class ChangeSkinColorComponent : Component +{ + +} diff --git a/Content.Server/Testing/EntitySystems/ChangeSkinColorSystem.cs b/Content.Server/Testing/EntitySystems/ChangeSkinColorSystem.cs new file mode 100644 index 00000000000..7e040fe51c4 --- /dev/null +++ b/Content.Server/Testing/EntitySystems/ChangeSkinColorSystem.cs @@ -0,0 +1,26 @@ +using Content.Server.Testing.Components; +using Content.Shared.Interaction.Events; +using Content.Server.Humanoid; +using Content.Shared.Humanoid; + +namespace Content.Server.Testing.EntitySystems; + +public sealed class ChangeSkinColorSystem : EntitySystem +{ + [Dependency] private readonly HumanoidAppearanceSystem _humanoidAppearance = default!; + + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnUseInHand); + } + + private void OnUseInHand(EntityUid entity, ChangeSkinColorComponent comp, UseInHandEvent args) + { + if (TryComp(entity, out var appcomp)) + { + Logger.Info("Got event!"); + _humanoidAppearance.SetSkinColor(entity, Color.Brown, verify: false); + } + } +} diff --git a/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/fun/suspicious_bike_horn.yml b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/fun/suspicious_bike_horn.yml new file mode 100644 index 00000000000..93b86965ec2 --- /dev/null +++ b/Resources/Locale/ru-RU/ss14-ru/prototypes/entities/objects/fun/suspicious_bike_horn.yml @@ -0,0 +1,2 @@ +ent-SuspiciousBikeHorn = подозрительный велосипедный клаксон + .desc = Клаксон с велосипеда. Наверное. Хонк! \ No newline at end of file diff --git a/Resources/Prototypes/Entities/Objects/Fun/suspicious_bike_horn.yml b/Resources/Prototypes/Entities/Objects/Fun/suspicious_bike_horn.yml new file mode 100644 index 00000000000..4e5685fa692 --- /dev/null +++ b/Resources/Prototypes/Entities/Objects/Fun/suspicious_bike_horn.yml @@ -0,0 +1,10 @@ +- type: entity + parent: BaseItem + id: SuspiciousBikeHorn + name: sus bike horn + description: A horn off of a bicycle. + components: + - type: ChangeSkinColor + - type: Sprite + sprite: Objects/Fun/bikehorn.rsi + state: icon \ No newline at end of file