diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 723b9de626..63ec8f2c24 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -19,6 +19,7 @@ using Content.Shared.Popups; using Content.Shared.Throwing; using Content.Shared.UserInterface; using Content.Shared.VendingMachines; +using Content.Shared.Wall; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Prototypes; @@ -39,6 +40,8 @@ namespace Content.Server.VendingMachines [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!; + private const float WallVendEjectDistanceFromWall = 1f; + public override void Initialize() { base.Initialize(); @@ -384,7 +387,20 @@ namespace Content.Server.VendingMachines return; } - var ent = Spawn(vendComponent.NextItemToEject, Transform(uid).Coordinates); + // Default spawn coordinates + var spawnCoordinates = Transform(uid).Coordinates; + + //Make sure the wallvends spawn outside of the wall. + + if (TryComp(uid, out var wallMountComponent)) + { + + var offset = wallMountComponent.Direction.ToWorldVec() * WallVendEjectDistanceFromWall; + spawnCoordinates = spawnCoordinates.Offset(offset); + } + + var ent = Spawn(vendComponent.NextItemToEject, spawnCoordinates); + if (vendComponent.ThrowNextItem) { var range = vendComponent.NonLimitedEjectRange;