Fix crash when pulling a potted plant (#1530)

* Fix crash when pulling a potted plant

* Fix being able to pull anchored entities
This commit is contained in:
DrSmugleaf
2020-07-29 14:11:24 +02:00
committed by GitHub
parent e0f429c59b
commit e41a6e2589
2 changed files with 8 additions and 2 deletions

View File

@@ -277,8 +277,13 @@ namespace Content.Server.GameObjects.EntitySystems.Click
return false; return false;
} }
var physics = pull.Owner.GetComponent<IPhysicsComponent>(); if (!pull.Owner.TryGetComponent(out ICollidableComponent collidable) ||
var controller = physics.EnsureController<PullController>(); collidable.Anchored)
{
return false;
}
var controller = collidable.EnsureController<PullController>();
if (controller.GettingPulled) if (controller.GettingPulled)
{ {

View File

@@ -55,6 +55,7 @@ namespace Content.Server.GlobalVerbs
{ {
if (!user.TryGetComponent(out ICollidableComponent userCollidable) || if (!user.TryGetComponent(out ICollidableComponent userCollidable) ||
!target.TryGetComponent(out ICollidableComponent targetCollidable) || !target.TryGetComponent(out ICollidableComponent targetCollidable) ||
targetCollidable.Anchored ||
!target.TryGetComponent(out PullableComponent pullable) || !target.TryGetComponent(out PullableComponent pullable) ||
!user.TryGetComponent(out HandsComponent hands)) !user.TryGetComponent(out HandsComponent hands))
{ {