Fix mech double interactions (#14672)
This commit is contained in:
@@ -195,7 +195,7 @@ public sealed class MechSystem : SharedMechSystem
|
|||||||
Priority = 1, // Promote to top to make ejecting the ALT-click action
|
Priority = 1, // Promote to top to make ejecting the ALT-click action
|
||||||
Act = () =>
|
Act = () =>
|
||||||
{
|
{
|
||||||
if (args.User == component.PilotSlot.ContainedEntity)
|
if (args.User == uid || args.User == component.PilotSlot.ContainedEntity)
|
||||||
{
|
{
|
||||||
TryEject(uid, component);
|
TryEject(uid, component);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace Content.Shared.Interaction.Components;
|
|||||||
/// Relays an entities interactions to another entity.
|
/// Relays an entities interactions to another entity.
|
||||||
/// This doesn't raise the same events, but just relays
|
/// This doesn't raise the same events, but just relays
|
||||||
/// the clicks of the mouse.
|
/// the clicks of the mouse.
|
||||||
|
///
|
||||||
|
/// Note that extreme caution should be taken when using this, as this will probably bypass many normal can-interact checks.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent, NetworkedComponent]
|
[RegisterComponent, NetworkedComponent]
|
||||||
[Access(typeof(SharedInteractionSystem))]
|
[Access(typeof(SharedInteractionSystem))]
|
||||||
|
|||||||
@@ -240,7 +240,12 @@ namespace Content.Shared.Interaction
|
|||||||
{
|
{
|
||||||
if (TryComp<InteractionRelayComponent>(user, out var relay) && relay.RelayEntity is not null)
|
if (TryComp<InteractionRelayComponent>(user, out var relay) && relay.RelayEntity is not null)
|
||||||
{
|
{
|
||||||
UserInteraction(relay.RelayEntity.Value, coordinates, target, altInteract, checkCanInteract, checkAccess, checkCanUse);
|
// TODO this needs to be handled better. This probably bypasses many complex can-interact checks in weird roundabout ways.
|
||||||
|
if (_actionBlockerSystem.CanInteract(user, target))
|
||||||
|
{
|
||||||
|
UserInteraction(relay.RelayEntity.Value, coordinates, target, altInteract, checkCanInteract, checkAccess, checkCanUse);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target != null && Deleted(target.Value))
|
if (target != null && Deleted(target.Value))
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ public abstract class SharedMechSystem : EntitySystem
|
|||||||
if (pilot == null)
|
if (pilot == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// TODO why is this being blocked?
|
||||||
if (!_timing.IsFirstTimePredicted)
|
if (!_timing.IsFirstTimePredicted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -165,6 +166,8 @@ public abstract class SharedMechSystem : EntitySystem
|
|||||||
|
|
||||||
var rider = EnsureComp<MechPilotComponent>(pilot);
|
var rider = EnsureComp<MechPilotComponent>(pilot);
|
||||||
var relay = EnsureComp<RelayInputMoverComponent>(pilot);
|
var relay = EnsureComp<RelayInputMoverComponent>(pilot);
|
||||||
|
|
||||||
|
// Warning: this bypasses most normal interaction blocking components on the user, like drone laws and the like.
|
||||||
var irelay = EnsureComp<InteractionRelayComponent>(pilot);
|
var irelay = EnsureComp<InteractionRelayComponent>(pilot);
|
||||||
|
|
||||||
_mover.SetRelay(pilot, mech, relay);
|
_mover.SetRelay(pilot, mech, relay);
|
||||||
|
|||||||
Reference in New Issue
Block a user