Defibs will now also shock anyone still interacting with the target. (#35998)

* Defibs will now also shock anyone still interacting with the target.

* Improvements to test readability

* Apply fixes to other tests

* Refactor the interacting entities query to use an event.

* Include pullers as interacting with the entity they are pulling

* Broadcast event

* Use a constant

* Convert new test to InteractionTest

* Convert existing test

* Add behaviour note

* Revert "Convert existing test"

This reverts commit b8a8f2f68e3733bdb6ec254faf955a42096d47d7.

* Move new test into separate (InteractionTest) test file

* Use ToServer

* Use a constant for prototype id

* Use ToServer

* Add EntProtoId constructor

* Add assertion failure messages

* Manual cleanup of test entities

* Remove obsolete flag

* Add test summaries

* Remove tuple constructor

* Wrap entity deletion in WaitPost

* Extend DoAfter interacting test with an extra mob
This commit is contained in:
Ciarán Walsh
2025-11-22 23:44:26 +00:00
committed by GitHub
parent f38a322912
commit c2f4b5145d
7 changed files with 177 additions and 14 deletions

View File

@@ -68,6 +68,7 @@ public sealed class PullingSystem : EntitySystem
SubscribeLocalEvent<PullableComponent, EntGotInsertedIntoContainerMessage>(OnPullableContainerInsert);
SubscribeLocalEvent<PullableComponent, ModifyUncuffDurationEvent>(OnModifyUncuffDuration);
SubscribeLocalEvent<PullableComponent, StopBeingPulledAlertEvent>(OnStopBeingPulledAlert);
SubscribeLocalEvent<PullableComponent, GetInteractingEntitiesEvent>(OnGetInteractingEntities);
SubscribeLocalEvent<PullerComponent, UpdateMobStateEvent>(OnStateChanged, after: [typeof(MobThresholdSystem)]);
SubscribeLocalEvent<PullerComponent, AfterAutoHandleStateEvent>(OnAfterState);
@@ -161,6 +162,12 @@ public sealed class PullingSystem : EntitySystem
StopPulling(ent, ent);
}
private void OnGetInteractingEntities(Entity<PullableComponent> ent, ref GetInteractingEntitiesEvent args)
{
if (ent.Comp.Puller != null)
args.InteractingEntities.Add(ent.Comp.Puller.Value);
}
private void OnAfterState(Entity<PullerComponent> ent, ref AfterAutoHandleStateEvent args)
{
if (ent.Comp.Pulling == null)