vehicle access fix (#12868)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
using Content.Shared.Vehicle.Components;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Buckle.Components;
|
||||
@@ -9,6 +12,8 @@ using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Shared.Tag;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Hands.EntitySystems;
|
||||
using Content.Shared.Inventory;
|
||||
|
||||
namespace Content.Shared.Vehicle;
|
||||
|
||||
@@ -24,6 +29,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _access = default!;
|
||||
|
||||
private const string KeySlot = "key_slot";
|
||||
|
||||
@@ -37,6 +43,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
||||
SubscribeLocalEvent<VehicleComponent, MoveEvent>(OnVehicleRotate);
|
||||
SubscribeLocalEvent<VehicleComponent, EntInsertedIntoContainerMessage>(OnEntInserted);
|
||||
SubscribeLocalEvent<VehicleComponent, EntRemovedFromContainerMessage>(OnEntRemoved);
|
||||
SubscribeLocalEvent<VehicleComponent, GetAdditionalAccessEvent>(OnGetAdditionalAccess);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -177,6 +184,17 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGetAdditionalAccess(EntityUid uid, VehicleComponent component, ref GetAdditionalAccessEvent args)
|
||||
{
|
||||
if (component.Rider == null)
|
||||
return;
|
||||
var rider = component.Rider.Value;
|
||||
|
||||
args.Entities.Add(rider);
|
||||
_access.FindAccessItemsInventory(rider, out var items);
|
||||
args.Entities = args.Entities.Union(items).ToHashSet();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the draw depth for the sprite.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user