From: Mario Date: Sun, 9 Mar 2014 21:17:09 +0000 (+1100) Subject: Move bot roles into the mutator files X-Git-Tag: xonotic-v0.8.0~164^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0502f62a0407313392bafeed0e2c1043f17922c2;p=xonotic%2Fxonotic-data.pk3dir.git Move bot roles into the mutator files --- diff --git a/qcsrc/server/bot/havocbot/roles.qc b/qcsrc/server/bot/havocbot/roles.qc index 39d6b23b7..324aa30b0 100644 --- a/qcsrc/server/bot/havocbot/roles.qc +++ b/qcsrc/server/bot/havocbot/roles.qc @@ -221,40 +221,6 @@ void havocbot_role_dm() } } -//Race: -//go to next checkpoint, and annoy enemies -.float race_checkpoint; -void havocbot_role_race() -{ - if(self.deadflag != DEAD_NO) - return; - - entity e; - if (self.bot_strategytime < time) - { - self.bot_strategytime = time + autocvar_bot_ai_strategyinterval; - navigation_goalrating_start(); - /* - havocbot_goalrating_items(100, self.origin, 10000); - havocbot_goalrating_enemyplayers(500, self.origin, 20000); - */ - - for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; ) - { - if(e.cnt == self.race_checkpoint) - { - navigation_routerating(e, 1000000, 5000); - } - else if(self.race_checkpoint == -1) - { - navigation_routerating(e, 1000000, 5000); - } - } - - navigation_goalrating_end(); - } -} - void havocbot_chooserole_dm() { self.havocbot_role = havocbot_role_dm; diff --git a/qcsrc/server/mutators/gamemode_cts.qc b/qcsrc/server/mutators/gamemode_cts.qc index 33e656807..ab20b0b68 100644 --- a/qcsrc/server/mutators/gamemode_cts.qc +++ b/qcsrc/server/mutators/gamemode_cts.qc @@ -1,3 +1,32 @@ +// legacy bot roles +.float race_checkpoint; +void havocbot_role_cts() +{ + if(self.deadflag != DEAD_NO) + return; + + entity e; + if (self.bot_strategytime < time) + { + self.bot_strategytime = time + autocvar_bot_ai_strategyinterval; + navigation_goalrating_start(); + + for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; ) + { + if(e.cnt == self.race_checkpoint) + { + navigation_routerating(e, 1000000, 5000); + } + else if(self.race_checkpoint == -1) + { + navigation_routerating(e, 1000000, 5000); + } + } + + navigation_goalrating_end(); + } +} + void cts_ScoreRules() { ScoreRules_basics(0, 0, 0, FALSE); @@ -183,9 +212,9 @@ MUTATOR_HOOKFUNCTION(cts_PlayerDies) return FALSE; } -MUTATOR_HOOKFUNCTION(cts_HavocBot_ChooseRule) +MUTATOR_HOOKFUNCTION(cts_BotRoles) { - self.havocbot_role = havocbot_role_race; + self.havocbot_role = havocbot_role_cts; return TRUE; } @@ -251,7 +280,7 @@ MUTATOR_DEFINITION(gamemode_cts) MUTATOR_HOOK(PlayerSpawn, cts_PlayerSpawn, CBC_ORDER_ANY); MUTATOR_HOOK(PutClientInServer, cts_PutClientInServer, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerDies, cts_PlayerDies, CBC_ORDER_ANY); - MUTATOR_HOOK(HavocBot_ChooseRule, cts_HavocBot_ChooseRule, CBC_ORDER_ANY); + MUTATOR_HOOK(HavocBot_ChooseRule, cts_BotRoles, CBC_ORDER_ANY); MUTATOR_HOOK(GetPressedKeys, cts_PlayerPostThink, CBC_ORDER_ANY); MUTATOR_HOOK(ForbidThrowCurrentWeapon, cts_ForbidThrowing, CBC_ORDER_ANY); MUTATOR_HOOK(FilterItem, cts_FilterItem, CBC_ORDER_ANY); diff --git a/qcsrc/server/mutators/gamemode_race.qc b/qcsrc/server/mutators/gamemode_race.qc index e075a4e95..3bb705c07 100644 --- a/qcsrc/server/mutators/gamemode_race.qc +++ b/qcsrc/server/mutators/gamemode_race.qc @@ -1,3 +1,32 @@ +// legacy bot roles +.float race_checkpoint; +void havocbot_role_race() +{ + if(self.deadflag != DEAD_NO) + return; + + entity e; + if (self.bot_strategytime < time) + { + self.bot_strategytime = time + autocvar_bot_ai_strategyinterval; + navigation_goalrating_start(); + + for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; ) + { + if(e.cnt == self.race_checkpoint) + { + navigation_routerating(e, 1000000, 5000); + } + else if(self.race_checkpoint == -1) + { + navigation_routerating(e, 1000000, 5000); + } + } + + navigation_goalrating_end(); + } +} + void race_ScoreRules() { ScoreRules_basics(race_teams, 0, 0, FALSE); @@ -191,7 +220,7 @@ MUTATOR_HOOKFUNCTION(race_PlayerDies) return FALSE; } -MUTATOR_HOOKFUNCTION(race_HavocBot_ChooseRule) +MUTATOR_HOOKFUNCTION(race_BotRoles) { self.havocbot_role = havocbot_role_race; return TRUE; @@ -243,7 +272,7 @@ MUTATOR_DEFINITION(gamemode_race) MUTATOR_HOOK(PlayerSpawn, race_PlayerSpawn, CBC_ORDER_ANY); MUTATOR_HOOK(PutClientInServer, race_PutClientInServer, CBC_ORDER_ANY); MUTATOR_HOOK(PlayerDies, race_PlayerDies, CBC_ORDER_ANY); - MUTATOR_HOOK(HavocBot_ChooseRule, race_HavocBot_ChooseRule, CBC_ORDER_ANY); + MUTATOR_HOOK(HavocBot_ChooseRule, race_BotRoles, CBC_ORDER_ANY); MUTATOR_HOOK(GetPressedKeys, race_PlayerPostThink, CBC_ORDER_ANY); MUTATOR_HOOK(ForbidPlayerScore_Clear, race_ForbidClearPlayerScore, CBC_ORDER_ANY); MUTATOR_HOOK(GetTeamCount, race_GetTeamCount, CBC_ORDER_ANY);