[Server] Add OnCellUnload script callback

0.6.1
David Cernat 8 years ago
parent 234510a87f
commit b62969d3cf

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

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

@ -124,6 +124,7 @@ public:
{"OnPlayerInventoryChange", Function<void, unsigned short>()},
{"OnPlayerSpellbookChange", Function<void, unsigned short>()},
{"OnPlayerJournalChange", Function<void, unsigned short>()},
{"OnCellUnload", Function<void, const char*>()},
{"OnActorList", Function<void, unsigned short, const char*>()},
{"OnActorCellChange", Function<void, unsigned short, const char*>()},
{"OnActorStatsDynamic", Function<void, unsigned short, const char*>()},

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

Loading…
Cancel
Save