From 5a2d0748c0d12ebd9188ddbb6eede5c8accd3a15 Mon Sep 17 00:00:00 2001 From: jeefo Date: Tue, 20 Jun 2023 22:00:15 +0300 Subject: [PATCH] fix: bots on csdm never respawning thus never resets their states (fixes #459) --- src/linkage.cpp | 6 ------ src/manager.cpp | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/linkage.cpp b/src/linkage.cpp index 68b901b..29238f6 100644 --- a/src/linkage.cpp +++ b/src/linkage.cpp @@ -86,12 +86,6 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) { // Spawn() function is one of the functions any entity is supposed to have in the game DLL, // and any MOD is supposed to implement one for each of its entities. - auto bot = bots[ent]; - - if (bot) { - bot->spawned (); - } - // precache everything game.precache (); diff --git a/src/manager.cpp b/src/manager.cpp index 5bbac60..d850e43 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -1263,6 +1263,11 @@ void BotManager::handleDeath (edict_t *killer, edict_t *victim) { } } + // mark bot as "spawned", and reset it to new-round state when it dead (for csdm only) + if (victimBot != nullptr) { + victimBot->spawned (); + } + // is this message about a bot who killed somebody? if (killerBot != nullptr) { killerBot->m_lastVictim = victim;