Trigger Refactor (#39034)

This commit is contained in:
slarticodefast
2025-11-23 15:22:15 -06:00
committed by Vanessa
parent c85c0fdca2
commit 2d14cd4cc0
256 changed files with 4044 additions and 2899 deletions
@@ -1,6 +1,6 @@
using Content.IntegrationTests.Tests.Interaction;
using Content.Server.Explosion.Components;
using Content.Shared.Explosion.Components;
using Content.Shared.Trigger.Components;
using Content.Shared.Trigger.Systems;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
@@ -25,19 +25,19 @@ public sealed class ModularGrenadeTests : InteractionTest
await InteractUsing(Cable);
// Insert & remove trigger
AssertComp<OnUseTimerTriggerComponent>(false);
AssertComp<TimerTriggerComponent>(false);
await InteractUsing(Trigger);
AssertComp<OnUseTimerTriggerComponent>();
AssertComp<TimerTriggerComponent>();
await FindEntity(Trigger, LookupFlags.Uncontained, shouldSucceed: false);
await InteractUsing(Pry);
AssertComp<OnUseTimerTriggerComponent>(false);
AssertComp<TimerTriggerComponent>(false);
// Trigger was dropped to floor, not deleted.
await FindEntity(Trigger, LookupFlags.Uncontained);
// Re-insert
await InteractUsing(Trigger);
AssertComp<OnUseTimerTriggerComponent>();
AssertComp<TimerTriggerComponent>();
// Insert & remove payload.
await InteractUsing(Payload);
@@ -56,13 +56,14 @@ public sealed class ModularGrenadeTests : InteractionTest
await Pickup();
AssertComp<ActiveTimerTriggerComponent>(false);
await UseInHand();
AssertComp<ActiveTimerTriggerComponent>(true);
// So uhhh grenades in hands don't destroy themselves when exploding. Maybe that will be fixed eventually.
await Drop();
// Wait until grenade explodes
var timer = Comp<ActiveTimerTriggerComponent>();
while (timer.TimeRemaining >= 0)
var triggerSys = SEntMan.System<TriggerSystem>();
while (Target != null && triggerSys.GetRemainingTime(SEntMan.GetEntity(Target.Value))?.TotalSeconds >= 0.0)
{
await RunTicks(10);
}