Fix(Scripts/BlackwingLair) :bwl suppression traps (#27774)

Co-authored-by: Nefertumm <[email protected]>
This commit is contained in:
moostigre
2026-09-24 11:34:18 -03:00
committed by GitHub
co-authored by Nefertumm
parent 3617be43df
commit 94af36508b
@@ -134,10 +134,19 @@ struct go_suppression_device : public GameObjectAI
void InitializeAI() override
{
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
me->AllowSaveToDB(true);
// Disarmed devices use GO_STATE_ACTIVE. Preserve that state after Broodlord dies;
// before then, a reload resets the transient disarm because its reset timer is not persisted.
if (me->GetGoState() == GO_STATE_ACTIVE)
{
Deactivate();
return;
if (_instance->GetBossState(DATA_BROODLORD_LASHLAYER) == DONE)
{
Deactivate();
return;
}
me->SetGoState(GO_STATE_READY);
}
_events.ScheduleEvent(EVENT_SUPPRESSION_CAST, 5s);
@@ -166,6 +175,22 @@ struct go_suppression_device : public GameObjectAI
}
}
void OnStateChanged(uint32 state, Unit* /*unit*/) override
{
switch (state)
{
case GO_JUST_DEACTIVATED:
// Disarm Trap must retract the device, not send it through generic despawning.
me->SetLootState(GO_READY);
[[fallthrough]];
case GO_ACTIVATED:
DoAction(ACTION_DISARMED);
break;
default:
break;
}
}
void DoAction(int32 action) override
{
if (action == ACTION_DEACTIVATE)
@@ -174,6 +199,9 @@ struct go_suppression_device : public GameObjectAI
}
else if (action == ACTION_DISARMED)
{
if (!_active)
return;
Deactivate();
_events.CancelEvent(EVENT_SUPPRESSION_CAST);