]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Merge branch 'post-0.8.2' into 'develop'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index eda0838fd24e61d6a9a34078a936edefba74f15f..20a13f83e6cef5121b0c220a416fd8b756aab470 100644 (file)
@@ -1,39 +1,32 @@
 #include "cheats.qh"
 
-#include <server/defs.qh>
-#include <server/miscfunctions.qh>
-#include <common/effects/all.qh>
-#include <server/resources.qh>
-
-#include "g_damage.qh"
-#include "clientkill.qh"
-#include "player.qh"
-#include "race.qh"
-#include "../common/mapobjects/teleporters.qh"
-
-#include <server/mutators/_mod.qh>
-
 #include "weapons/tracing.qh"
-
-#include "../common/constants.qh"
-#include "../common/deathtypes/all.qh"
-#include "../common/util.qh"
-
+#include <common/constants.qh>
+#include <common/deathtypes/all.qh>
+#include <common/effects/all.qh>
+#include <common/items/_mod.qh>
+#include <common/mapobjects/func/breakable.qh>
+#include <common/mapobjects/subs.qh>
+#include <common/mapobjects/teleporters.qh>
+#include <common/mapobjects/triggers.qh>
+#include <common/monsters/_mod.qh>
 #include <common/physics/player.qh>
-
-#include "../common/monsters/_mod.qh"
-
+#include <common/stats.qh>
+#include <common/util.qh>
 #include <common/weapons/_all.qh>
-
-#include "../common/mapobjects/subs.qh"
-#include <common/mapobjects/triggers.qh>
-
-#include "../common/mapobjects/func/breakable.qh"
-
-#include "../lib/csqcmodel/sv_model.qh"
-
-#include "../lib/warpzone/anglestransform.qh"
-#include "../lib/warpzone/util_server.qh"
+#include <common/weapons/_all.qh>
+#include <lib/csqcmodel/sv_model.qh>
+#include <lib/warpzone/anglestransform.qh>
+#include <lib/warpzone/common.qh>
+#include <lib/warpzone/util_server.qh>
+#include <server/clientkill.qh>
+#include <server/damage.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
+#include <server/player.qh>
+#include <server/race.qh>
+#include <server/resources.qh>
+#include <server/world.qh>
 
 #ifdef NOCHEATS
 
@@ -68,7 +61,7 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets
                return 0;
 
        if(i == CHIMPULSE_CLONE_MOVING.impulse || i == CHIMPULSE_CLONE_STANDING.impulse)
-               if(this.lip < sv_clones)
+               if(this.lip < autocvar_sv_clones)
                        return 1;
 
        // haha
@@ -80,13 +73,13 @@ float CheatsAllowed(entity this, float i, int argc, float fr) // the cheat gets
 
        // if we get here, player is not allowed to cheat. Log it.
        if(i)
-               bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this, false), i);
+               bprintf("Player %s^7 tried to use cheat 'impulse %d'\n", playername(this.netname, this.team, false), i);
        else if(argc)
-               bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this, false), argv(0));
+               bprintf("Player %s^7 tried to use cheat '%s'\n", playername(this.netname, this.team, false), argv(0));
        else if(fr)
-               bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this, false), fr);
+               bprintf("Player %s^7 tried to use cheat frame %d\n", playername(this.netname, this.team, false), fr);
        else
-               bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this, false));
+               bprintf("Player %s^7 tried to use an unknown cheat\n", playername(this.netname, this.team, false));
 
        return 0;
 }
@@ -307,11 +300,6 @@ float CheatCommand(entity this, int argc)
                        IS_CHEAT(this, 0, argc, 0);
                        if(argc == 5)
                        {
-                               // arguments:
-                               //   effectname
-                               //   origin (0..1, on crosshair line)
-                               //   velocity
-                               //   howmany
                                f = stof(argv(2));
                                crosshair_trace(this);
                                start = (1-f) * this.origin + f * trace_endpos;
@@ -321,7 +309,9 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd pointparticles effectname position(0..1) velocityvector multiplier\n");
+                       sprint(this, "Usage:^3 sv_cheats 1; restart; cmd pointparticles <effectname> <position> <velocity> <countmultiplier>\n");
+                       sprint(this, "  Where <position> is a number from 0 to 1 representing distance on the crosshair line,\n");
+                       sprint(this, "  and <velocity> is a vector \"x y z\"\n");
                        break;
                case "trailparticles":
                        IS_CHEAT(this, 0, argc, 0);
@@ -336,14 +326,12 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd trailparticles effectname\n");
+                       sprint(this, "Usage: sv_cheats 1; restart; cmd trailparticles <effectname>\n");
                        break;
                case "make":
                        IS_CHEAT(this, 0, argc, 0);
                        if(argc == 3)
                        {
-                               // arguments:
-                               //   modelname mode
                                f = stof(argv(2));
                                W_SetupShot(this, weaponentities[0], false, false, SND_Null, CH_WEAPON_A, 0, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, this);
@@ -353,7 +341,7 @@ float CheatCommand(entity this, int argc)
                                }
                                else
                                {
-                                       entity e = spawn();
+                                       entity e = new(func_breakable);
                                        e.model = strzone(argv(1));
                                        e.mdl = "rocket_explode";
                                        SetResourceExplicit(e, RES_HEALTH, 1000);
@@ -364,7 +352,7 @@ float CheatCommand(entity this, int argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       spawnfunc_func_breakable(e);
+                                       func_breakable_setup(e);
                                        // now, is it valid?
                                        if(f == 0)
                                        {
@@ -382,7 +370,10 @@ float CheatCommand(entity this, int argc)
                                }
                        }
                        else
-                               sprint(this, "Usage: sv_cheats 1; restart; cmd make models/... 0/1/2\n");
+                       {
+                               sprint(this, "Usage:^3 sv_cheats 1; restart; cmd make <modelname> <mode>\n");
+                               sprint(this, "  where <mode> can be 0, 1 or 2\n");
+                       }
                        break;
                case "penalty":
                        IS_CHEAT(this, 0, argc, 0);
@@ -392,7 +383,7 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd penalty 5.0 AHAHAHAHAHAHAH))\n");
+                       sprint(this, "Usage:^3 sv_cheats 1; restart; cmd penalty <duration> <reason>))\n");
                        break;
                case "dragbox_spawn": {
                        IS_CHEAT(this, 0, argc, 0);
@@ -517,7 +508,7 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_setcnt cnt\n");
+                       sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_setcnt <cnt>\n");
                        break;
                case "drag_save":
                        IS_CHEAT(this, 0, argc, 0);
@@ -537,7 +528,7 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n");
+                       sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save <filename>\n");
                        break;
                case "drag_saveraceent":
                        IS_CHEAT(this, 0, argc, 0);
@@ -606,7 +597,7 @@ float CheatCommand(entity this, int argc)
                                DID_CHEAT();
                                break;
                        }
-                       sprint(this, "Usage: sv_cheats 1; restart; cmd dragbox_save filename\n");
+                       sprint(this, "Usage:^3 sv_cheats 1; restart; cmd dragbox_save <filename>\n");
                        break;
                case "drag_clear":
                        IS_CHEAT(this, 0, argc, 0);