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

+6 -4
View File
@@ -1902,7 +1902,8 @@ namespace FRG
if (player) {
player->update(delta, eventFor(gameServer_.localPlayerId()));
auto playerState = player->stateSnapshot();
if (playerState) updateTriggerZones(playerState->position);
if (playerState && playerState->enabled)
updateTriggerZones(playerState->position);
}
for (auto& [id, remote] : remotePlayers_)
if (remote) remote->update(delta, eventFor(id));
@@ -1937,7 +1938,8 @@ namespace FRG
}
auto playerState = player ? player->stateSnapshot() : nullptr;
if (auto* tz = getTargetTeleportZone(*locationState); tz && playerState) {
if (auto* tz = getTargetTeleportZone(*locationState);
tz && playerState && playerState->enabled) {
float dist = (playerState->position - tz->position).norm();
if (dist <= tz->radius) {
logger() << "[TELEPORT] Player reached teleport zone '" << tz->id << "'" << std::endl;
@@ -1951,7 +1953,7 @@ namespace FRG
}
}
if (playerState) {
if (playerState && playerState->enabled) {
for (auto& tz : teleportZones) {
if (!tz.active || !tz.automatic) continue;
const float autoR = tz.automaticRadius > 0.0f ? tz.automaticRadius : tz.radius;
@@ -1990,7 +1992,7 @@ namespace FRG
}
auto playerState = player ? player->stateSnapshot() : nullptr;
if (!playerState) return;
if (!playerState || !playerState->enabled) return;
auto locationState = stateSnapshot();
if (!locationState) return;
const std::string lastPlayerAttackTarget = playerState->attackTargetId;