commit
250869e215
@ -527,3 +527,9 @@ Returns uuid, type, and orbits for all system objects in the specified system;
|
||||
#### `List<String>` player.collectables(`String` collectionName)
|
||||
|
||||
Returns a list of names of the collectables the player has unlocked in the specified collection.
|
||||
|
||||
---
|
||||
|
||||
#### `List<Json>` player.teamMembers()
|
||||
|
||||
Returns an array, each entry being a table with `name`, `uuid`, `entity`, `healthPercentage` and `energyPercentage`
|
||||
|
@ -293,6 +293,10 @@ void Player::setUniverseClient(UniverseClient* client) {
|
||||
m_questManager->setUniverseClient(client);
|
||||
}
|
||||
|
||||
UniverseClient* Player::universeClient() const {
|
||||
return m_client;
|
||||
}
|
||||
|
||||
EntityType Player::entityType() const {
|
||||
return EntityType::Player;
|
||||
}
|
||||
|
@ -88,6 +88,7 @@ public:
|
||||
void setStatistics(StatisticsPtr statistics);
|
||||
|
||||
void setUniverseClient(UniverseClient* universeClient);
|
||||
UniverseClient* universeClient() const;
|
||||
|
||||
QuestManagerPtr questManager() const;
|
||||
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "StarStatistics.hpp"
|
||||
#include "StarPlayerUniverseMap.hpp"
|
||||
#include "StarJsonExtra.hpp"
|
||||
#include "StarUniverseClient.hpp"
|
||||
#include "StarTeamClient.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
@ -27,6 +29,20 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) {
|
||||
}
|
||||
});
|
||||
|
||||
callbacks.registerCallback("teamMembers", [player]() -> Maybe<JsonArray> {
|
||||
if (auto client = player->universeClient()) {
|
||||
return client->teamClient()->members().transformed([](TeamClient::Member const& member) -> Json {
|
||||
return JsonObject{
|
||||
{"name", member.name},
|
||||
{"uuid", member.uuid.hex()},
|
||||
{"entity", member.entity},
|
||||
{"healthPercentage", member.healthPercentage},
|
||||
{"energyPercentage", member.energyPercentage}};
|
||||
});
|
||||
}
|
||||
return {};
|
||||
});
|
||||
|
||||
callbacks.registerCallback( "humanoidIdentity", [player]() { return player->humanoid()->identity().toJson(); });
|
||||
callbacks.registerCallback("setHumanoidIdentity", [player](Json const& id) { player->setIdentity(HumanoidIdentity(id)); });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user