mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:36:43 +00:00
[Server] Add new script callbacks for cells, remove a couple of others
OnPlayerCellState and OnActorStatsDynamic are now removed as callbacks. The old OnCellUnload is now renamed into OnCellDeletion. OnCellLoad and a new OnCellUnload relating to a specific player's load/unload are added.
This commit is contained in:
parent
e1ee4a4f49
commit
62d93a09c1
4 changed files with 9 additions and 6 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "Player.hpp"
|
#include "Player.hpp"
|
||||||
|
#include "Script/Script.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -38,6 +39,8 @@ void Cell::addPlayer(Player *player)
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Adding %s to Cell %s", player->npc.mName.c_str(), getDescription().c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Adding %s to Cell %s", player->npc.mName.c_str(), getDescription().c_str());
|
||||||
|
|
||||||
|
Script::Call<Script::CallbackIdentity("OnCellLoad")>(player->getId(), getDescription().c_str());
|
||||||
|
|
||||||
players.push_back(player);
|
players.push_back(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,6 +60,8 @@ void Cell::removePlayer(Player *player)
|
||||||
|
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Removing %s from Cell %s", player->npc.mName.c_str(), getDescription().c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Removing %s from Cell %s", player->npc.mName.c_str(), getDescription().c_str());
|
||||||
|
|
||||||
|
Script::Call<Script::CallbackIdentity("OnCellUnload")>(player->getId(), getDescription().c_str());
|
||||||
|
|
||||||
players.erase(it);
|
players.erase(it);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ void CellController::removeCell(Cell *cell)
|
||||||
{
|
{
|
||||||
if (*it != nullptr && *it == cell)
|
if (*it != nullptr && *it == cell)
|
||||||
{
|
{
|
||||||
Script::Call<Script::CallbackIdentity("OnCellUnload")>(cell->getDescription().c_str());
|
Script::Call<Script::CallbackIdentity("OnCellDeletion")>(cell->getDescription().c_str());
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Removing %s from CellController", cell->getDescription().c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Removing %s from CellController", cell->getDescription().c_str());
|
||||||
|
|
||||||
delete *it;
|
delete *it;
|
||||||
|
|
|
@ -115,7 +115,6 @@ public:
|
||||||
{"OnPlayerDeath", Function<void, unsigned short, short, unsigned short>()},
|
{"OnPlayerDeath", Function<void, unsigned short, short, unsigned short>()},
|
||||||
{"OnPlayerResurrect", Function<void, unsigned short>()},
|
{"OnPlayerResurrect", Function<void, unsigned short>()},
|
||||||
{"OnPlayerCellChange", Function<void, unsigned short>()},
|
{"OnPlayerCellChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerCellState", Function<void, unsigned short>()},
|
|
||||||
{"OnPlayerAttributesChange", Function<void, unsigned short>()},
|
{"OnPlayerAttributesChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerSkillsChange", Function<void, unsigned short>()},
|
{"OnPlayerSkillsChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerLevelChange", Function<void, unsigned short>()},
|
{"OnPlayerLevelChange", Function<void, unsigned short>()},
|
||||||
|
@ -124,10 +123,11 @@ public:
|
||||||
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
|
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
|
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
|
||||||
{"OnPlayerJournalChange", Function<void, unsigned short>()},
|
{"OnPlayerJournalChange", Function<void, unsigned short>()},
|
||||||
{"OnCellUnload", Function<void, const char*>()},
|
{"OnCellLoad", Function<void, unsigned short, const char*>()},
|
||||||
|
{"OnCellUnload", Function<void, unsigned short, const char*>()},
|
||||||
|
{"OnCellDeletion", Function<void, const char*>()},
|
||||||
{"OnActorList", Function<void, unsigned short, const char*>()},
|
{"OnActorList", Function<void, unsigned short, const char*>()},
|
||||||
{"OnActorCellChange", Function<void, unsigned short, const char*>()},
|
{"OnActorCellChange", Function<void, unsigned short, const char*>()},
|
||||||
{"OnActorStatsDynamic", Function<void, unsigned short, const char*>()},
|
|
||||||
{"OnActorTest", Function<void, unsigned short, const char*>()},
|
{"OnActorTest", Function<void, unsigned short, const char*>()},
|
||||||
{"OnObjectPlace", Function<void, unsigned short, const char*>()},
|
{"OnObjectPlace", Function<void, unsigned short, const char*>()},
|
||||||
{"OnObjectDelete", Function<void, unsigned short, const char*>()},
|
{"OnObjectDelete", Function<void, unsigned short, const char*>()},
|
||||||
|
|
|
@ -28,8 +28,6 @@ namespace mwmp
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID, player.npc.mName.c_str());
|
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s from %s", strPacketID, player.npc.mName.c_str());
|
||||||
|
|
||||||
CellController::get()->update(&player);
|
CellController::get()->update(&player);
|
||||||
|
|
||||||
Script::Call<Script::CallbackIdentity("OnPlayerCellState")>(player.getId());
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue