add child loading (#1706)

Tested that the NT combat challenge, am skullkin towers and qa wall in avant gardens all function as before.
This commit is contained in:
David Markowitz
2024-12-31 22:46:00 -08:00
committed by GitHub
parent 0b261e934f
commit 021db0ecd1
10 changed files with 54 additions and 33 deletions

View File

@@ -775,6 +775,12 @@ void Entity::Initialize() {
// Hacky way to trigger these when the object has had a chance to get constructed
AddCallbackTimer(0, [this]() {
this->GetScript()->OnStartup(this);
if (this->m_ParentEntity) {
GameMessages::ChildLoaded childLoaded;
childLoaded.childID = this->m_ObjectID;
childLoaded.templateID = this->GetLOT();
this->m_ParentEntity->OnChildLoaded(childLoaded);
}
});
if (!m_Character && Game::entityManager->GetGhostingEnabled()) {
@@ -1501,6 +1507,10 @@ void Entity::OnShootingGalleryFire(GameMessages::ShootingGalleryFire& fire) {
GetScript()->OnShootingGalleryFire(*this, fire);
}
void Entity::OnChildLoaded(GameMessages::ChildLoaded& childLoaded) {
GetScript()->OnChildLoaded(*this, childLoaded);
}
void Entity::RequestActivityExit(Entity* sender, LWOOBJID player, bool canceled) {
GetScript()->OnRequestActivityExit(sender, player, canceled);
}

View File

@@ -16,6 +16,7 @@
namespace GameMessages {
struct ActivityNotify;
struct ShootingGalleryFire;
struct ChildLoaded;
};
namespace Loot {
@@ -217,6 +218,7 @@ public:
void OnZonePropertyModelRotated(Entity* player);
void OnActivityNotify(GameMessages::ActivityNotify& notify);
void OnShootingGalleryFire(GameMessages::ShootingGalleryFire& notify);
void OnChildLoaded(GameMessages::ChildLoaded& childLoaded);
void OnMessageBoxResponse(Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData);
void OnChoiceBoxResponse(Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier);

View File

@@ -758,6 +758,13 @@ namespace GameMessages {
NiPoint3 target{};
NiQuaternion rotation{};
};
struct ChildLoaded : public GameMsg {
ChildLoaded() : GameMsg(MessageType::Game::CHILD_LOADED) {}
LOT templateID{};
LWOOBJID childID{};
};
};
#endif // GAMEMESSAGES_H