refactor(Core/GameObject): Move the GameObject state save handling to… (#18080)

* refactor(Core/GameObject): Move the GameObject state save handling to instance level

* Update GameObject.h

* remove leftover

* small improvements
This commit is contained in:
Andrew
2024-01-01 01:51:33 -03:00
committed by GitHub
parent a1212a52b0
commit a11434b24f
14 changed files with 100 additions and 192 deletions

View File

@@ -46,17 +46,17 @@ public:
case GO_DOOR_LEVER_2:
case GO_DOOR_LEVER_3:
case GO_CANNON:
gameobject->UpdateSaveToDb(true);
gameobject->AllowSaveToDB(true);
break;
case GO_FACTORY_DOOR:
gameobject->UpdateSaveToDb(true);
gameobject->AllowSaveToDB(true);
// GoState (Door opened) is restored during GO creation, but we need to set LootState to prevent Lever from closing it again
if (_encounters[TYPE_RHAHK_ZOR] == DONE)
gameobject->SetLootState(GO_ACTIVATED);
break;
case GO_IRON_CLAD_DOOR:
gameobject->UpdateSaveToDb(true);
if (gameobject->GetStateSavedOnInstance() == GO_STATE_ACTIVE)
gameobject->AllowSaveToDB(true);
if (GetStoredGameObjectState(gameobject->GetSpawnId()) == GO_STATE_ACTIVE)
{
gameobject->DespawnOrUnsummon();
}