feat(world): activity lobbies join, ready and leave through the chat server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-30 04:12:00 -05:00
parent 2ae086d933
commit 289a1acfdf
4 changed files with 99 additions and 359 deletions

View File

@@ -69,6 +69,8 @@
#include "Entity.h"
#include "Character.h"
#include "ChatPackets.h"
#include "ScriptedActivityComponent.h"
#include "eReplicaComponentType.h"
#include "WorldRoutePacket.h"
#include "ChatServerLink.h"
#include "PacketDispatcher.h"
@@ -768,6 +770,17 @@ namespace {
Game::entityManager->SerializeEntity(player);
});
// An activity lobby's match has its instance (docs/Matchmaking.md): send our players in it there
handlers.On<ChatPackets::MatchTransfer>(MessageType::Chat::MATCH_TRANSFER, [](const ChatPackets::MatchTransfer& transfer, const SystemAddress&) {
for (auto* entity : Game::entityManager->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY)) {
auto* activity = entity->GetComponent<ScriptedActivityComponent>();
if (!activity || activity->GetActivityID() != transfer.activityID || !activity->HasLobby()) continue;
activity->StartMatch(transfer);
return;
}
LOG("Matchmaking: no activity %i in this world for a match of %zu player(s)", transfer.activityID, transfer.players.size());
});
// New mail for a player the chat server says is in this world
handlers.On<ChatPackets::MailNotify>(MessageType::Chat::MAIL, [](const ChatPackets::MailNotify& notify, const SystemAddress&) {
Mail::NotifyNewMailHere(notify.receiverID);