mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-06 18:54:13 +00:00
implement rest of equipment scripts (#1714)
This commit is contained in:
@@ -860,6 +860,9 @@ void Entity::Subscribe(LWOOBJID scriptObjId, CppScripts::Script* scriptToAdd, co
|
||||
auto* destroyableComponent = GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent) return;
|
||||
destroyableComponent->Subscribe(scriptObjId, scriptToAdd);
|
||||
} else if (notificationName == "PlayerResurrectionFinished") {
|
||||
LOG("Subscribing to PlayerResurrectionFinished");
|
||||
m_Subscriptions[scriptObjId][notificationName] = scriptToAdd;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,6 +871,9 @@ void Entity::Unsubscribe(LWOOBJID scriptObjId, const std::string& notificationNa
|
||||
auto* destroyableComponent = GetComponent<DestroyableComponent>();
|
||||
if (!destroyableComponent) return;
|
||||
destroyableComponent->Unsubscribe(scriptObjId);
|
||||
} else if (notificationName == "PlayerResurrectionFinished") {
|
||||
LOG("Unsubscribing from PlayerResurrectionFinished");
|
||||
m_Subscriptions[scriptObjId].erase(notificationName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1511,6 +1517,15 @@ void Entity::OnChildLoaded(GameMessages::ChildLoaded& childLoaded) {
|
||||
GetScript()->OnChildLoaded(*this, childLoaded);
|
||||
}
|
||||
|
||||
void Entity::NotifyPlayerResurrectionFinished(GameMessages::PlayerResurrectionFinished& msg) {
|
||||
for (const auto& [id, scriptList] : m_Subscriptions) {
|
||||
auto it = scriptList.find("PlayerResurrectionFinished");
|
||||
if (it == scriptList.end()) continue;
|
||||
|
||||
it->second->NotifyPlayerResurrectionFinished(*this, msg);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::RequestActivityExit(Entity* sender, LWOOBJID player, bool canceled) {
|
||||
GetScript()->OnRequestActivityExit(sender, player, canceled);
|
||||
}
|
||||
|
Reference in New Issue
Block a user