diff --git a/.gitignore b/.gitignore index 7a22acd..d7aa182 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,8 @@ !/main_shared/maps/mp/gametypes/_callbacksetup.gsx main_shared/maps/mp/gametypes/_globallogic.gsx main_shared/maps/mp/gametypes/_hardpoints.gsx + +!/main/ +/main/* +!/main/botnames.txt +!/main/waypoints/ diff --git a/botnames.txt b/botnames.txt deleted file mode 100644 index f2b0d82..0000000 --- a/botnames.txt +++ /dev/null @@ -1,6 +0,0 @@ -a -b -c -d -e -f \ No newline at end of file diff --git a/main/botnames.txt b/main/botnames.txt new file mode 100644 index 0000000..bacce26 --- /dev/null +++ b/main/botnames.txt @@ -0,0 +1,26 @@ +bota +botb +botc +botd +bote +botf +botg +both +boti +botj +botk +botl +botm +botn +boto +botp +botq +botr +bots +bott +botu +botv +botw +botx +boty +botz \ No newline at end of file diff --git a/main_shared/maps/mp/bots/_bot.gsc b/main_shared/maps/mp/bots/_bot.gsc index efad54e..c49e352 100644 --- a/main_shared/maps/mp/bots/_bot.gsc +++ b/main_shared/maps/mp/bots/_bot.gsc @@ -315,7 +315,14 @@ connected() */ add_bot() { - bot = addtestclient(); + name = getABotName(); + + bot = undefined; + + if (isDefined(name) && name.size >= 3) + bot = addtestclient(name); + else + bot = addtestclient(); if (isdefined(bot)) { diff --git a/main_shared/maps/mp/bots/_bot_utility.gsc b/main_shared/maps/mp/bots/_bot_utility.gsc index 7dab32f..8c59b7e 100644 --- a/main_shared/maps/mp/bots/_bot_utility.gsc +++ b/main_shared/maps/mp/bots/_bot_utility.gsc @@ -652,6 +652,40 @@ parseTokensIntoWaypoint(tokens) return waypoint; } +getABotName() +{ + if (!isDefined(level.bot_names)) + { + level.bot_names = []; + level.bot_name_cursor = 0; + + filename = "botnames.txt"; + + if (FS_TestFile(filename)) + { + f = FS_FOpen(filename, "read"); + + name = FS_ReadLine(f); + while (isDefined(name) && name != "") + { + level.bot_names[level.bot_names.size] = name; + + name = FS_ReadLine(f); + } + + FS_FClose(f); + } + } + + if (!level.bot_names.size) + return undefined; + + name = level.bot_names[level.bot_name_cursor % level.bot_names.size]; + level.bot_name_cursor++; + + return name; +} + readWpsFromFile(mapname) { waypoints = [];