Fix wall vending machines spawning items in walls. (#28279)
* Find spawning of wall vending machines. * Review fixes
This commit is contained in:
@@ -19,6 +19,7 @@ using Content.Shared.Popups;
|
|||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using Content.Shared.UserInterface;
|
using Content.Shared.UserInterface;
|
||||||
using Content.Shared.VendingMachines;
|
using Content.Shared.VendingMachines;
|
||||||
|
using Content.Shared.Wall;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
@@ -39,6 +40,8 @@ namespace Content.Server.VendingMachines
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
|
||||||
|
|
||||||
|
private const float WallVendEjectDistanceFromWall = 1f;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -384,7 +387,20 @@ namespace Content.Server.VendingMachines
|
|||||||
return;
|
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<WallMountComponent>(uid, out var wallMountComponent))
|
||||||
|
{
|
||||||
|
|
||||||
|
var offset = wallMountComponent.Direction.ToWorldVec() * WallVendEjectDistanceFromWall;
|
||||||
|
spawnCoordinates = spawnCoordinates.Offset(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
var ent = Spawn(vendComponent.NextItemToEject, spawnCoordinates);
|
||||||
|
|
||||||
if (vendComponent.ThrowNextItem)
|
if (vendComponent.ThrowNextItem)
|
||||||
{
|
{
|
||||||
var range = vendComponent.NonLimitedEjectRange;
|
var range = vendComponent.NonLimitedEjectRange;
|
||||||
|
|||||||
Reference in New Issue
Block a user