From: MirceaKitsune Date: Sat, 9 Jul 2011 14:38:37 +0000 (+0300) Subject: Tweak bot AI and make bots able to play with the slow swallowing feature X-Git-Url: http://de.git.xonotic.org/?p=voretournament%2Fvoretournament.git;a=commitdiff_plain;h=6552595e31042c73a6b75bd6cd578f3ef72b1288;ds=sidebyside Tweak bot AI and make bots able to play with the slow swallowing feature --- diff --git a/data/qcsrc/server/bot/havocbot/vore_ai.qc b/data/qcsrc/server/bot/havocbot/vore_ai.qc index 30610755..8f413aff 100644 --- a/data/qcsrc/server/bot/havocbot/vore_ai.qc +++ b/data/qcsrc/server/bot/havocbot/vore_ai.qc @@ -1,4 +1,5 @@ .float status_teamhealing; // 0 = can't team heal, 1 = can team heal, 2 = team healing right now +.float hold_BUTTON_ATCK; // marks the bot holding the fire button after having decided on his prey float Swallow_condition_check_bot(entity prey) { @@ -73,12 +74,16 @@ void Vore_AI_Teamheal(entity prey) if not(prey.digesting) // if our team mate is digesting someone, he likely wouldn't want us ruining his frag if not(prey.flagcarried) // don't eat the flag carrier and ruin his job if not(prey.BUTTON_ATCK || prey.BUTTON_ATCK2) // our team mate wouldn't want us eating him while he's firing - if(time > self.decide_swallow) { - if(skill >= random() * 10) // there are 10 bot skill steps - self.BUTTON_ATCK = TRUE; // swallow the team mate - self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly + if(time > self.decide_swallow) + { + if(skill >= random() * 10) // there are 10 bot skill steps + self.hold_BUTTON_ATCK = TRUE; // swallow the team mate + self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly + } } + else + self.hold_BUTTON_ATCK = FALSE; } void Vore_AI() @@ -131,18 +136,26 @@ void Vore_AI() fear += self.stomach_load; // the bigger our stomach, the less we want to put someone else in there decide_pred_time = cvar("bot_ai_vore_decide_pred") / skill / self.bot_vorethinkpred; - if(time > self.decide_swallow) if(Swallow_condition_check_bot(prey)) { - // the greater the skill, the higher the chance bots will swallow someone each attempt - if(skill / fear >= randomtry) - if not(teams_matter && prey.team == self.team) + if(time > self.decide_swallow) { - self.BUTTON_ATCK = TRUE; // swallow - self.decide_pred = time + decide_pred_time; // time before the bot decides what to do with his prey + // the greater the skill, the higher the chance bots will swallow someone each attempt + if(skill / fear >= randomtry) + if not(teams_matter && prey.team == self.team) + { + self.hold_BUTTON_ATCK = TRUE; // swallow + self.decide_pred = time + decide_pred_time; // time before the bot decides what to do with his prey + } + self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly } - self.decide_swallow = time + cvar("bot_ai_vore_decide_swallow") / self.bot_vorethinkpred; // this is needed to take a proper decision, otherwise the code would execute each frame and return TRUE quickly } + else + self.hold_BUTTON_ATCK = FALSE; + + // if the bot is holding the firing button, apply that to the actual fire key + if(self.hold_BUTTON_ATCK) + self.BUTTON_ATCK = TRUE; // deciding what to do with a victim: