X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fscripting.qc;h=63a6cb336d4054c90d3aa0283be057005139bed0;hb=fa0c6afce104a7e0afa9a40c5dc4b7b66d76fa22;hp=63151cac1b8e845e4be1e26663984dc24661775a;hpb=44ae1d36ba2d4628e270015637eb13f7e67b0109;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/scripting.qc b/qcsrc/server/bot/scripting.qc index 63151cac1..63a6cb336 100644 --- a/qcsrc/server/bot/scripting.qc +++ b/qcsrc/server/bot/scripting.qc @@ -273,7 +273,7 @@ void bot_commands_init() // Returns first bot with matching name entity find_bot_by_name(string name) { - local entity bot; + entity bot; bot = findchainflags(flags, FL_CLIENT); while (bot) @@ -291,8 +291,8 @@ entity find_bot_by_name(string name) // Returns a bot by number on list entity find_bot_by_number(float number) { - local entity bot; - local float c; + entity bot; + float c; if(!number) return world; @@ -313,7 +313,7 @@ entity find_bot_by_number(float number) float bot_decodecommand(string cmdstring) { - local float cmd_parm_type, i; + float cmd_parm_type, i; float sp; string parm; @@ -372,8 +372,8 @@ float bot_decodecommand(string cmdstring) void bot_cmdhelp(string scmd) { - local float i, ntype; - local string stype; + float i, ntype; + string stype; if(!bot_cmds_initialized) bot_commands_init(); @@ -487,14 +487,14 @@ void bot_cmdhelp(string scmd) void bot_list_commands() { - local float i; - local string ptype; + float i; + string ptype; if(!bot_cmds_initialized) bot_commands_init(); print("List of all available commands:\n"); - print(" Command\t\t\t\tParameter Type\n"); + print(" Command - Parameter Type\n"); for(i=1;i \n")); + print(strcat(" ",bot_cmd_string[i]," - <",ptype,"> \n")); } } @@ -625,7 +625,7 @@ float bot_cmd_turn() float bot_cmd_select_weapon() { - local float id; + float id; id = bot_cmd.bot_cmd_parm_float; @@ -679,8 +679,8 @@ float bot_cmd_eval(string expr) float bot_cmd_if() { - local string expr, val_a, val_b; - local float cmpofs; + string expr, val_a, val_b; + float cmpofs; if(self.bot_cmd_condition_status != CMD_CONDITION_NONE) { @@ -777,7 +777,7 @@ float bot_cmd_aim() // Current direction if(self.bot_cmd_aim_endtime) { - local float progress; + float progress; progress = min(1 - (self.bot_cmd_aim_endtime - time) / (self.bot_cmd_aim_endtime - self.bot_cmd_aim_begintime),1); self.v_angle = self.bot_cmd_aim_begin + ((self.bot_cmd_aim_end - self.bot_cmd_aim_begin) * progress); @@ -792,25 +792,25 @@ float bot_cmd_aim() } // New aiming direction - local string parms; - local float tokens, step; + string parms; + float tokens, step; parms = bot_cmd.bot_cmd_parm_string; tokens = tokenizebyseparator(parms, " "); - if(tokens==2) + if(tokens<2||tokens>3) + return CMD_STATUS_ERROR; + + step = (tokens == 3) ? stof(argv(2)) : 0; + + if(step == 0) { self.v_angle_x -= stof(argv(1)); self.v_angle_y += stof(argv(0)); return CMD_STATUS_FINISHED; } - if(tokens<2||tokens>3) - return CMD_STATUS_ERROR; - - step = stof(argv(2)); - self.bot_cmd_aim_begin = self.v_angle; self.bot_cmd_aim_end_x = self.v_angle_x - stof(argv(1)); @@ -830,10 +830,10 @@ float bot_cmd_aimtarget() return bot_cmd_aim(); } - local entity e; - local string parms; - local vector v; - local float tokens, step; + entity e; + string parms; + vector v; + float tokens, step; parms = bot_cmd.bot_cmd_parm_string; @@ -1027,7 +1027,7 @@ float bot_cmd_keypress_handler(string key, float enabled) float bot_cmd_presskey() { - local string key; + string key; key = bot_cmd.bot_cmd_parm_string; @@ -1038,7 +1038,7 @@ float bot_cmd_presskey() float bot_cmd_releasekey() { - local string key; + string key; key = bot_cmd.bot_cmd_parm_string; @@ -1106,7 +1106,7 @@ float bot_cmd_debug_assert_canfire() if(f) { self.colormod = '0 8 8'; - print("Bot wants to fire, inhibited by weaponentity state\n"); + print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by weaponentity state\n"); } } else if(ATTACK_FINISHED(self) > time) @@ -1114,7 +1114,7 @@ float bot_cmd_debug_assert_canfire() if(f) { self.colormod = '8 0 8'; - print("Bot wants to fire, inhibited by ATTACK_FINISHED\n"); + print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(self) - time), " seconds left)\n"); } } else if(self.tuba_note) @@ -1122,7 +1122,7 @@ float bot_cmd_debug_assert_canfire() if(f) { self.colormod = '8 0 0'; - print("Bot wants to fire, bot still has an active tuba note\n"); + print("Bot ", self.netname, " using ", self.weaponname, " wants to fire, bot still has an active tuba note\n"); } } else @@ -1130,7 +1130,7 @@ float bot_cmd_debug_assert_canfire() if(!f) { self.colormod = '8 8 0'; - print("Bot thinks it has fired, but apparently did not\n"); + print("Bot ", self.netname, " using ", self.weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(self) - time), " seconds left\n"); } } @@ -1213,7 +1213,7 @@ void bot_resetqueues() // NOTE: Of course you need to include your commands here too :) float bot_execute_commands_once() { - local float status, ispressingkey; + float status, ispressingkey; // Find command bot_setcurrentcommand(); @@ -1346,7 +1346,7 @@ float bot_execute_commands_once() { if(autocvar_g_debug_bot_commands) { - local string parms; + string parms; switch(bot_cmd_parm_type[bot_cmd.bot_cmd_type]) {