Refactor MeleeWeaponComponent and related comps to be ECS (#4133)

* move everything to MeleeWeaponSystem

* refactor MeleeChemicalInjector

* hypospray and flash refactor

* stunbaton refactor

* bugfixes

* flash afterinteract

* resolve issues

* props

* playing the slots

* MeleeInteractEvent + bugfixes

* spear can actually use MeleeChemicalInjector
This commit is contained in:
mirrorcult
2021-06-05 00:20:52 -07:00
committed by GitHub
parent 3fa00d27df
commit f744b655b8
20 changed files with 895 additions and 750 deletions

View File

@@ -20,25 +20,17 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
[Reflect(false)]
private class TestAttackEntitySystem : EntitySystem
{
public EntityEventHandler<AttackEvent> AttackEvent;
public EntityEventHandler<ClickAttackEvent> ClickAttackEvent;
public EntityEventHandler<InteractUsingEvent> InteractUsingEvent;
public EntityEventHandler<AttackHandEvent> InteractHandEvent;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AttackEvent>((e) => AttackEvent?.Invoke(e));
SubscribeLocalEvent<ClickAttackEvent>((e) => ClickAttackEvent?.Invoke(e));
SubscribeLocalEvent<InteractUsingEvent>((e) => InteractUsingEvent?.Invoke(e));
SubscribeLocalEvent<AttackHandEvent>((e) => InteractHandEvent?.Invoke(e));
}
public override void Shutdown()
{
base.Shutdown();
UnsubscribeLocalEvent<AttackEvent>();
UnsubscribeLocalEvent<InteractUsingEvent>();
UnsubscribeLocalEvent<AttackHandEvent>();
}
}
[Test]
@@ -88,7 +80,7 @@ namespace Content.IntegrationTests.Tests.Interaction.Click
Assert.That(entitySystemManager.TryGetEntitySystem<InteractionSystem>(out var interactionSystem));
Assert.That(entitySystemManager.TryGetEntitySystem<TestAttackEntitySystem>(out var testAttackEntitySystem));
testAttackEntitySystem.AttackEvent = (ev) =>
testAttackEntitySystem.ClickAttackEvent = (ev) =>
{
Assert.That(ev.Target, Is.EqualTo(containerEntity.Uid));
attack = true;