From e41a6e25896466ea421dd92db18050aa5362b76b Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Wed, 29 Jul 2020 14:11:24 +0200 Subject: [PATCH] Fix crash when pulling a potted plant (#1530) * Fix crash when pulling a potted plant * Fix being able to pull anchored entities --- .../GameObjects/EntitySystems/Click/InteractionSystem.cs | 9 +++++++-- Content.Server/GlobalVerbs/PullingVerb.cs | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs index 627d0ffe20..17c811dc0c 100644 --- a/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/Click/InteractionSystem.cs @@ -277,8 +277,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click return false; } - var physics = pull.Owner.GetComponent(); - var controller = physics.EnsureController(); + if (!pull.Owner.TryGetComponent(out ICollidableComponent collidable) || + collidable.Anchored) + { + return false; + } + + var controller = collidable.EnsureController(); if (controller.GettingPulled) { diff --git a/Content.Server/GlobalVerbs/PullingVerb.cs b/Content.Server/GlobalVerbs/PullingVerb.cs index 4fa4822058..00f96df0a4 100644 --- a/Content.Server/GlobalVerbs/PullingVerb.cs +++ b/Content.Server/GlobalVerbs/PullingVerb.cs @@ -55,6 +55,7 @@ namespace Content.Server.GlobalVerbs { if (!user.TryGetComponent(out ICollidableComponent userCollidable) || !target.TryGetComponent(out ICollidableComponent targetCollidable) || + targetCollidable.Anchored || !target.TryGetComponent(out PullableComponent pullable) || !user.TryGetComponent(out HandsComponent hands)) {