Fix access for vehicles and mechs (#20737)
* fix access for vehicles and mechs * optimize
This commit is contained in:
@@ -71,7 +71,7 @@ public sealed class AccessReaderSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
reader.Enabled = false;
|
reader.Enabled = false;
|
||||||
Dirty(reader);
|
Dirty(uid, reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -183,16 +183,16 @@ public sealed class AccessReaderSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
FindAccessItemsInventory(uid, out var items);
|
FindAccessItemsInventory(uid, out var items);
|
||||||
|
|
||||||
foreach (var item in new ValueList<EntityUid>(items))
|
|
||||||
{
|
|
||||||
items.UnionWith(FindPotentialAccessItems(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
var ev = new GetAdditionalAccessEvent
|
var ev = new GetAdditionalAccessEvent
|
||||||
{
|
{
|
||||||
Entities = items
|
Entities = items
|
||||||
};
|
};
|
||||||
RaiseLocalEvent(uid, ref ev);
|
RaiseLocalEvent(uid, ref ev);
|
||||||
|
|
||||||
|
foreach (var item in new ValueList<EntityUid>(items))
|
||||||
|
{
|
||||||
|
items.UnionWith(FindPotentialAccessItems(item));
|
||||||
|
}
|
||||||
items.Add(uid);
|
items.Add(uid);
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
|
||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Destructible;
|
using Content.Shared.Destructible;
|
||||||
@@ -30,7 +29,6 @@ public abstract class SharedMechSystem : EntitySystem
|
|||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly INetManager _net = default!;
|
[Dependency] private readonly INetManager _net = default!;
|
||||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _access = default!;
|
|
||||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||||
@@ -105,8 +103,6 @@ public abstract class SharedMechSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
args.Entities.Add(pilot.Value);
|
args.Entities.Add(pilot.Value);
|
||||||
_access.FindAccessItemsInventory(pilot.Value, out var items);
|
|
||||||
args.Entities.UnionWith(items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetupUser(EntityUid mech, EntityUid pilot, MechComponent? component = null)
|
private void SetupUser(EntityUid mech, EntityUid pilot, MechComponent? component = null)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using Content.Shared.Access.Components;
|
using Content.Shared.Access.Components;
|
||||||
using Content.Shared.Access.Systems;
|
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
using Content.Shared.Buckle;
|
using Content.Shared.Buckle;
|
||||||
@@ -35,7 +34,6 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
|||||||
[Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!;
|
[Dependency] private readonly SharedAmbientSoundSystem _ambientSound = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
||||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _access = default!;
|
|
||||||
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly SharedHandVirtualItemSystem _virtualItemSystem = default!;
|
[Dependency] private readonly SharedHandVirtualItemSystem _virtualItemSystem = default!;
|
||||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||||
@@ -326,11 +324,7 @@ public abstract partial class SharedVehicleSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
if (component.Rider == null)
|
if (component.Rider == null)
|
||||||
return;
|
return;
|
||||||
var rider = component.Rider.Value;
|
args.Entities.Add(component.Rider.Value);
|
||||||
|
|
||||||
args.Entities.Add(rider);
|
|
||||||
_access.FindAccessItemsInventory(rider, out var items);
|
|
||||||
args.Entities.UnionWith(items);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user