mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-23 07:04:21 +00:00
fixes
This commit is contained in:
@@ -51,8 +51,10 @@ public:
|
|||||||
// Registers a message from a script to be listened for on the parent object
|
// Registers a message from a script to be listened for on the parent object
|
||||||
template<typename ScriptClass, typename DerivedMsgType>
|
template<typename ScriptClass, typename DerivedMsgType>
|
||||||
void RegisterMsg(ScriptClass* scriptThis, bool (ScriptClass::*scriptHandler)(Entity&, DerivedMsgType&)) {
|
void RegisterMsg(ScriptClass* scriptThis, bool (ScriptClass::*scriptHandler)(Entity&, DerivedMsgType&)) {
|
||||||
|
static_assert(std::is_base_of_v<GameMessages::GameMsg, DerivedMsgType>, "DerivedMsgType must derive from GameMessages::GameMsg base class.");
|
||||||
const auto boundMsg = std::bind(scriptHandler, scriptThis, std::placeholders::_1, std::placeholders::_2);
|
const auto boundMsg = std::bind(scriptHandler, scriptThis, std::placeholders::_1, std::placeholders::_2);
|
||||||
const auto castWrapper = [this, boundMsg](GameMessages::GameMsg& msg) {
|
auto* const parent = m_Parent;
|
||||||
|
const auto castWrapper = [parent, boundMsg](GameMessages::GameMsg& msg) {
|
||||||
return boundMsg(*m_Parent, static_cast<DerivedMsgType&>(msg));
|
return boundMsg(*m_Parent, static_cast<DerivedMsgType&>(msg));
|
||||||
};
|
};
|
||||||
DerivedMsgType msg;
|
DerivedMsgType msg;
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ void FvDragonInstanceServer::OnPlayerLoaded(Entity* self, Entity* player) {
|
|||||||
destComp->SetHealth(destComp->GetMaxHealth());
|
destComp->SetHealth(destComp->GetMaxHealth());
|
||||||
destComp->SetArmor(destComp->GetMaxArmor());
|
destComp->SetArmor(destComp->GetMaxArmor());
|
||||||
destComp->SetImagination(destComp->GetMaxImagination());
|
destComp->SetImagination(destComp->GetMaxImagination());
|
||||||
|
Game::entityManager->SerializeEntity(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user