wall mounted lockers (#11382)
This commit is contained in:
@@ -12,9 +12,9 @@ using Content.Shared.Interaction;
|
||||
using Content.Shared.Item;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Wall;
|
||||
using Content.Shared.Whitelist;
|
||||
using Robust.Server.Containers;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics;
|
||||
@@ -24,6 +24,8 @@ namespace Content.Server.Storage.EntitySystems;
|
||||
|
||||
public sealed class EntityStorageSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly ConstructionSystem _construction = default!;
|
||||
[Dependency] private readonly ContainerSystem _container = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
@@ -148,7 +150,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
component.Open = true;
|
||||
EmptyContents(uid, component);
|
||||
ModifyComponents(uid, component);
|
||||
SoundSystem.Play(component.OpenSound.GetSound(), Filter.Pvs(component.Owner), component.Owner);
|
||||
_audio.PlayPvs(component.OpenSound, component.Owner);
|
||||
ReleaseGas(uid, component);
|
||||
RaiseLocalEvent(uid, new StorageAfterOpenEvent());
|
||||
}
|
||||
@@ -187,7 +189,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
|
||||
TakeGas(uid, component);
|
||||
ModifyComponents(uid, component);
|
||||
SoundSystem.Play(component.CloseSound.GetSound(), Filter.Pvs(uid), uid);
|
||||
_audio.PlayPvs(component.CloseSound, component.Owner);
|
||||
component.LastInternalOpenAttempt = default;
|
||||
RaiseLocalEvent(uid, new StorageAfterCloseEvent());
|
||||
}
|
||||
@@ -265,15 +267,14 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
}
|
||||
|
||||
//Checks to see if the opening position, if offset, is inside of a wall.
|
||||
if (component.EnteringOffset != (0, 0)) //if the entering position is offset
|
||||
if (component.EnteringOffset != (0, 0) && !HasComp<WallMountComponent>(target)) //if the entering position is offset
|
||||
{
|
||||
var targetXform = Transform(target);
|
||||
var newCoords = new EntityCoordinates(target, component.EnteringOffset);
|
||||
if (!_interactionSystem.InRangeUnobstructed(target, newCoords, collisionMask: component.EnteringOffsetCollisionFlags))
|
||||
if (!_interactionSystem.InRangeUnobstructed(target, newCoords, 0, collisionMask: component.EnteringOffsetCollisionFlags))
|
||||
{
|
||||
if (!silent)
|
||||
_popupSystem.PopupEntity(Loc.GetString("entity-storage-component-cannot-open-no-space"), target, Filter.Pvs(target));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -301,8 +302,10 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
if (TryComp<IPhysBody>(toAdd, out var phys))
|
||||
{
|
||||
if (component.MaxSize < phys.GetWorldAABB().Size.X || component.MaxSize < phys.GetWorldAABB().Size.Y)
|
||||
return false;
|
||||
}
|
||||
|
||||
return Insert(toAdd, container, component);
|
||||
}
|
||||
@@ -326,10 +329,7 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
|
||||
var targetIsMob = HasComp<SharedBodyComponent>(toInsert);
|
||||
var storageIsItem = HasComp<ItemComponent>(container);
|
||||
|
||||
var allowedToEat = whitelist == null
|
||||
? HasComp<ItemComponent>(toInsert)
|
||||
: whitelist.IsValid(toInsert);
|
||||
var allowedToEat = whitelist?.IsValid(toInsert) ?? HasComp<ItemComponent>(toInsert);
|
||||
|
||||
// BEFORE REPLACING THIS WITH, I.E. A PROPERTY:
|
||||
// Make absolutely 100% sure you have worked out how to stop people ending up in backpacks.
|
||||
@@ -379,11 +379,8 @@ public sealed class EntityStorageSystem : EntitySystem
|
||||
if (TryComp<PlaceableSurfaceComponent>(uid, out var surface))
|
||||
_placeableSurface.SetPlaceable(uid, component.Open, surface);
|
||||
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
{
|
||||
appearance.SetData(StorageVisuals.Open, component.Open);
|
||||
appearance.SetData(StorageVisuals.HasContents, component.Contents.ContainedEntities.Any());
|
||||
}
|
||||
_appearance.SetData(uid, StorageVisuals.Open, component.Open);
|
||||
_appearance.SetData(uid, StorageVisuals.HasContents, component.Contents.ContainedEntities.Count > 0);
|
||||
}
|
||||
|
||||
private void TakeGas(EntityUid uid, EntityStorageComponent component)
|
||||
|
||||
Reference in New Issue
Block a user