Add client world.players

This commit is contained in:
Kae 2023-07-03 18:22:44 +10:00
parent 1742b04eec
commit 1dacc0f41a

View File

@ -357,6 +357,16 @@ namespace LuaBindings {
if (auto clientWorld = as<WorldClient>(world)) { if (auto clientWorld = as<WorldClient>(world)) {
callbacks.registerCallbackWithSignature<RectI>("clientWindow", bind(ClientWorldCallbacks::clientWindow, clientWorld)); callbacks.registerCallbackWithSignature<RectI>("clientWindow", bind(ClientWorldCallbacks::clientWindow, clientWorld));
callbacks.registerCallback("players", [clientWorld]() {
List<EntityId> playerIds;
clientWorld->forAllEntities([&](EntityPtr const& entity) {
if (entity->entityType() == EntityType::Player)
playerIds.emplace_back(entity->entityId());
});
return playerIds;
});
} }
if (auto serverWorld = as<WorldServer>(world)) { if (auto serverWorld = as<WorldServer>(world)) {