1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

[Server] Add OnCellUnload script callback

This commit is contained in:
David Cernat 2017-04-30 03:32:04 +03:00
parent 234510a87f
commit b62969d3cf
4 changed files with 6 additions and 0 deletions

View file

@ -27,6 +27,7 @@ bool ActorProcessor::Process(RakNet::Packet &packet, BaseActorList &actorList) n
actorList.cell.blank(); actorList.cell.blank();
actorList.baseActors.clear(); actorList.baseActors.clear();
actorList.guid = packet.guid; actorList.guid = packet.guid;
for (auto &processor : processors) for (auto &processor : processors)
{ {
if (processor.first == packet.data[0]) if (processor.first == packet.data[0])

View file

@ -3,6 +3,7 @@
#include <iostream> #include <iostream>
#include "Cell.hpp" #include "Cell.hpp"
#include "Player.hpp" #include "Player.hpp"
#include "Script/Script.hpp"
using namespace std; using namespace std;
@ -111,6 +112,8 @@ void CellController::removeCell(Cell *cell)
if (cell == nullptr) if (cell == nullptr)
return; return;
Script::Call<Script::CallbackIdentity("OnCellUnload")>(cell->getDescription().c_str());
for (auto it = cells.begin(); it != cells.end();) for (auto it = cells.begin(); it != cells.end();)
{ {
if (*it != nullptr && *it == cell) if (*it != nullptr && *it == cell)

View file

@ -124,6 +124,7 @@ 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*>()},
{"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*>()}, {"OnActorStatsDynamic", Function<void, unsigned short, const char*>()},

View file

@ -31,6 +31,7 @@ bool WorldProcessor::Process(RakNet::Packet &packet, BaseEvent &event) noexcept
event.cell.blank(); event.cell.blank();
event.objectChanges.objects.clear(); event.objectChanges.objects.clear();
event.guid = packet.guid; event.guid = packet.guid;
for (auto &processor : processors) for (auto &processor : processors)
{ {
if (processor.first == packet.data[0]) if (processor.first == packet.data[0])