Author: div0
Date: 2009-12-18 15:29:05 -0500 (Fri, 18 Dec 2009)
New Revision: 8407
Modified:
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/race.qc
trunk/data/qcsrc/server/race.qh
trunk/data/scripts/entities.def
Log:
race: change checkpoint use
now place-0 spawns of the start CP are only used for dying players who have reached finish. The last place CP is used instead for late comers.
Should break no existing map, but removes the restriction on place-0 placement.
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2009-12-18 14:34:20 UTC (rev 8406)
+++ trunk/data/qcsrc/server/cl_client.qc 2009-12-18 20:29:05 UTC (rev 8407)
@@ -166,6 +166,8 @@
pl = self.race_place;
if(pl > race_highest_place_spawn)
pl = 0;
+ if(pl == 0 && !self.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;
}
Modified: trunk/data/qcsrc/server/race.qc
===================================================================
--- trunk/data/qcsrc/server/race.qc 2009-12-18 14:34:20 UTC (rev 8406)
+++ trunk/data/qcsrc/server/race.qc 2009-12-18 20:29:05 UTC (rev 8407)
@@ -18,7 +18,6 @@
float race_highest_checkpoint;
float race_timed_checkpoint;
-float dfcp_cnt;
float defrag_ents;
float defragcpexists;
@@ -408,8 +407,11 @@
}
}
- if(other.race_checkpoint == -1 || other.race_checkpoint == self.race_checkpoint)
+ if((other.race_checkpoint == -1 && self.race_checkpoint == 0) || (other.race_checkpoint == self.race_checkpoint))
{
+ // once he has seen the start, he can spawn normally at place-0 spawns
+ other.race_started = 1;
+
if(self.race_penalty)
{
if(other.race_lastpenalty != self)
@@ -841,7 +843,10 @@
}
FOR_EACH_CLIENT(e)
+ {
race_ClearTime(e);
+ e.race_started = 0;
+ }
}
void race_ReadyRestart()
Modified: trunk/data/qcsrc/server/race.qh
===================================================================
--- trunk/data/qcsrc/server/race.qh 2009-12-18 14:34:20 UTC (rev 8406)
+++ trunk/data/qcsrc/server/race.qh 2009-12-18 20:29:05 UTC (rev 8407)
@@ -15,6 +15,7 @@
float race_leadlimit;
float race_timelimit;
.float race_place;
+.float race_started;
.float race_completed;
float race_completing;
void race_ImposePenaltyTime(entity pl, float penalty, string reason);
Modified: trunk/data/scripts/entities.def
===================================================================
--- trunk/data/scripts/entities.def 2009-12-18 14:34:20 UTC (rev 8406)
+++ trunk/data/scripts/entities.def 2009-12-18 20:29:05 UTC (rev 8407)
@@ -1257,12 +1257,12 @@
/*QUAKED info_player_race (1 0.5 0) (-16 -16 -24) (16 16 45)
Race spawn point.
-NOTE for race_place: when the race starts after the qualifying, the player with the fastest map ends up at the info_player_race with race_place 1, and so on. If there are too many players, or if someone comes in later, he will spawn at an info_player_race with race_place not set. So for each trigger_race_checkpoint, there must be at least one corresponding info_player_race with race_place NOT set.
+NOTE for race_place: when the race starts after the qualifying, the player with the fastest lap ends up at the info_player_race with race_place 1, and so on. If there are too many players, or if someone comes in later, he will spawn at an info_player_race with highest race_place. If someone dies after reaching the the starting checkpoint, he will spawn at race_place 0. So for each trigger_race_checkpoint, there must be at least one corresponding info_player_race with race_place NOT set.
-------- KEYS --------
target: this should point to a trigger_race_checkpoint to decide when this spawning point is active. The checkpoint has to be AFTER this spawn.
target2: trigger all entities with this targetname when someone spawns
cnt: weight of spawn point for random selection. Set to a lower value if you have many spawn points close together. Default value is 1.
-race_place: if target points to the trigger_race_checkpoint with cnt 0 (finish line), this sets which place the spawn corresponds to; the special value 0 stands for spawns for players who come in later (have to be behind the ones with race_place set to an actual place), and -1 marks the spawnpoint for qualifying mode only; any race map must have spawnpoints with race_place being 1, 2, 3 or it gets marked as a frustrating map
+race_place: if target points to the trigger_race_checkpoint with cnt 0 (finish line), this sets which place the spawn corresponds to; the special value 0 stands for spawns for players who died in game, and -1 marks the spawnpoint for qualifying mode only; any race map must have spawnpoints with race_place being 1, 2, 3 or it gets marked as a frustrating map
restriction: when 1, only bots can spawn here; when 2, only humans can spawn here (be careful with these, or the game will crash because someone cannot spawn)
*/