]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Abuse the new hidden option to make a kind of 'practice' mode for CTS
authorMario <mario@smbclan.net>
Mon, 13 Feb 2017 08:36:27 +0000 (18:36 +1000)
committerMario <mario@smbclan.net>
Mon, 13 Feb 2017 08:36:27 +0000 (18:36 +1000)
qcsrc/server/autocvars.qh
qcsrc/server/cheats.qc
qcsrc/server/impulse.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc
qcsrc/server/mutators/mutator/gamemode_race.qc
qcsrc/server/race.qc

index 975a95b29906e42c2b87032a3ad558048a4c900b..bc1ac534b0b72c021239913a9c398d1c4d40a4d5 100644 (file)
@@ -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;
index 31823f406f220166abbd816a72e6218e44993094..dd1e395c722156026e00d9047a1617eee54b283b 100644 (file)
@@ -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();
index 57aaf4a2b51ae1208470cc4bdf3a3deeca573624..e072e9642af4db95eb73cd152b27e87da8d1f664 100644 (file)
@@ -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");
 }
index 903ecf5958e5032997df888d0f28c1457755c53b..daec722f4f62e1dd9eab1871bd5fa8459300029b 100644 (file)
@@ -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);
index 3e93c1ed0dea7d8bcbab23938eb69f6020f7332a..2945aff6e83c3da20a745f2b7fe74d23e3dd2aa5 100644 (file)
@@ -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);
index a70cc882536908117bdc2af99d6b7aed95c45a7a..d171dc6e03b4ef25780addc3b543e087da3405ed 100644 (file)
@@ -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;