X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fbot.qc;h=90ef1e2c9258ddbd195b18f8f2809bdb933801cd;hb=969dc49d01d650a812706aba16c765af488605d0;hp=f367adab32c538c455a1a12ea8216897de1d2781;hpb=97177a79357838fa546b5ee0fada274f0a55e12d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/bot.qc b/qcsrc/server/bot/default/bot.qc index f367adab3..90ef1e2c9 100644 --- a/qcsrc/server/bot/default/bot.qc +++ b/qcsrc/server/bot/default/bot.qc @@ -18,8 +18,9 @@ #include "../../client.qh" #include "../../constants.qh" #include "../../defs.qh" +#include #include "../../race.qh" -#include +#include #include @@ -104,7 +105,8 @@ void bot_think(entity this) // clear buttons PHYS_INPUT_BUTTON_ATCK(this) = false; - PHYS_INPUT_BUTTON_JUMP(this) = false; + // keep jump button pressed for a short while, useful with ramp jumps + PHYS_INPUT_BUTTON_JUMP(this) = (!IS_DEAD(this) && time < this.bot_jump_time + 0.2); PHYS_INPUT_BUTTON_ATCK2(this) = false; PHYS_INPUT_BUTTON_ZOOM(this) = false; PHYS_INPUT_BUTTON_CROUCH(this) = false; @@ -145,21 +147,7 @@ void bot_think(entity this) void bot_setnameandstuff(entity this) { string readfile, s; - float file, tokens, prio; - - string bot_name, bot_model, bot_skin, bot_shirt, bot_pants; - string name, prefix, suffix; - - if(autocvar_g_campaign) - { - prefix = ""; - suffix = ""; - } - else - { - prefix = autocvar_bot_prefix; - suffix = autocvar_bot_suffix; - } + int file, tokens, prio; file = fopen(autocvar_bot_config_file, FILE_READ); @@ -230,6 +218,8 @@ void bot_setnameandstuff(entity this) fclose(file); } + string bot_name, bot_model, bot_skin, bot_shirt, bot_pants; + tokens = tokenizebyseparator(readfile, "\t"); if(argv(0) != "") bot_name = argv(0); else bot_name = "Bot"; @@ -288,13 +278,10 @@ void bot_setnameandstuff(entity this) setcolor(this, stof(bot_shirt) * 16 + stof(bot_pants)); this.bot_preferredcolors = this.clientcolors; - // pick the name - if (autocvar_bot_usemodelnames) - name = bot_model; - else - name = bot_name; + string prefix = (autocvar_g_campaign ? "" : autocvar_bot_prefix); + string suffix = (autocvar_g_campaign ? "" : autocvar_bot_suffix); + string name = (autocvar_bot_usemodelnames ? bot_model : bot_name); - // number bots with identical names if (name == "") { name = ftos(etof(this)); @@ -302,6 +289,7 @@ void bot_setnameandstuff(entity this) } else { + // number bots with identical names int j = 0; FOREACH_CLIENT(IS_BOT_CLIENT(it), { if(it.cleanname == name) @@ -363,14 +351,14 @@ void bot_custom_weapon_priority_setup() tokens = tokenizebyseparator(W_NumberWeaponOrder(autocvar_bot_ai_custom_weapon_priority_##dist)," "); \ bot_weapons_##dist[0] = -1; \ c = 0; \ - for(i = 0; i < tokens && c < Weapons_COUNT; ++i) { \ + for(i = 0; i < tokens && c < REGISTRY_COUNT(Weapons); ++i) { \ w = stof(argv(i)); \ if (w >= WEP_FIRST && w <= WEP_LAST) { \ bot_weapons_##dist[c] = w; \ ++c; \ } \ } \ - if (c < Weapons_COUNT) \ + if (c < REGISTRY_COUNT(Weapons)) \ bot_weapons_##dist[c] = -1; \ } \ MACRO_END