license: changed to more permessive MIT license.
add: set models for spawn points, only when requesting, instead of setting on every map start. fix: more translation fixes.
This commit is contained in:
parent
d9ca54dab3
commit
71355066a4
50 changed files with 193 additions and 1228 deletions
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
@ -19,8 +11,6 @@ ConVar cv_bind_menu_key ("yb_bind_menu_key", "=", "Bind's specified key for open
|
|||
ConVar cv_ignore_cvars_on_changelevel ("yb_ignore_cvars_on_changelevel", "yb_quota,yb_autovacate", "Specifies comma separated list of bot cvars, that will not be overriten by config on changelevel.", false);
|
||||
|
||||
BotConfig::BotConfig () {
|
||||
m_enableTranslation = true;
|
||||
|
||||
m_chat.resize (Chat::Count);
|
||||
m_chatter.resize (Chatter::Count);
|
||||
|
||||
|
|
@ -749,7 +739,7 @@ WeaponInfo &BotConfig::findWeaponById (const int id) {
|
|||
const char *BotConfig::translate (StringRef input) {
|
||||
// this function translate input string into needed language
|
||||
|
||||
if (!m_enableTranslation) {
|
||||
if (ctrl.ignoreTranslate ()) {
|
||||
return input.chars ();
|
||||
}
|
||||
auto hash = hashLangString (input.chars ());
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
@ -824,7 +816,7 @@ int BotControl::cmdNodeIterateCamp () {
|
|||
msg ("Before calling for 'begin' camp point, you should hit 'end'.");
|
||||
return BotCommandResult::Handled;
|
||||
}
|
||||
|
||||
|
||||
if (op == "end") {
|
||||
m_campIterator.clear ();
|
||||
}
|
||||
|
|
@ -1203,7 +1195,7 @@ int BotControl::menuGraphPage1 (int item) {
|
|||
case 4:
|
||||
graph.setEditFlag (GraphEdit::On);
|
||||
graph.erasePath ();
|
||||
|
||||
|
||||
showMenu (Menu::NodeMainPage1);
|
||||
break;
|
||||
|
||||
|
|
@ -1244,7 +1236,7 @@ int BotControl::menuGraphPage2 (int item) {
|
|||
closeMenu (); // reset menu display
|
||||
|
||||
switch (item) {
|
||||
case 1:
|
||||
case 1:
|
||||
graph.showStats ();
|
||||
showMenu (Menu::NodeMainPage2);
|
||||
|
||||
|
|
@ -1696,7 +1688,7 @@ void BotControl::showMenu (int id) {
|
|||
// translate all the things
|
||||
parsed.text = translated;
|
||||
|
||||
// make menu looks best
|
||||
// make menu looks best
|
||||
if (!(game.is (GameFlags::Legacy))) {
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
parsed.text.replace (strings.format ("%d.", j), strings.format ("\\r%d.\\w", j));
|
||||
|
|
@ -1710,7 +1702,7 @@ void BotControl::showMenu (int id) {
|
|||
return;
|
||||
}
|
||||
auto &client = util.getClient (game.indexOfPlayer (m_ent));
|
||||
|
||||
|
||||
|
||||
auto sendMenu = [&](int32 slots, bool last, StringRef text) {
|
||||
MessageWriter (MSG_ONE, msgs.id (NetMsg::ShowMenu), nullptr, m_ent)
|
||||
|
|
@ -1883,6 +1875,7 @@ BotControl::BotControl () {
|
|||
m_ent = nullptr;
|
||||
m_djump = nullptr;
|
||||
|
||||
m_ignoreTranslate = false;
|
||||
m_isFromConsole = false;
|
||||
m_isMenuFillCommand = false;
|
||||
m_rapidOutput = false;
|
||||
|
|
@ -1938,6 +1931,10 @@ void BotControl::enableDrawModels (bool enable) {
|
|||
entities.push ("info_player_deathmatch");
|
||||
entities.push ("info_vip_start");
|
||||
|
||||
if (enable) {
|
||||
game.setPlayerStartDrawModels ();
|
||||
}
|
||||
|
||||
for (auto &entity : entities) {
|
||||
game.searchEntities ("classname", entity, [&enable] (edict_t *ent) {
|
||||
if (enable) {
|
||||
|
|
@ -1947,7 +1944,7 @@ void BotControl::enableDrawModels (bool enable) {
|
|||
ent->v.effects |= EF_NODRAW;
|
||||
}
|
||||
return EntitySearchResult::Continue;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
@ -29,7 +21,7 @@ Game::Game () {
|
|||
|
||||
m_gameFlags = 0;
|
||||
m_mapFlags = 0;
|
||||
m_slowFrame = 0.0;
|
||||
m_slowFrame = 0.0f;
|
||||
|
||||
m_cvars.clear ();
|
||||
}
|
||||
|
|
@ -380,6 +372,21 @@ void Game::playSound (edict_t *ent, const char *sound) {
|
|||
engfuncs.pfnEmitSound (ent, CHAN_WEAPON, sound, 1.0f, ATTN_NORM, 0, 100);
|
||||
}
|
||||
|
||||
void Game::setPlayerStartDrawModels () {
|
||||
HashMap <String, String> models;
|
||||
|
||||
models["info_player_start"] = "models/player/urban/urban.mdl";
|
||||
models["info_player_deathmatch"] = "models/player/terror/terror.mdl";
|
||||
models["info_vip_start"] = "models/player/vip/vip.mdl";
|
||||
|
||||
models.foreach ([&] (const String &key, const String &val) {
|
||||
game.searchEntities ("classname", key, [&] (edict_t *ent) {
|
||||
m_engineWrap.setModel (ent, val.chars ());
|
||||
return EntitySearchResult::Continue;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
bool Game::checkVisibility (edict_t *ent, uint8 *set) {
|
||||
if (!set) {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
@ -295,7 +287,7 @@ void BotManager::addbot (StringRef name, int difficulty, int personality, int te
|
|||
request.manual = manual;
|
||||
|
||||
// put to queue
|
||||
m_addRequests.push (cr::move (request));
|
||||
m_addRequests.emplaceLast (cr::move (request));
|
||||
}
|
||||
|
||||
void BotManager::addbot (StringRef name, StringRef difficulty, StringRef personality, StringRef team, StringRef skin, bool manual) {
|
||||
|
|
@ -311,7 +303,7 @@ void BotManager::addbot (StringRef name, StringRef difficulty, StringRef persona
|
|||
request.personality = (personality.empty () || personality == any) ? -1 : personality.int_ ();
|
||||
request.manual = manual;
|
||||
|
||||
m_addRequests.push (cr::move (request));
|
||||
m_addRequests.emplaceLast (cr::move (request));
|
||||
}
|
||||
|
||||
void BotManager::maintainQuota () {
|
||||
|
|
@ -328,23 +320,23 @@ void BotManager::maintainQuota () {
|
|||
|
||||
// bot's creation update
|
||||
if (!m_addRequests.empty () && m_maintainTime < game.time ()) {
|
||||
const BotRequest &last = m_addRequests.pop ();
|
||||
const BotCreateResult callResult = create (last.name, last.difficulty, last.personality, last.team, last.skin);
|
||||
const BotRequest &request = m_addRequests.popFront ();
|
||||
const BotCreateResult createResult = create (request.name, request.difficulty, request.personality, request.team, request.skin);
|
||||
|
||||
if (last.manual) {
|
||||
if (request.manual) {
|
||||
cv_quota.set (cv_quota.int_ () + 1);
|
||||
}
|
||||
|
||||
// check the result of creation
|
||||
if (callResult == BotCreateResult::GraphError) {
|
||||
if (createResult == BotCreateResult::GraphError) {
|
||||
m_addRequests.clear (); // something wrong with graph, reset tab of creation
|
||||
cv_quota.set (0); // reset quota
|
||||
}
|
||||
else if (callResult == BotCreateResult::MaxPlayersReached) {
|
||||
else if (createResult == BotCreateResult::MaxPlayersReached) {
|
||||
m_addRequests.clear (); // maximum players reached, so set quota to maximum players
|
||||
cv_quota.set (getBotCount ());
|
||||
}
|
||||
else if (callResult == BotCreateResult::TeamStacked) {
|
||||
else if (createResult == BotCreateResult::TeamStacked) {
|
||||
ctrl.msg ("Could not add bot to the game: Team is stacked (to disable this check, set mp_limitteams and mp_autoteambalance to zero and restart the round)");
|
||||
|
||||
m_addRequests.clear ();
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,8 @@
|
|||
//
|
||||
// YaPB - Counter-Strike Bot based on PODBot by Markus Klinge.
|
||||
// Copyright © 2004-2020 YaPB Development Team <team@yapb.ru>.
|
||||
// Copyright © 2004-2020 YaPB Project <yapb@jeefo.net>.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// SPDX-License-Identifier: MIT
|
||||
//
|
||||
|
||||
#include <yapb.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue