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

Method updateTeams

source/game/StarUniverseServer.cpp:650–676  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

648}
649
650void UniverseServer::updateTeams() {
651 RecursiveMutexLocker locker(m_mainLock);
652 ReadLocker clientsLocker(m_clientsLock);
653
654 StringMap<List<Uuid>> connectedPlayers;
655 auto teams = m_teamManager->getPvpTeams();
656 for (auto const& p : m_clients) {
657 connectedPlayers[p.second->playerName()].append(p.second->playerUuid());
658
659 if (p.second->team().type == TeamType::PVP)
660 p.second->setTeam(EntityDamageTeam(TeamType::PVP, teams.value(p.second->playerUuid(), soloPvpTeam(p.second->clientId()))));
661 else
662 p.second->setTeam(EntityDamageTeam(TeamType::Friendly));
663
664 auto channels = m_chatProcessor->clientChannels(p.first);
665 auto team = m_teamManager->getTeam(p.second->playerUuid());
666 for (auto const& channel : channels) {
667 if (channel != printWorldId(p.second->playerWorldId()) && (!team || channel != team.value().hex()))
668 m_chatProcessor->leaveChannel(p.first, channel);
669 }
670 if (team && !channels.contains(team.value().hex()))
671 m_chatProcessor->joinChannel(p.first, team.value().hex());
672
673 }
674
675 m_teamManager->setConnectedPlayers(connectedPlayers);
676}
677
678void UniverseServer::updateShips() {
679 RecursiveMutexLocker locker(m_mainLock);

Callers

nothing calls this directly

Calls 15

EntityDamageTeamClass · 0.85
soloPvpTeamFunction · 0.85
printWorldIdFunction · 0.85
getPvpTeamsMethod · 0.80
playerUuidMethod · 0.80
clientIdMethod · 0.80
clientChannelsMethod · 0.80
hexMethod · 0.80
leaveChannelMethod · 0.80
joinChannelMethod · 0.80
setConnectedPlayersMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected