Fixes placing objects on closed lockers (#658)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using System.Linq;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Content.Server.GameObjects.Components.Items.Storage;
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using Content.Server.GameObjects.Components.Sound;
|
using Content.Server.GameObjects.Components.Sound;
|
||||||
using Content.Server.GameObjects.EntitySystems;
|
using Content.Server.GameObjects.EntitySystems;
|
||||||
@@ -80,6 +81,11 @@ namespace Content.Server.GameObjects.Components
|
|||||||
|
|
||||||
if (_noDoor && !_locked)
|
if (_noDoor && !_locked)
|
||||||
Open = true;
|
Open = true;
|
||||||
|
|
||||||
|
if (Owner.TryGetComponent<PlaceableSurfaceComponent>(out var placeableSurfaceComponent))
|
||||||
|
{
|
||||||
|
placeableSurfaceComponent.IsPlaceable = Open;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -20,9 +20,12 @@ namespace Content.Server.GameObjects.Components
|
|||||||
}
|
}
|
||||||
public bool AttackBy(AttackByEventArgs eventArgs)
|
public bool AttackBy(AttackByEventArgs eventArgs)
|
||||||
{
|
{
|
||||||
|
if (!IsPlaceable)
|
||||||
|
return false;
|
||||||
|
|
||||||
if(!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
|
if(!eventArgs.User.TryGetComponent<HandsComponent>(out var handComponent))
|
||||||
{
|
{
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
handComponent.Drop(eventArgs.AttackWith);
|
handComponent.Drop(eventArgs.AttackWith);
|
||||||
eventArgs.AttackWith.Transform.WorldPosition = eventArgs.ClickLocation.Position;
|
eventArgs.AttackWith.Transform.WorldPosition = eventArgs.ClickLocation.Position;
|
||||||
|
|||||||
Reference in New Issue
Block a user