player connect-disconnect

This commit is contained in:
Vladislav Khorev committed 2026-11-06 22:07:47 +06:00
1 parent 3f68a8ba07
commit 2e6b93f3ac
16 files changed
+305 -62

No files matched your search

+12 -3
View File
@@ -7,6 +7,7 @@
#include <iostream>
#include <mutex>
#include <thread>
#include <type_traits>
#include <utility>
#include <vector>
@@ -252,9 +253,17 @@ void WebsocketGameClient::update(std::int64_t)
pendingTicks_.erase(next);
const std::string locationId =
replica_.snapshot()->currentLocationId;
for (const ScheduledDestinationCommand& command : tick.commands) {
replica_.submit(SetCharacterDestinationCommand{
locationId, command.playerId, command.target, {}});
for (const ScheduledCommand& scheduled : tick.commands) {
std::visit([&](const auto& command) {
using T = std::decay_t<decltype(command)>;
if constexpr (std::is_same_v<T, ScheduledDestinationCommand>) {
replica_.submit(SetCharacterDestinationCommand{
locationId, command.playerId, command.target, {}});
} else {
replica_.submit(SetCharacterEnabledCommand{
command.locationId, command.characterId, command.enabled});
}
}, scheduled);
}
replica_.update(kSimulationTickMs);
completedSimulationTicks_.push_back({