Adjust interaction ordering & interaction conditions (#6387)
This commit is contained in:
@@ -63,8 +63,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
// Interactions
|
||||
SubscribeLocalEvent<DisposalUnitComponent, ActivateInWorldEvent>(HandleActivate);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, InteractHandEvent>(HandleInteractHand);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, InteractUsingEvent>(HandleInteractUsing);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, AfterInteractUsingEvent>(HandleAfterInteractUsing);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, DragDropEvent>(HandleDragDropOn);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, DestructionEventArgs>(HandleDestruction);
|
||||
|
||||
@@ -223,19 +222,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleInteractHand(EntityUid uid, DisposalUnitComponent component, InteractHandEvent args)
|
||||
private void HandleAfterInteractUsing(EntityUid uid, DisposalUnitComponent component, AfterInteractUsingEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor)) return;
|
||||
if (args.Handled || !args.CanReach)
|
||||
return;
|
||||
|
||||
// Duplicated code here, not sure how else to get actor inside to make UserInterface happy.
|
||||
|
||||
if (!IsValidInteraction(args)) return;
|
||||
component.Owner.GetUIOrNull(SharedDisposalUnitComponent.DisposalUnitUiKey.Key)?.Open(actor.PlayerSession);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void HandleInteractUsing(EntityUid uid, DisposalUnitComponent component, InteractUsingEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands))
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user