#include "race.qh"
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include "client.qh"
-#include "portals.qh"
-#include "scores.qh"
-#include "spawnpoints.qh"
-#include "bot/api.qh"
-#include "command/getreplies.qh"
-#include "../common/deathtypes/all.qh"
-#include "../common/notifications/all.qh"
-#include "../common/mapinfo.qh"
+#include <common/deathtypes/all.qh>
+#include <common/gamemodes/_mod.qh>
#include <common/gamemodes/rules.qh>
+#include <common/mapobjects/subs.qh>
+#include <common/mapobjects/triggers.qh>
+#include <common/mutators/mutator/waypoints/waypointsprites.qh>
#include <common/net_linked.qh>
+#include <common/notifications/all.qh>
#include <common/state.qh>
-#include <common/weapons/weapon/porto.qh>
-#include "../common/mapobjects/subs.qh"
-#include <common/mapobjects/triggers.qh>
-#include "../lib/warpzone/util_server.qh"
-#include "../lib/warpzone/common.qh"
+#include <common/stats.qh>
#include <common/vehicles/sv_vehicles.qh>
-#include "../common/mutators/mutator/waypoints/waypointsprites.qh"
+#include <common/weapons/_all.qh>
+#include <common/weapons/weapon/porto.qh>
+#include <lib/warpzone/common.qh>
+#include <lib/warpzone/util_server.qh>
+#include <server/bot/api.qh>
+#include <server/cheats.qh>
+#include <server/client.qh>
+#include <server/command/getreplies.qh>
+#include <server/damage.qh>
+#include <server/gamelog.qh>
+#include <server/intermission.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
+#include <server/portals.qh>
+#include <server/scores.qh>
+#include <server/spawnpoints.qh>
+#include <server/weapons/common.qh>
+#include <server/world.qh>
+
+string uid2name(string myuid)
+{
+ string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
+
+ // FIXME remove this later after 0.6 release
+ // convert old style broken records to correct style
+ if(s == "")
+ {
+ s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+ if(s != "")
+ {
+ db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
+ db_remove(ServerProgsDB, strcat("uid2name", myuid));
+ }
+ }
+
+ if(s == "")
+ s = "^1Unregistered Player";
+ return s;
+}
+
+void write_recordmarker(entity pl, float tstart, float dt)
+{
+ GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
+
+ // also write a marker into demo files for demotc-race-record-extractor to find
+ stuffcmd(pl,
+ strcat(
+ strcat("//", strconv(2, 0, 0, GetGametype()), " RECORD SET ", TIME_ENCODED_TOSTRING(TIME_ENCODE(dt))),
+ " ", ftos(tstart), " ", ftos(dt), "\n"));
+}
IntrusiveList g_race_targets;
IntrusiveList g_racecheckpoints;
void race_SendTime(entity e, float cp, float t, float tvalid)
{
- float snew, l;
-
if(g_race_qualifying)
t += e.race_penalty_accumulator;
GameRules_scoring_add(e, RACE_FASTEST, t - s);
s = GameRules_scoring_add(e, RACE_TIME, 0);
- snew = TIME_ENCODE(time - game_starttime);
+ float snew = TIME_ENCODE(time - game_starttime);
GameRules_scoring_add(e, RACE_TIME, snew - s);
- l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
+ float l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
if(autocvar_fraglimit)
if(l >= autocvar_fraglimit)
// race only (middle of the race)
g_race_qualifying = false;
pl_race_place = 0;
- if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false)) {
+ if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false, true)) {
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for respawning in race) - bailing out"));
}
// qualifying only
g_race_qualifying = 1;
pl_race_place = race_lowest_place_spawn;
- if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false)) {
+ if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false, true)) {
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
}
g_race_qualifying = 0;
for (int p = 1; p <= race_highest_place_spawn; ++p) {
pl_race_place = p;
- if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false)) {
+ if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false, true)) {
error(strcat("Checkpoint ", ftos(i), " misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for initially spawning in race) - bailing out"));
}
}
pl_race_checkpoint = race_NextCheckpoint(0);
g_race_qualifying = 1;
pl_race_place = race_lowest_place_spawn;
- if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false)) {
+ if (!Spawn_FilterOutBadSpots(this, findchain(classname, "info_player_deathmatch"), 0, false, true)) {
error(strcat("Checkpoint 0 misses a spawnpoint with race_place==", ftos(pl_race_place), " (used for qualifying) - bailing out"));
}
} else {
InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
}
-spawnfunc(target_checkpoint) // defrag entity
+void target_checkpoint_setup(entity this)
{
if(!g_race && !g_cts) { delete(this); return; }
defrag_ents = 1;
InitializeEntity(this, trigger_race_checkpoint_verify, INITPRIO_FINDTARGET);
}
-spawnfunc(target_startTimer) { spawnfunc_target_checkpoint(this); }
-spawnfunc(target_stopTimer) { spawnfunc_target_checkpoint(this); }
+spawnfunc(target_checkpoint)
+{
+ // xonotic defrag entity
+ target_checkpoint_setup(this);
+}
+
+// compatibility entity names
+spawnfunc(target_startTimer) { target_checkpoint_setup(this); }
+spawnfunc(target_stopTimer) { target_checkpoint_setup(this); }
void race_AbandonRaceCheck(entity p)
{