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

+7 -1
View File
@@ -51,6 +51,7 @@ void InternalGameServer::ensureBattleZoneTestBot()
auto& bot = state_.players[kBattleZonePlayer2Id];
if (!bot) bot = std::make_shared<CharacterState>();
bot->configureAsPlayer();
bot->enabled = true;
configurePlayerAnimations(*bot, resourceZipFile_);
bot->npcName = "Test Bot";
}
@@ -104,6 +105,7 @@ void InternalGameServer::startCampaign(
if (createLocalPlayer) {
auto player = std::make_shared<CharacterState>();
player->configureAsPlayer();
player->enabled = campaign.networkPlayerSlots.empty();
configurePlayerAnimations(*player, zipFile);
state_.players.emplace(localPlayerId_, std::move(player));
}
@@ -415,7 +417,10 @@ void InternalGameServer::submit(const GameCommand& command)
character->attack = 0;
character->attack_cooldown = 0;
character->currentState = AnimationState::STAND;
if (character->canAttack)
character->stopInPlace();
character->faceTargetId.clear();
character->attackTargetId.clear();
if (value.enabled && !character->isPlayer && character->canAttack)
character->attackTargetId = "player";
character->battle_state = 0;
}
@@ -544,6 +549,7 @@ void InternalGameServer::load(const nlohmann::json& in)
if (player == state_.players.end() || !player->second) continue;
player->second->configureAsPlayer();
configurePlayerAnimations(*player->second, resourceZipFile_);
//player->second->enabled = false;
}
battleZoneTestBotElapsedMs_ = 0;
ensureBattleZoneTestBot();