X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fmutators%2Fmutator%2Fgamemode_race.qc;h=e4109b72a8523e84bd913951409a50339866ed50;hp=84ca96fae3355b0e412054cf5651f3776fca1a99;hb=3cfa3eaf6856fe76f7fd8c945fbfab2e9e28014c;hpb=4faf95050c3c1a7a6963ff7fa768d6c87b3e7bc6 diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index 84ca96fae..e4109b72a 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -14,24 +14,34 @@ void havocbot_role_race(entity this) if(IS_DEAD(this)) return; - if (this.bot_strategytime < time) + if (navigation_goalrating_timeout(this)) { - this.bot_strategytime = time + autocvar_bot_ai_strategyinterval; navigation_goalrating_start(this); + bool raw_touch_check = true; + int cp = this.race_checkpoint; + + LABEL(search_racecheckpoints) IL_EACH(g_racecheckpoints, true, { - if(it.cnt == this.race_checkpoint) - { - navigation_routerating(this, it, 1000000, 5000); - } - else if(this.race_checkpoint == -1) + if(it.cnt == cp || cp == -1) { + // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint + // e.g. checkpoint in front of Stormkeep's warpzone + // the same workaround is applied in CTS game mode + if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30)) + { + cp = race_NextCheckpoint(cp); + raw_touch_check = false; + goto search_racecheckpoints; + } navigation_routerating(this, it, 1000000, 5000); } }); navigation_goalrating_end(this); + + navigation_goalrating_timeout_set(this); } } @@ -197,7 +207,7 @@ MUTATOR_HOOKFUNCTION(rc, reset_map_global) FOREACH_CLIENT(true, { if(it.race_place) { - s = PlayerScore_Add(it, SP_RACE_FASTEST, 0); + s = GameRules_scoring_add(it, RACE_FASTEST, 0); if(!s) it.race_place = 0; } @@ -247,7 +257,7 @@ MUTATOR_HOOKFUNCTION(rc, MakePlayerObserver) entity player = M_ARGV(0, entity); if(g_race_qualifying) - if(PlayerScore_Add(player, SP_RACE_FASTEST, 0)) + if(GameRules_scoring_add(player, RACE_FASTEST, 0)) player.frags = FRAGS_LMS_LOSER; else player.frags = FRAGS_SPECTATOR; @@ -315,8 +325,7 @@ MUTATOR_HOOKFUNCTION(rc, GetPressedKeys) if(player.stored_netname != player.netname) { db_put(ServerProgsDB, strcat("/uid2name/", player.crypto_idfp), player.netname); - strunzone(player.stored_netname); - player.stored_netname = strzone(player.netname); + strcpy(player.stored_netname, player.netname); } } @@ -440,16 +449,7 @@ void rc_SetLimits() if(autocvar_g_race_teams) { GameRules_teams(true); - race_teams = bound(2, autocvar_g_race_teams, 4); - int teams = 0; - if(race_teams >= 1) teams |= BIT(0); - if(race_teams >= 2) teams |= BIT(1); - if(race_teams >= 3) teams |= BIT(2); - if(race_teams >= 4) teams |= BIT(3); - - race_teams = teams; // now set it? - - have_team_spawns = -1; // request team spawns + race_teams = BITS(bound(2, autocvar_g_race_teams, 4)); } else race_teams = 0;