MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / writePlayerData

Method writePlayerData

source/game/StarTeamClient.cpp:234–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

232}
233
234void TeamClient::writePlayerData(JsonObject& request, PlayerPtr player, bool fullWrite) const {
235 request["playerUuid"] = m_clientContext->playerUuid().hex();
236 request["entity"] = player->entityId();
237 request["health"] = player->health() / player->maxHealth();
238 request["energy"] = player->energy() / player->maxEnergy();
239 request["x"] = player->position()[0];
240 request["y"] = player->position()[1];
241 request["world"] = printWorldId(m_clientContext->playerWorldId());
242
243 WarpMode mode = WarpMode::None;
244 if (player->log()->introComplete()) {
245 if (m_clientContext->playerWorldId().is<CelestialWorldId>())
246 mode = WarpMode::BeamOnly;
247 else
248 mode = player->isDeployed() ? WarpMode::DeployOnly : WarpMode::BeamOnly;
249 }
250 request["warpMode"] = WarpModeNames.getRight(mode);
251
252 if (fullWrite) {
253 request["name"] = player->name();
254 request["portrait"] = jsonFromList(player->portrait(PortraitMode::Head), mem_fn(&Drawable::toJson));
255 }
256}
257
258void TeamClient::clearTeam() {
259 m_teamLeader = Uuid();

Callers

nothing calls this directly

Calls 15

printWorldIdFunction · 0.85
jsonFromListFunction · 0.85
hexMethod · 0.80
playerUuidMethod · 0.80
entityIdMethod · 0.80
maxEnergyMethod · 0.80
introCompleteMethod · 0.80
healthMethod · 0.45
maxHealthMethod · 0.45
energyMethod · 0.45
positionMethod · 0.45
playerWorldIdMethod · 0.45

Tested by

no test coverage detected