Rename and clean up interaction events (#4044)

* Rename and clean up interaction events

* Fix hand equip events
This commit is contained in:
ShadowCommander
2021-05-22 21:06:40 -07:00
committed by GitHub
parent d97021d3a0
commit acb102f978
62 changed files with 273 additions and 240 deletions

View File

@@ -20,24 +20,24 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
[Reflect(false)]
private class TestAttackEntitySystem : EntitySystem
{
public EntityEventHandler<AttackEventArgs> AttackEvent;
public EntityEventHandler<InteractUsingMessage> InteractUsingEvent;
public EntityEventHandler<AttackHandMessage> InteractHandEvent;
public EntityEventHandler<AttackEvent> AttackEvent;
public EntityEventHandler<InteractUsingEvent> InteractUsingEvent;
public EntityEventHandler<AttackHandEvent> InteractHandEvent;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AttackEventArgs>((e) => AttackEvent?.Invoke(e));
SubscribeLocalEvent<InteractUsingMessage>((e) => InteractUsingEvent?.Invoke(e));
SubscribeLocalEvent<AttackHandMessage>((e) => InteractHandEvent?.Invoke(e));
SubscribeLocalEvent<AttackEvent>((e) => AttackEvent?.Invoke(e));
SubscribeLocalEvent<InteractUsingEvent>((e) => InteractUsingEvent?.Invoke(e));
SubscribeLocalEvent<AttackHandEvent>((e) => InteractHandEvent?.Invoke(e));
}
public override void Shutdown()
{
base.Shutdown();
UnsubscribeLocalEvent<AttackEventArgs>();
UnsubscribeLocalEvent<InteractUsingMessage>();
UnsubscribeLocalEvent<AttackHandMessage>();
UnsubscribeLocalEvent<AttackEvent>();
UnsubscribeLocalEvent<InteractUsingEvent>();
UnsubscribeLocalEvent<AttackHandEvent>();
}
}
@@ -95,12 +95,12 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
};
testAttackEntitySystem.InteractUsingEvent = (ev) =>
{
Assert.That(ev.Attacked, Is.EqualTo(containerEntity));
Assert.That(ev.Target, Is.EqualTo(containerEntity));
interactUsing = true;
};
testAttackEntitySystem.InteractHandEvent = (ev) =>
{
Assert.That(ev.Attacked, Is.EqualTo(containerEntity));
Assert.That(ev.Target, Is.EqualTo(containerEntity));
interactHand = true;
};