X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fbot.qc;h=1b6d8eb4ea440fed2954148d180b317469972203;hb=3a264e945a45a04f4566feb9e9a91e0d5266361e;hp=951d4adb67cc6e5ff8bfb93f372620b7be9b6ec5;hpb=60f1e3301beae3dac0765d8ee8eb350ee21c8f30;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 951d4adb6..1b6d8eb4e 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -12,7 +12,7 @@ entity bot_spawn() { - local entity oldself, bot; + entity oldself, bot; bot = spawnclient(); if (bot) { @@ -25,7 +25,7 @@ entity bot_spawn() self = oldself; } return bot; -}; +} void bot_think() { @@ -103,7 +103,7 @@ void bot_think() // now call the current bot AI (havocbot for example) self.bot_ai(); -}; +} void bot_setnameandstuff() { @@ -235,11 +235,11 @@ void bot_setnameandstuff() self.cvar_cl_accuracy_data_share = 1; // share the bots weapon accuracy data with the world self.cvar_cl_accuracy_data_receive = 0; // don't receive any weapon accuracy data -}; +} void bot_custom_weapon_priority_setup() { - local float tokens, i, c, w; + float tokens, i, c, w; bot_custom_weapon = FALSE; @@ -312,11 +312,11 @@ void bot_custom_weapon_priority_setup() bot_weapons_close[c] = -1; bot_custom_weapon = TRUE; -}; +} void bot_endgame() { - local entity e; + entity e; //dprint("bot_endgame\n"); e = bot_list; while (e) @@ -325,12 +325,12 @@ void bot_endgame() e = e.nextbot; } // if dynamic waypoints are ever implemented, save them here -}; +} void bot_relinkplayerlist() { - local entity e; - local entity prevbot; + entity e; + entity prevbot; player_count = 0; currentbots = 0; player_list = e = findchainflags(flags, FL_CLIENT); @@ -357,7 +357,7 @@ void bot_relinkplayerlist() dprint(strcat("relink: ", ftos(currentbots), " bots seen.\n")); bot_strategytoken = bot_list; bot_strategytoken_taken = TRUE; -}; +} void bot_clientdisconnect() { @@ -405,12 +405,12 @@ void bot_clientconnect() JoinBestTeam(self, FALSE, TRUE); havocbot_setupbot(); -}; +} void bot_removefromlargestteam() { - local float besttime, bestcount, thiscount; - local entity best, head; + float besttime, bestcount, thiscount; + entity best, head; CheckAllowedTeams(world); GetTeamCounts(world); head = findchainfloat(isbot, TRUE); @@ -446,12 +446,12 @@ void bot_removefromlargestteam() } currentbots = currentbots - 1; dropclient(best); -}; +} void bot_removenewest() { - local float besttime; - local entity best, head; + float besttime; + entity best, head; if(teamplay) { @@ -475,7 +475,7 @@ void bot_removenewest() } currentbots = currentbots - 1; dropclient(best); -}; +} void autoskill(float factor) { @@ -529,6 +529,14 @@ void autoskill(float factor) head.totalfrags_lastcheck = head.totalfrags; } +void bot_calculate_stepheightvec(void) +{ + stepheightvec = autocvar_sv_stepheight * '0 0 1'; + jumpstepheightvec = stepheightvec + + ((autocvar_sv_jumpvelocity * autocvar_sv_jumpvelocity) / (2 * autocvar_sv_gravity)) * '0 0 0.85'; + // 0.75 factor is for safety to make the jumps easy +} + void bot_serverframe() { float realplayers, bots, activerealplayers; @@ -540,7 +548,7 @@ void bot_serverframe() if (time < 2) return; - stepheightvec = autocvar_sv_stepheight * '0 0 1'; + bot_calculate_stepheightvec(); bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL); if(time > autoskill_nextthink) @@ -625,7 +633,7 @@ void bot_serverframe() else { // TODO: Make this check cleaner - local entity wp = findchain(classname, "waypoint"); + entity wp = findchain(classname, "waypoint"); if(time - wp.nextthink > 10) waypoint_save_links(); } @@ -654,7 +662,7 @@ void bot_serverframe() if (botframe_nextdangertime < time) { - local float interval; + float interval; interval = autocvar_bot_ai_dangerdetectioninterval; if (botframe_nextdangertime < time - interval * 1.5) botframe_nextdangertime = time; @@ -672,4 +680,4 @@ void bot_serverframe() bot_custom_weapon_priority_setup(); bot_cvar_nextthink = time + 5; } -}; +}