Fix being able to buckle through a locker and reality collapsing
This commit is contained in:
@@ -9,6 +9,7 @@ using Content.Shared.GameObjects.Components.Strap;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.Components.Container;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
@@ -59,6 +60,22 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsContained()
|
||||
{
|
||||
var parent = Owner.Transform.Parent;
|
||||
if (parent == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (parent.Owner.TryGetComponent(out ContainerManagerComponent container))
|
||||
{
|
||||
return container.ContainsEntity(Owner);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryBuckle(IEntity user, IEntity to)
|
||||
{
|
||||
if (user == null || user == to)
|
||||
@@ -76,7 +93,8 @@ namespace Content.Server.GameObjects.Components.Mobs
|
||||
var strapPosition = Owner.Transform.MapPosition;
|
||||
var range = SharedInteractionSystem.InteractionRange / 2;
|
||||
|
||||
if (!InteractionChecks.InRangeUnobstructed(user, strapPosition, range))
|
||||
if (!InteractionChecks.InRangeUnobstructed(user, strapPosition, range) ||
|
||||
IsContained())
|
||||
{
|
||||
_notifyManager.PopupMessage(user, user,
|
||||
Loc.GetString("You can't reach there!"));
|
||||
|
||||
Reference in New Issue
Block a user