[Server] Fix sendList()

Remove return from requestContainers()
Rename "Cells" usertype to "Cell"
new-script-api
Koncord 7 years ago
parent 991a1fe8d8
commit b18c6dec9d

@ -87,7 +87,7 @@ void ActorController::Init(LuaState &lua)
sol::table playersTable = lua.getState()->create_named_table("Actors");
playersTable.set_function("createActor", [&lua](){
lua.getActorCtrl().createActor();
return lua.getActorCtrl().createActor();
});
playersTable.set_function("sendActors", [&lua](shared_ptr<Player> player, vector<shared_ptr<Actor>> actors,
@ -239,9 +239,16 @@ void ActorController::sendList(std::shared_ptr<Player> player, std::vector<std::
actorList.guid = player->guid;
actorList.action = mwmp::BaseActorList::SET;
for(auto &actor : actors)
{
actorList.baseActors.push_back(actor->actor);
}
auto packet = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST);
packet->setActorList(&actorList);
packet->Send(actorList.guid);
if (sendToAll)
CellController::get()->getCell(&actorList.cell)->sendToLoaded(packet, &actorList);
}
void ActorController::requestList(std::shared_ptr<Player> player, const ESM::Cell &cell)

@ -13,7 +13,7 @@ using namespace std;
void Cells::Init(LuaState &lua)
{
lua.getState()->new_usertype<Cells>("Cells",
lua.getState()->new_usertype<Cells>("Cell",
"cell", sol::property(&Cells::getCell, &Cells::setCell),
"getExterior", &Cells::getExterior,
"setExterior", &Cells::setExterior,

@ -268,7 +268,7 @@ void ObjectController::Init(LuaState &lua)
});
objectCtrl.set_function("requestContainers", [&lua](shared_ptr<Player> player) {
return lua.getObjectCtrl().requestContainers(player);
lua.getObjectCtrl().requestContainers(player);
});

Loading…
Cancel
Save