diff --git a/Content.Server/_Amour/Animation/SharebleAnimationSystem.cs b/Content.Server/_Amour/Animation/SharebleAnimationSystem.cs index 164b24d95a..40353913bf 100644 --- a/Content.Server/_Amour/Animation/SharebleAnimationSystem.cs +++ b/Content.Server/_Amour/Animation/SharebleAnimationSystem.cs @@ -8,24 +8,6 @@ namespace Content.Server._Amour.Animation; public sealed class SharebleAnimationSystem : SharedAnimationSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - - public override void Initialize() - { - SubscribeLocalEvent>(OnVerb); - } - - private void OnVerb(EntityUid uid, HoleContainerComponent component, GetVerbsEvent args) - { - if(!_prototypeManager.TryIndex("meow",out var prototype)) - return; - - args.Verbs.Add(new Verb() - { - Text = "MEOW ABOUT IT", - Act = () => Play(uid, prototype) - }); - } - public override void Play(EntityUid uid, ProtoId protoId) { RaiseNetworkEvent(new AnimationProtoStartMessage(GetNetEntity(uid),protoId)); diff --git a/Content.Server/_Amour/InteractionPanel/InteractionPanelSystem.cs b/Content.Server/_Amour/InteractionPanel/InteractionPanelSystem.cs index 8fdb768aee..c532de75b8 100644 --- a/Content.Server/_Amour/InteractionPanel/InteractionPanelSystem.cs +++ b/Content.Server/_Amour/InteractionPanel/InteractionPanelSystem.cs @@ -1,14 +1,18 @@ using System.Linq; +using Content.Server.Access.Systems; using Content.Server.Chat.Systems; using Content.Server.EUI; using Content.Shared._Amour.Hole; using Content.Shared._Amour.InteractionPanel; using Content.Shared.Emoting; +using Content.Shared.Humanoid; +using Content.Shared.Mind; using Content.Shared.Random.Helpers; using Content.Shared.Verbs; using Robust.Server.Audio; using Robust.Server.Player; using Robust.Shared.Audio; +using Robust.Shared.Enums; using Robust.Shared.Prototypes; using Robust.Shared.Random; using Robust.Shared.Timing; @@ -24,6 +28,7 @@ public sealed class InteractionPanelSystem : EntitySystem [Dependency] private readonly ChatSystem _chatSystem = default!; [Dependency] private readonly AudioSystem _audioSystem = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly IdCardSystem _cardSystem = default!; public override void Initialize() { @@ -34,6 +39,7 @@ public sealed class InteractionPanelSystem : EntitySystem private void OnInit(EntityUid uid, InteractionPanelComponent component, ComponentInit args) { component.Timeout = _gameTiming.CurTime; + component.EndTime = _gameTiming.CurTime; } private void OnVerb(EntityUid uid, InteractionPanelComponent component, GetVerbsEvent args) @@ -66,32 +72,61 @@ public sealed class InteractionPanelSystem : EntitySystem || !Resolve(target,ref target.Comp) || user.Comp.IsActive || user.Comp.IsBlocked || target.Comp.IsActive || target.Comp.IsBlocked + || user.Comp.Timeout > _gameTiming.CurTime + || target.Comp.Timeout > _gameTiming.CurTime || !_prototypeManager.TryIndex(protoId, out var prototype) || !prototype.Checks.All(check => check.IsAvailable(user!,target!,EntityManager))) return; user.Comp.Timeout = _gameTiming.CurTime + prototype.Timeout; + user.Comp.EndTime = _gameTiming.CurTime + prototype.EndTime; user.Comp.IsActive = true; user.Comp.CurrentAction = protoId; user.Comp.CurrentPartner = new Entity(target,target.Comp); if(prototype.BeginningMessages.Count > 0) - _chatSystem.TrySendInGameICMessage(user,_robustRandom.Pick(prototype.BeginningMessages),InGameICChatType.Emote,false); + { + _chatSystem.TrySendInGameICMessage(user, + ParseMessage(target,_robustRandom.Pick(prototype.BeginningMessages)), + InGameICChatType.Emote, + false); + } if (prototype.BeginningSound is not null) _audioSystem.PlayPvs(prototype.BeginningSound, user); - RaiseLocalEvent(user,new InteractionBeginningEvent(protoId,user!,target!)); } + private string GetName(EntityUid target) + { + if(!TryComp(target,out var mind) || mind.CharacterName is null) + return MetaData(target).EntityName; + + return mind.CharacterName; + } + + private Gender GetGender(EntityUid target) + { + if (!TryComp(target, out var humanoidAppearanceComponent)) + return Gender.Male; + + return humanoidAppearanceComponent.Gender; + } + + private string ParseMessage(EntityUid target, string message) + { + return Loc.GetString(message, + ("target", GetName(target)), ("gender", GetGender(target))); + } + public override void Update(float frameTime) { base.Update(frameTime); var query = EntityQueryEnumerator(); while (query.MoveNext(out var uid, out var component)) { - if(component.Timeout > _gameTiming.CurTime || !component.IsActive) + if(component.EndTime > _gameTiming.CurTime || !component.IsActive) continue; if (component.CurrentPartner is null) @@ -101,8 +136,14 @@ public sealed class InteractionPanelSystem : EntitySystem if (_prototypeManager.TryIndex(component.CurrentAction, out var prototype)) { - if(prototype.EndingMessages.Count > 0) - _chatSystem.TrySendInGameICMessage(uid,_robustRandom.Pick(prototype.EndingMessages),InGameICChatType.Emote,false); + if (prototype.EndingMessages.Count > 0) + { + _chatSystem.TrySendInGameICMessage(uid, + ParseMessage(component.CurrentPartner.Value, + _robustRandom.Pick(prototype.EndingMessages)), + InGameICChatType.Emote, + false); + } if (prototype.EndingSound is not null) _audioSystem.PlayPvs(prototype.EndingSound, uid); diff --git a/Content.Server/_Amour/InteractionPanel/Interactions.cs b/Content.Server/_Amour/InteractionPanel/Interactions.cs index eccea62a36..c0b3c5e04d 100644 --- a/Content.Server/_Amour/InteractionPanel/Interactions.cs +++ b/Content.Server/_Amour/InteractionPanel/Interactions.cs @@ -2,7 +2,6 @@ using System.Numerics; using Content.Server._Amour.Animation; using Content.Shared._Amour.Animation; using Content.Shared._Amour.InteractionPanel; -using Content.Shared.Movement.Components; using Robust.Shared.Animations; namespace Content.Server._Amour.InteractionPanel; diff --git a/Content.Shared/_Amour/InteractionPanel/InteractionPanelComponent.cs b/Content.Shared/_Amour/InteractionPanel/InteractionPanelComponent.cs index 0c12227f86..735ab76e55 100644 --- a/Content.Shared/_Amour/InteractionPanel/InteractionPanelComponent.cs +++ b/Content.Shared/_Amour/InteractionPanel/InteractionPanelComponent.cs @@ -11,6 +11,7 @@ public sealed partial class InteractionPanelComponent : Component [ViewVariables] public bool IsBlocked = false; [ViewVariables] public ProtoId CurrentAction; [ViewVariables] public TimeSpan Timeout; + [ViewVariables] public TimeSpan EndTime; [ViewVariables] public Entity? CurrentPartner; [DataField] public List> ActionPrototypes = new(); diff --git a/Content.Shared/_Amour/InteractionPanel/InteractionPrototype.cs b/Content.Shared/_Amour/InteractionPanel/InteractionPrototype.cs index a8dd760679..b6cc018966 100644 --- a/Content.Shared/_Amour/InteractionPanel/InteractionPrototype.cs +++ b/Content.Shared/_Amour/InteractionPanel/InteractionPrototype.cs @@ -10,14 +10,15 @@ public sealed partial class InteractionPrototype : IPrototype [IdDataField] public string ID { get; private set; } = default!; [ViewVariables] public PrototypeLayerData? Icon; - [ViewVariables] public SoundSpecifier? BeginningSound; - [ViewVariables] public SoundSpecifier? EndingSound; + [DataField] public SoundSpecifier? BeginningSound; + [DataField] public SoundSpecifier? EndingSound; [DataField] public List BeginningMessages = new(); [DataField] public List EndingMessages = new(); [DataField] public List Checks = new(); - [DataField] public TimeSpan Timeout = TimeSpan.Zero; + [DataField] public TimeSpan EndTime = TimeSpan.Zero; + [DataField] public TimeSpan Timeout = TimeSpan.FromSeconds(3); } diff --git a/Resources/Locale/ru-RU/_amour/interaction.ftl b/Resources/Locale/ru-RU/_amour/interaction.ftl new file mode 100644 index 0000000000..f8847facdc --- /dev/null +++ b/Resources/Locale/ru-RU/_amour/interaction.ftl @@ -0,0 +1,6 @@ +interaction-name-slapbutt = шлёпнуть по попке +interaction-butt-slap1 = шлёпает попку { $target } +interaction-butt-slap2 = со всей силы бьёт по жопе { $target } +interaction-butt-slap3 = шлёпает попку { $target } + +interaction-panel-title = Панель взаимодействий diff --git a/Resources/Prototypes/_Amour/Interactions/interaction.yml b/Resources/Prototypes/_Amour/Interactions/interaction.yml index e4cbb81583..bdf2a0f19a 100644 --- a/Resources/Prototypes/_Amour/Interactions/interaction.yml +++ b/Resources/Prototypes/_Amour/Interactions/interaction.yml @@ -1,7 +1,11 @@ - type: interaction id: SlapButt + beginningSound: + path: /Audio/White/Interactions/clap.ogg checks: - !type:HasSmallDistance - !type:CantInteractSelf beginningMessages: - - interaction-butt-slap + - interaction-butt-slap1 + - interaction-butt-slap2 + - interaction-butt-slap3