mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-22 14:44:22 +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
|
||||
template<typename ScriptClass, typename 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 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));
|
||||
};
|
||||
DerivedMsgType msg;
|
||||
|
||||
@@ -9,5 +9,6 @@ void FvDragonInstanceServer::OnPlayerLoaded(Entity* self, Entity* player) {
|
||||
destComp->SetHealth(destComp->GetMaxHealth());
|
||||
destComp->SetArmor(destComp->GetMaxArmor());
|
||||
destComp->SetImagination(destComp->GetMaxImagination());
|
||||
Game::entityManager->SerializeEntity(player);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user