From: Mario Date: Mon, 13 Feb 2017 08:36:27 +0000 (+1000) Subject: Abuse the new hidden option to make a kind of 'practice' mode for CTS X-Git-Tag: xonotic-v0.8.2~214 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fac33f7b7273746b671ea4cb999cf611bda163e6;p=xonotic%2Fxonotic-data.pk3dir.git Abuse the new hidden option to make a kind of 'practice' mode for CTS --- diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 975a95b29..bc1ac534b 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -523,3 +523,4 @@ float autocvar_sv_airstopaccelerate; float autocvar_sv_track_canjump; bool autocvar_sv_showspectators; bool autocvar_g_weaponswitch_debug; +bool autocvar_g_allow_checkpoints; diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 31823f406..dd1e395c7 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -131,7 +131,6 @@ spawnfunc(info_autoscreenshot) // this one just has to exist } -bool autocvar_g_allow_checkpoints; float CheatImpulse(entity this, int imp) { BEGIN_CHEAT_FUNCTION(); diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index 57aaf4a2b..e072e9642 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -551,6 +551,9 @@ IMPULSE(waypoint_clear_personal) { delete(this.personal); this.personal = NULL; + + if((g_cts || g_race) && autocvar_g_allow_checkpoints) + ClientKill(this); } sprint(this, "personal waypoint cleared\n"); } diff --git a/qcsrc/server/mutators/mutator/gamemode_cts.qc b/qcsrc/server/mutators/mutator/gamemode_cts.qc index 903ecf595..daec722f4 100644 --- a/qcsrc/server/mutators/mutator/gamemode_cts.qc +++ b/qcsrc/server/mutators/mutator/gamemode_cts.qc @@ -194,6 +194,14 @@ MUTATOR_HOOKFUNCTION(cts, ClientConnect) } } +MUTATOR_HOOKFUNCTION(cts, AbortSpeedrun) +{ + entity player = M_ARGV(0, entity); + + if(autocvar_g_allow_checkpoints) + race_PreparePlayer(player); // nice try +} + MUTATOR_HOOKFUNCTION(cts, MakePlayerObserver) { entity player = M_ARGV(0, entity); diff --git a/qcsrc/server/mutators/mutator/gamemode_race.qc b/qcsrc/server/mutators/mutator/gamemode_race.qc index 3e93c1ed0..2945aff6e 100644 --- a/qcsrc/server/mutators/mutator/gamemode_race.qc +++ b/qcsrc/server/mutators/mutator/gamemode_race.qc @@ -102,6 +102,14 @@ float WinningCondition_QualifyingThenRace(float limit) return wc; } +MUTATOR_HOOKFUNCTION(rc, AbortSpeedrun) +{ + entity player = M_ARGV(0, entity); + + if(autocvar_g_allow_checkpoints) + race_PreparePlayer(player); // nice try +} + MUTATOR_HOOKFUNCTION(rc, PlayerPhysics) { entity player = M_ARGV(0, entity); diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index a70cc8825..d171dc6e0 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -571,6 +571,9 @@ void dumpsurface(entity e) void checkpoint_passed(entity this, entity player) { + if(player.personal && autocvar_g_allow_checkpoints) + return; // practice mode! + string oldmsg; entity cp;