fix: unrelated client messages by resetting client command issuer, if not handled by the bot (related #360 )
This commit is contained in:
parent
e6fe2a6a22
commit
10db943cdf
2 changed files with 20 additions and 8 deletions
|
|
@ -1571,6 +1571,10 @@ bool BotControl::executeCommands () {
|
|||
// do not allow to execute stuff for non admins
|
||||
if (m_ent != game.getLocalEntity () && !(client.flags & ClientFlags::Admin)) {
|
||||
msg ("Access to %s commands is restricted.", product.name);
|
||||
|
||||
// reset issuer, but returns "true" to suppress "unknown command" message
|
||||
setIssuer (nullptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1919,20 +1923,25 @@ void BotControl::handleEngineCommands () {
|
|||
executeCommands ();
|
||||
}
|
||||
|
||||
bool BotControl::handleClientCommands (edict_t *ent) {
|
||||
bool BotControl::handleClientSideCommandsWrapper (edict_t *ent, bool isMenus) {
|
||||
collectArgs ();
|
||||
setIssuer (ent);
|
||||
|
||||
setFromConsole (true);
|
||||
return executeCommands ();
|
||||
setFromConsole (!isMenus);
|
||||
auto result = isMenus ? executeMenus () : executeCommands ();
|
||||
|
||||
if (!result) {
|
||||
setIssuer (nullptr);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool BotControl::handleClientCommands (edict_t *ent) {
|
||||
return handleClientSideCommandsWrapper (ent, false);
|
||||
}
|
||||
|
||||
bool BotControl::handleMenuCommands (edict_t *ent) {
|
||||
collectArgs ();
|
||||
setIssuer (ent);
|
||||
|
||||
setFromConsole (false);
|
||||
return ctrl.executeMenus ();
|
||||
return handleClientSideCommandsWrapper (ent, true);
|
||||
}
|
||||
|
||||
void BotControl::enableDrawModels (bool enable) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue