X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fscripting.qc;fp=qcsrc%2Fserver%2Fbot%2Fdefault%2Fscripting.qc;h=badf9437ecb9c8f16cc0ac28afbed8d1dc93d82c;hb=fdbfb6f9364d8aeae67e108400a6bd1dd37dc0b7;hp=7f6e17f5e4c53ea85eea0fa9eb259fe8af3919f5;hpb=0f2e3cd6c6554bda254111dee0746fea05aac047;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/scripting.qc b/qcsrc/server/bot/default/scripting.qc index 7f6e17f5e..badf9437e 100644 --- a/qcsrc/server/bot/default/scripting.qc +++ b/qcsrc/server/bot/default/scripting.qc @@ -1,5 +1,7 @@ #include "scripting.qh" +#include +#include #include "cvars.qh" #include @@ -485,7 +487,7 @@ float bot_cmd_cc(entity this) float bot_cmd_impulse(entity this) { - this.impulse = bot_cmd.bot_cmd_parm_float; + CS(this).impulse = bot_cmd.bot_cmd_parm_float; return CMD_STATUS_FINISHED; } @@ -539,16 +541,16 @@ float bot_cmd_barrier(entity this) if(this.bot_barrier == 1) // find other bots { - FOREACH_CLIENT(it.isbot, LAMBDA( + FOREACH_CLIENT(it.isbot, { if(it.bot_cmdqueuebuf_allocated) if(it.bot_barrier != 1) return CMD_STATUS_EXECUTING; // not all are at the barrier yet - )); + }); // all bots hit the barrier! // acknowledge barrier - FOREACH_CLIENT(it.isbot, LAMBDA(it.bot_barrier = 2)); + FOREACH_CLIENT(it.isbot, { it.bot_barrier = 2; }); bot_barriertime = time; } @@ -836,7 +838,7 @@ const int BOT_CMD_KEY_CHAT = BIT(10); bool bot_presskeys(entity this) { - this.movement = '0 0 0'; + CS(this).movement = '0 0 0'; PHYS_INPUT_BUTTON_JUMP(this) = false; PHYS_INPUT_BUTTON_CROUCH(this) = false; PHYS_INPUT_BUTTON_ATCK(this) = false; @@ -849,14 +851,14 @@ bool bot_presskeys(entity this) return false; if(this.bot_cmd_keys & BOT_CMD_KEY_FORWARD) - this.movement_x = autocvar_sv_maxspeed; + CS(this).movement_x = autocvar_sv_maxspeed; else if(this.bot_cmd_keys & BOT_CMD_KEY_BACKWARD) - this.movement_x = -autocvar_sv_maxspeed; + CS(this).movement_x = -autocvar_sv_maxspeed; if(this.bot_cmd_keys & BOT_CMD_KEY_RIGHT) - this.movement_y = autocvar_sv_maxspeed; + CS(this).movement_y = autocvar_sv_maxspeed; else if(this.bot_cmd_keys & BOT_CMD_KEY_LEFT) - this.movement_y = -autocvar_sv_maxspeed; + CS(this).movement_y = -autocvar_sv_maxspeed; if(this.bot_cmd_keys & BOT_CMD_KEY_JUMP) PHYS_INPUT_BUTTON_JUMP(this) = true; @@ -1008,7 +1010,7 @@ float bot_cmd_pause(entity this) PHYS_INPUT_BUTTON_ATCK2(this) = false; PHYS_INPUT_BUTTON_CROUCH(this) = false; - this.movement = '0 0 0'; + CS(this).movement = '0 0 0'; this.bot_cmd_keys = BOT_CMD_KEY_NONE; bot_clear(this); @@ -1156,7 +1158,7 @@ void bot_setcurrentcommand(entity this) void bot_resetqueues() { - FOREACH_CLIENT(it.isbot, LAMBDA( + FOREACH_CLIENT(it.isbot, { it.bot_cmd_execution_index = 0; bot_clearqueue(it); // also, cancel all barriers @@ -1167,7 +1169,7 @@ void bot_resetqueues() it.(bot_placenames[i]) = string_null; } it.bot_places_count = 0; - )); + }); bot_barriertime = time; } @@ -1182,7 +1184,7 @@ float bot_execute_commands_once(entity this) bot_setcurrentcommand(this); // Ignore all commands except continue when the bot is paused - if(!(self.bot_exec_status & BOT_EXEC_STATUS_PAUSED)) + if(!(this.bot_exec_status & BOT_EXEC_STATUS_PAUSED)) { // if we have no bot command, better return // old logic kept pressing previously pressed keys, but that has problems