Fix Teams not functioning as swapped character
This commit is contained in:
parent
ddab1db73f
commit
f2afd91d0f
@ -132,7 +132,7 @@ void TeamBar::updatePlayerResources() {
|
||||
m_energyBar->setColor(m_energyBarColor.mix(m_energyBarRegenMixColor, player->energyRegenBlockPercent()));
|
||||
}
|
||||
|
||||
m_nameLabel->setText(m_client->mainPlayer()->name());
|
||||
m_nameLabel->setText(player->name());
|
||||
}
|
||||
|
||||
void TeamBar::inviteButton() {
|
||||
|
@ -79,7 +79,7 @@ TeleportDialog::TeleportDialog(UniverseClientPtr client,
|
||||
if (config.getBool("includePartyMembers", false)) {
|
||||
auto teamClient = m_client->teamClient();
|
||||
for (auto member : teamClient->members()) {
|
||||
if (member.uuid == m_client->mainPlayer()->uuid() || member.warpMode == WarpMode::None)
|
||||
if (member.uuid == m_client->clientContext()->playerUuid() || member.warpMode == WarpMode::None)
|
||||
continue;
|
||||
|
||||
auto entry = destList->addItem();
|
||||
|
@ -28,7 +28,7 @@ TeamClient::TeamClient(PlayerPtr mainPlayer, ClientContextPtr clientContext) {
|
||||
bool TeamClient::isTeamLeader() {
|
||||
if (!m_teamUuid)
|
||||
return false;
|
||||
return m_teamLeader == m_mainPlayer->uuid();
|
||||
return m_teamLeader == m_clientContext->playerUuid();
|
||||
}
|
||||
|
||||
bool TeamClient::isTeamLeader(Uuid const& playerUuid) {
|
||||
@ -47,7 +47,7 @@ void TeamClient::invitePlayer(String const& playerName) {
|
||||
|
||||
JsonObject request;
|
||||
request["inviteeName"] = playerName;
|
||||
request["inviterUuid"] = m_mainPlayer->uuid().hex();
|
||||
request["inviterUuid"] = m_clientContext->playerUuid().hex();
|
||||
request["inviterName"] = m_mainPlayer->name();
|
||||
invokeRemote("team.invite", request, [](Json) {});
|
||||
}
|
||||
@ -55,7 +55,7 @@ void TeamClient::invitePlayer(String const& playerName) {
|
||||
void TeamClient::acceptInvitation(Uuid const& inviterUuid) {
|
||||
JsonObject request;
|
||||
request["inviterUuid"] = inviterUuid.hex();
|
||||
request["inviteeUuid"] = m_mainPlayer->uuid().hex();
|
||||
request["inviteeUuid"] = m_clientContext->playerUuid().hex();
|
||||
invokeRemote("team.acceptInvitation", request, [this](Json) { forceUpdate(); });
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ void TeamClient::makeLeader(Uuid const& playerUuid) {
|
||||
void TeamClient::removeFromTeam(Uuid const& playerUuid) {
|
||||
if (!m_teamUuid)
|
||||
return;
|
||||
if (!isTeamLeader() && playerUuid != m_mainPlayer->uuid())
|
||||
if (!isTeamLeader() && playerUuid != m_clientContext->playerUuid())
|
||||
return;
|
||||
JsonObject request;
|
||||
request["teamUuid"] = m_teamUuid->hex();
|
||||
@ -101,7 +101,7 @@ void TeamClient::update() {
|
||||
if (Time::monotonicTime() - m_pollInvitationsTimer > Root::singleton().assets()->json("/interface.config:invitationPollInterval").toFloat()) {
|
||||
m_pollInvitationsTimer = Time::monotonicTime();
|
||||
JsonObject request;
|
||||
request["playerUuid"] = m_mainPlayer->uuid().hex();
|
||||
request["playerUuid"] = m_clientContext->playerUuid().hex();
|
||||
invokeRemote("team.pollInvitation", request, [this](Json response) {
|
||||
if (response.isNull())
|
||||
return;
|
||||
@ -131,7 +131,7 @@ void TeamClient::pullFullUpdate() {
|
||||
return;
|
||||
m_fullUpdateRunning = true;
|
||||
JsonObject request;
|
||||
request["playerUuid"] = m_mainPlayer->uuid().hex();
|
||||
request["playerUuid"] = m_clientContext->playerUuid().hex();
|
||||
|
||||
invokeRemote("team.fetchTeamStatus", request, [this](Json response) {
|
||||
m_fullUpdateRunning = false;
|
||||
@ -212,7 +212,7 @@ void TeamClient::handleRpcResponses() {
|
||||
}
|
||||
|
||||
void TeamClient::writePlayerData(JsonObject& request, PlayerPtr player, bool fullWrite) const {
|
||||
request["playerUuid"] = player->uuid().hex();
|
||||
request["playerUuid"] = m_clientContext->playerUuid().hex();
|
||||
request["entity"] = player->entityId();
|
||||
request["health"] = player->health() / player->maxHealth();
|
||||
request["energy"] = player->energy() / player->maxEnergy();
|
||||
|
@ -394,7 +394,7 @@ CelestialCoordinate UniverseClient::shipCoordinate() const {
|
||||
}
|
||||
|
||||
bool UniverseClient::playerOnOwnShip() const {
|
||||
return playerWorld().is<ClientShipWorldId>() && playerWorld().get<ClientShipWorldId>() == mainPlayer()->uuid();
|
||||
return playerWorld().is<ClientShipWorldId>() && playerWorld().get<ClientShipWorldId>() == m_clientContext->playerUuid();
|
||||
}
|
||||
|
||||
bool UniverseClient::playerIsOriginal() const {
|
||||
@ -412,7 +412,7 @@ bool UniverseClient::isAdmin() const {
|
||||
Uuid UniverseClient::teamUuid() const {
|
||||
if (auto team = m_teamClient->currentTeam())
|
||||
return *team;
|
||||
return m_mainPlayer->uuid();
|
||||
return m_clientContext->playerUuid();
|
||||
}
|
||||
|
||||
WorldTemplateConstPtr UniverseClient::currentTemplate() const {
|
||||
|
Loading…
Reference in New Issue
Block a user