Add voice locks to various hidden syndicate items (#39310)
This commit is contained in:
@@ -116,7 +116,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
return args.CanInteract || HasComp<GhostComponent>(args.User) && !component.BlockSpectators;
|
||||
return (args.CanInteract || HasComp<GhostComponent>(args.User) && !component.BlockSpectators) && !RaiseCanOpenEventChecks(args.User, uid);
|
||||
}
|
||||
|
||||
private void OnUseInHand(EntityUid uid, ActivatableUIComponent component, UseInHandEvent args)
|
||||
@@ -225,11 +225,7 @@ public sealed partial class ActivatableUISystem : EntitySystem
|
||||
|
||||
// If we've gotten this far, fire a cancellable event that indicates someone is about to activate this.
|
||||
// This is so that stuff can require further conditions (like power).
|
||||
var oae = new ActivatableUIOpenAttemptEvent(user);
|
||||
var uae = new UserOpenActivatableUIAttemptEvent(user, uiEntity);
|
||||
RaiseLocalEvent(user, uae);
|
||||
RaiseLocalEvent(uiEntity, oae);
|
||||
if (oae.Cancelled || uae.Cancelled)
|
||||
if (RaiseCanOpenEventChecks(user, uiEntity))
|
||||
return false;
|
||||
|
||||
// Give the UI an opportunity to prepare itself if it needs to do anything
|
||||
@@ -286,4 +282,15 @@ public sealed partial class ActivatableUISystem : EntitySystem
|
||||
if (ent.Comp.InHandsOnly)
|
||||
CloseAll(ent, ent);
|
||||
}
|
||||
|
||||
private bool RaiseCanOpenEventChecks(EntityUid user, EntityUid uiEntity)
|
||||
{
|
||||
// If we've gotten this far, fire a cancellable event that indicates someone is about to activate this.
|
||||
// This is so that stuff can require further conditions (like power).
|
||||
var oae = new ActivatableUIOpenAttemptEvent(user);
|
||||
var uae = new UserOpenActivatableUIAttemptEvent(user, uiEntity);
|
||||
RaiseLocalEvent(user, uae);
|
||||
RaiseLocalEvent(uiEntity, oae);
|
||||
return oae.Cancelled || uae.Cancelled;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user