Player teammembers
This commit is contained in:
parent
aac3e53941
commit
f270c3f168
@ -527,3 +527,9 @@ Returns uuid, type, and orbits for all system objects in the specified system;
|
|||||||
#### `List<String>` player.collectables(`String` collectionName)
|
#### `List<String>` player.collectables(`String` collectionName)
|
||||||
|
|
||||||
Returns a list of names of the collectables the player has unlocked in the specified collection.
|
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`
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "StarInspectionTool.hpp"
|
#include "StarInspectionTool.hpp"
|
||||||
#include "StarUtilityLuaBindings.hpp"
|
#include "StarUtilityLuaBindings.hpp"
|
||||||
#include "StarCelestialLuaBindings.hpp"
|
#include "StarCelestialLuaBindings.hpp"
|
||||||
|
#include "StarUniverseClient.hpp"
|
||||||
|
#include "StarTeamClient.hpp"
|
||||||
|
|
||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
@ -2072,6 +2074,20 @@ Vec2F Player::nametagOrigin() const {
|
|||||||
void Player::updateIdentity()
|
void Player::updateIdentity()
|
||||||
{ m_identityUpdated = true; m_humanoid->setIdentity(m_identity); }
|
{ m_identityUpdated = true; m_humanoid->setIdentity(m_identity); }
|
||||||
|
|
||||||
|
JsonArray Player::teamMembers() {
|
||||||
|
JsonArray jarray;
|
||||||
|
for (auto member : m_client->teamClient()->members()) {
|
||||||
|
jarray.push_back(JsonObject{
|
||||||
|
{"name", member.name},
|
||||||
|
{"uuid", member.uuid.hex()},
|
||||||
|
{"entity", member.entity},
|
||||||
|
{"healthPercentage", member.healthPercentage},
|
||||||
|
{"energyPercentage", member.energyPercentage}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return jarray;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::setBodyDirectives(String const& directives)
|
void Player::setBodyDirectives(String const& directives)
|
||||||
{ m_identity.bodyDirectives = directives; updateIdentity(); }
|
{ m_identity.bodyDirectives = directives; updateIdentity(); }
|
||||||
|
|
||||||
|
@ -316,6 +316,8 @@ public:
|
|||||||
|
|
||||||
void updateIdentity();
|
void updateIdentity();
|
||||||
|
|
||||||
|
JsonArray teamMembers();
|
||||||
|
|
||||||
void setBodyDirectives(String const& directives);
|
void setBodyDirectives(String const& directives);
|
||||||
void setEmoteDirectives(String const& directives);
|
void setEmoteDirectives(String const& directives);
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ LuaCallbacks LuaBindings::makePlayerCallbacks(Player* player) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
callbacks.registerCallback("teamMembers", [player]() { return player->teamMembers(); });
|
||||||
|
|
||||||
callbacks.registerCallback( "humanoidIdentity", [player]() { return player->humanoid()->identity().toJson(); });
|
callbacks.registerCallback( "humanoidIdentity", [player]() { return player->humanoid()->identity().toJson(); });
|
||||||
callbacks.registerCallback("setHumanoidIdentity", [player](Json const& id) { player->setIdentity(HumanoidIdentity(id)); });
|
callbacks.registerCallback("setHumanoidIdentity", [player](Json const& id) { player->setIdentity(HumanoidIdentity(id)); });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user