forked from teamnwah/openmw-tes3coop
[Server] Fix sendList()
Remove return from requestContainers() Rename "Cells" usertype to "Cell"
This commit is contained in:
parent
991a1fe8d8
commit
b18c6dec9d
3 changed files with 10 additions and 3 deletions
|
@ -87,7 +87,7 @@ void ActorController::Init(LuaState &lua)
|
||||||
sol::table playersTable = lua.getState()->create_named_table("Actors");
|
sol::table playersTable = lua.getState()->create_named_table("Actors");
|
||||||
|
|
||||||
playersTable.set_function("createActor", [&lua](){
|
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,
|
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.guid = player->guid;
|
||||||
actorList.action = mwmp::BaseActorList::SET;
|
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);
|
auto packet = mwmp::Networking::get().getActorPacketController()->GetPacket(ID_ACTOR_LIST);
|
||||||
packet->setActorList(&actorList);
|
packet->setActorList(&actorList);
|
||||||
packet->Send(actorList.guid);
|
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)
|
void ActorController::requestList(std::shared_ptr<Player> player, const ESM::Cell &cell)
|
||||||
|
|
|
@ -13,7 +13,7 @@ using namespace std;
|
||||||
|
|
||||||
void Cells::Init(LuaState &lua)
|
void Cells::Init(LuaState &lua)
|
||||||
{
|
{
|
||||||
lua.getState()->new_usertype<Cells>("Cells",
|
lua.getState()->new_usertype<Cells>("Cell",
|
||||||
"cell", sol::property(&Cells::getCell, &Cells::setCell),
|
"cell", sol::property(&Cells::getCell, &Cells::setCell),
|
||||||
"getExterior", &Cells::getExterior,
|
"getExterior", &Cells::getExterior,
|
||||||
"setExterior", &Cells::setExterior,
|
"setExterior", &Cells::setExterior,
|
||||||
|
|
|
@ -268,7 +268,7 @@ void ObjectController::Init(LuaState &lua)
|
||||||
});
|
});
|
||||||
|
|
||||||
objectCtrl.set_function("requestContainers", [&lua](shared_ptr<Player> player) {
|
objectCtrl.set_function("requestContainers", [&lua](shared_ptr<Player> player) {
|
||||||
return lua.getObjectCtrl().requestContainers(player);
|
lua.getObjectCtrl().requestContainers(player);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue