| 232 | } |
| 233 | |
| 234 | void 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 | |
| 258 | void TeamClient::clearTeam() { |
| 259 | m_teamLeader = Uuid(); |
nothing calls this directly
no test coverage detected