From 58b9ac10c251acfbe7fff948c36696adbd77e964 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 16 Aug 2020 23:49:20 +0200 Subject: [PATCH] Fix right-click verbs. --- .../GameObjects/EntitySystems/VerbSystem.cs | 13 +++++++++++-- Content.Shared/GameObjects/Verbs/Verb.cs | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs index 6de086226a..761681b1ac 100644 --- a/Content.Server/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/VerbSystem.cs @@ -113,8 +113,17 @@ namespace Content.Server.GameObjects.EntitySystems if (verb.RequireInteractionRange && !VerbUtility.InVerbUseRange(userEntity, entity)) continue; - if (verb.BlockedByContainers && !userEntity.IsInSameOrNoContainer(entity)) - continue; + if (verb.BlockedByContainers) + { + if (!userEntity.IsInSameOrNoContainer(entity)) + { + if (!ContainerHelpers.TryGetContainer(entity, out var container) || + container.Owner != userEntity) + { + continue; + } + } + } var verbData = verb.GetData(userEntity, component); if (verbData.IsInvisible) diff --git a/Content.Shared/GameObjects/Verbs/Verb.cs b/Content.Shared/GameObjects/Verbs/Verb.cs index 99cf50b24d..723f90f1f3 100644 --- a/Content.Shared/GameObjects/Verbs/Verb.cs +++ b/Content.Shared/GameObjects/Verbs/Verb.cs @@ -23,6 +23,7 @@ namespace Content.Shared.GameObjects.Verbs /// /// If true, this verb requires both the user and the entity on which /// this verb resides to be in the same container or no container. + /// OR the user can be the entity's container /// public virtual bool BlockedByContainers => true;