From 54f5458fa9b673d655a097b52c7c7858278ae0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9E=D0=BD=D1=96=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=BA=D0=BE?= Date: Sat, 21 Dec 2024 02:18:57 +0300 Subject: [PATCH] =?UTF-8?q?-=20fixed=20RGB=20staff.=20=D0=9D=D0=B0=D0=B3?= =?UTF-8?q?=D0=BB=D0=BE=20=D0=B8=20=D1=81=D0=BE=D0=B2=D0=B5=D1=80=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D0=BE=20=D0=B1=D0=B5=D0=B7=D0=B4=D1=83=D0=BC?= =?UTF-8?q?=D0=BD=D0=BE=20=D1=81=D0=BF=D0=B8=D0=B7=D0=B6=D0=B5=D0=BD=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=B4=20=D0=B2=D0=B8=D0=B7=D0=B4=D0=B5=D0=BD=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Actions/ActionOnInteractSystem.cs | 38 ++++++------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/Content.Server/Actions/ActionOnInteractSystem.cs b/Content.Server/Actions/ActionOnInteractSystem.cs index 657ab46d60..093db0e9a9 100644 --- a/Content.Server/Actions/ActionOnInteractSystem.cs +++ b/Content.Server/Actions/ActionOnInteractSystem.cs @@ -2,6 +2,7 @@ using Content.Shared.Actions; using Content.Shared.Interaction; using Robust.Shared.Random; using Robust.Shared.Timing; +using System.Linq; namespace Content.Server.Actions; @@ -58,13 +59,21 @@ public sealed class ActionOnInteractSystem : EntitySystem private void OnAfterInteract(EntityUid uid, ActionOnInteractComponent component, AfterInteractEvent args) { - if (args.Handled || component.ActionEntities == null) + if (args.Handled) return; + if (component.ActionEntities is not { } actionEnts) + { + if (!TryComp(uid, out var actionsContainerComponent)) + return; + + actionEnts = actionsContainerComponent.Container.ContainedEntities.ToList(); + } + // First, try entity target actions if (args.Target != null) { - var entOptions = GetValidActions(component.ActionEntities, args.CanReach); + var entOptions = GetValidActions(actionEnts, args.CanReach); for (var i = entOptions.Count - 1; i >= 0; i--) { var action = entOptions[i]; @@ -77,8 +86,6 @@ public sealed class ActionOnInteractSystem : EntitySystem var (entActId, entAct) = _random.Pick(entOptions); if (entAct.Event != null) { - entAct.Event.Performer = args.User; - entAct.Event.Action = entActId; entAct.Event.Target = args.Target.Value; } @@ -87,29 +94,6 @@ public sealed class ActionOnInteractSystem : EntitySystem return; } } - - // else: try world target actions - var options = GetValidActions(component.ActionEntities, args.CanReach); - for (var i = options.Count - 1; i >= 0; i--) - { - var action = options[i]; - if (!_actions.ValidateWorldTarget(args.User, args.ClickLocation, action)) - options.RemoveAt(i); - } - - if (options.Count == 0) - return; - - var (actId, act) = _random.Pick(options); - if (act.Event != null) - { - act.Event.Performer = args.User; - act.Event.Action = actId; - act.Event.Target = args.ClickLocation; - } - - _actions.PerformAction(args.User, null, actId, act, act.Event, _timing.CurTime, false); - args.Handled = true; } private bool ValidAction(BaseActionComponent action, bool canReach = true)