]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Abuse the new hidden option to make a kind of 'practice' mode for CTS
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index 9f763a886d73217cd4490aa05fba9f75a2add448..dd1e395c722156026e00d9047a1617eee54b283b 100644 (file)
@@ -164,7 +164,7 @@ float CheatImpulse(entity this, int imp)
                        this.personal.strength_finished = this.strength_finished;
                        this.personal.invincible_finished = this.invincible_finished;
                        this.personal.teleport_time = time;
-                       break; // this part itthis doesn't cheat, so let's not count this
+                       break; // this part itself doesn't cheat, so let's not count this
                case CHIMPULSE_CLONE_MOVING.impulse:
                        IS_CHEAT(this, imp, 0, 0);
                        makevectors (this.v_angle);
@@ -185,7 +185,8 @@ float CheatImpulse(entity this, int imp)
                        CheatCommand(this, tokenize_console("give all"));
                        break; // already counted as cheat
                case CHIMPULSE_SPEEDRUN.impulse:
-                       IS_CHEAT(this, imp, 0, 0);
+                       if(!autocvar_g_allow_checkpoints)
+                               IS_CHEAT(this, imp, 0, 0);
                        if(this.personal)
                        {
                                this.speedrunning = true;
@@ -222,7 +223,8 @@ float CheatImpulse(entity this, int imp)
                                this.strength_finished = time + this.personal.strength_finished - this.personal.teleport_time;
                                this.invincible_finished = time + this.personal.invincible_finished - this.personal.teleport_time;
 
-                               DID_CHEAT();
+                               if(!autocvar_g_allow_checkpoints)
+                                       DID_CHEAT();
                                break;
                        }
                        if(IS_DEAD(this))
@@ -262,7 +264,7 @@ float CheatImpulse(entity this, int imp)
                case CHIMPULSE_R00T.impulse:
                        IS_CHEAT(this, imp, 0, 0);
                        RandomSelection_Init();
-                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_Add(it, 0, string_null, 1, 1)));
+                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, this), LAMBDA(RandomSelection_AddEnt(it, 1, 1)));
                        if(RandomSelection_chosen_ent)
                                e = RandomSelection_chosen_ent;
                        else
@@ -324,7 +326,7 @@ float CheatCommand(entity this, int argc)
                                //   effectname
                                effectnum = _particleeffectnum(argv(1));
                                W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0);
-                               traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, this);
+                               traceline(w_shotorg, w_shotorg + w_shotdir * max_shot_distance, MOVE_NORMAL, this);
                                __trailparticles(this, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
                                break;
@@ -444,7 +446,7 @@ float CheatCommand(entity this, int argc)
                        e.nextthink = time;
                        e.solid = 0; // nothing special
                        setmodel(e, MDL_MARKER);
-                       setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
+                       setsize(e, STAT(PL_MIN, this), STAT(PL_MAX, this));
                        e.skin = 2;
                        if(argc == 3)
                                e.cnt = stof(argv(1));
@@ -475,9 +477,9 @@ float CheatCommand(entity this, int argc)
                        RandomSelection_Init();
                        crosshair_trace(this);
                        for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
-                               RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
+                               RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
                        for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
-                               RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
+                               RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
                        if(RandomSelection_chosen_ent)
                        {
                                delete(RandomSelection_chosen_ent.killindicator.killindicator);
@@ -497,9 +499,9 @@ float CheatCommand(entity this, int argc)
                                RandomSelection_Init();
                                crosshair_trace(this);
                                for(entity e = NULL; (e = find(e, classname, "dragbox_box")); )
-                                       RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
+                                       RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
                                for(entity e = NULL; (e = find(e, classname, "dragpoint")); )
-                                       RandomSelection_Add(e, 0, string_null, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
+                                       RandomSelection_AddEnt(e, 1, 1 / vlen(e.origin + (e.mins + e.maxs) * 0.5 - trace_endpos));
                                if(RandomSelection_chosen_ent)
                                {
                                        if(substring(argv(1), 0, 1) == "*")