X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Frace.qc;h=911106a30560358e6ae03054ab21526dc0e6ad8a;hb=55384b17f6ad8154f79eeeefa17a1be3f060304a;hp=80a379aa1f806090f170ceb4586d738cb19d06c9;hpb=d7a834f0cfbf327e001d53f09c7ddfe2e2783955;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 80a379aa1..911106a30 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -308,7 +308,7 @@ void race_SendTime(entity e, float cp, float t, float tvalid) race_setTime(GetMapname(), t, e.crypto_idfp, e.netname, e); if(g_cts && autocvar_g_cts_finish_kill_delay) { - CTS_ClientKill(autocvar_g_cts_finish_kill_delay); + CTS_ClientKill(e); } } if(t < recordtime || recordtime == 0) @@ -635,7 +635,7 @@ void trigger_race_checkpoint_verify() // race only (middle of the race) g_race_qualifying = 0; self.race_place = 0; - if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE)) + if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE)) error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for respawning in race) - bailing out")); if(i == 0) @@ -643,7 +643,7 @@ void trigger_race_checkpoint_verify() // qualifying only g_race_qualifying = 1; self.race_place = race_lowest_place_spawn; - if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE)) + if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE)) error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out")); // race only (initial spawn) @@ -651,7 +651,7 @@ void trigger_race_checkpoint_verify() for(p = 1; p <= race_highest_place_spawn; ++p) { self.race_place = p; - if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE)) + if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE)) error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for initially spawning in race) - bailing out")); } } @@ -663,7 +663,7 @@ void trigger_race_checkpoint_verify() self.race_checkpoint = race_NextCheckpoint(0); g_race_qualifying = 1; self.race_place = race_lowest_place_spawn; - if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), world, 0, FALSE, FALSE)) + if(!Spawn_FilterOutBadSpots(findchain(classname, "info_player_deathmatch"), 0, FALSE)) error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(self.race_place), " (used for qualifying) - bailing out")); } else @@ -742,11 +742,21 @@ void trigger_race_checkpoint_verify() for(trigger = world; (trigger = find(trigger, classname, "trigger_multiple")); ) for(targ = world; (targ = find(targ, targetname, trigger.target)); ) if (targ.classname == "target_checkpoint" || targ.classname == "target_startTimer" || targ.classname == "target_stopTimer") { - targ.wait = -2; + trigger.wait = 0; + trigger.delay = 0; + targ.wait = 0; targ.delay = 0; - setsize(targ, trigger.mins, trigger.maxs); - setorigin(targ, trigger.origin); + // These just make the game crash on some maps with oddly shaped triggers. + // (on the other hand they used to fix the case when two players ran through a checkpoint at once, + // and often one of them just passed through without being registered. Hope it's fixed in a better way now. + // (happened on item triggers too) + // + //targ.wait = -2; + //targ.delay = 0; + + //setsize(targ, trigger.mins, trigger.maxs); + //setorigin(targ, trigger.origin); //remove(trigger); } } @@ -754,6 +764,38 @@ void trigger_race_checkpoint_verify() self = oldself; } +vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current) +{ + if(g_race_qualifying) + { + // spawn at first + if(self.race_checkpoint != 0) + return '-1 0 0'; + if(spot.race_place != race_lowest_place_spawn) + return '-1 0 0'; + } + else + { + if(self.race_checkpoint != player.race_respawn_checkpoint) + return '-1 0 0'; + // try reusing the previous spawn + if(self == player.race_respawn_spotref || spot == player.race_respawn_spotref) + current_x += SPAWN_PRIO_RACE_PREVIOUS_SPAWN; + if(self.race_checkpoint == 0) + { + float pl; + pl = player.race_place; + if(pl > race_highest_place_spawn) + pl = 0; + if(pl == 0 && !player.race_started) + pl = race_highest_place_spawn; // use last place if he has not even touched finish yet + if(spot.race_place != pl) + return '-1 0 0'; + } + } + return current; +} + void spawnfunc_trigger_race_checkpoint() { vector o; @@ -795,12 +837,13 @@ void spawnfunc_trigger_race_checkpoint() if(!self.race_penalty) { if(self.race_checkpoint) - WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite); + WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite, RADARICON_NONE, '1 0.5 0'); else - WaypointSprite_SpawnFixed("race-finish", o, self, sprite); + WaypointSprite_SpawnFixed("race-start-finish", o, self, sprite, RADARICON_NONE, '1 0.5 0'); } self.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player; + self.spawn_evalfunc = trigger_race_checkpoint_spawn_evalfunc; InitializeEntity(self, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET); } @@ -841,9 +884,9 @@ void spawnfunc_target_checkpoint() // defrag entity race_timed_checkpoint = 1; if(self.race_checkpoint == 0) - WaypointSprite_SpawnFixed("race-start", o, self, sprite); + WaypointSprite_SpawnFixed("race-start", o, self, sprite, RADARICON_NONE, '1 0.5 0'); else - WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite); + WaypointSprite_SpawnFixed("race-checkpoint", o, self, sprite, RADARICON_NONE, '1 0.5 0'); self.sprite.waypointsprite_visible_for_player = race_waypointsprite_visible_for_player;