]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Typecheck weaponframe
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index cb1387a9c2ef5e15917f6703bfe96989eeeda497..7dab5ade00d9ade8b4fc8cd717fca0a531c85c47 100644 (file)
@@ -12,6 +12,8 @@
 #include "../common/deathtypes/all.qh"
 #include "../common/util.qh"
 
+#include <common/physics/player.qh>
+
 #include "../common/monsters/all.qh"
 
 #include "../common/weapons/all.qh"
@@ -25,7 +27,7 @@
 #include "../lib/warpzone/anglestransform.qh"
 #include "../lib/warpzone/util_server.qh"
 
-void CopyBody(float keepvelocity);
+void CopyBody(entity this, float keepvelocity);
 
 #ifdef NOCHEATS
 
@@ -34,7 +36,6 @@ float CheatCommand(float argc) { return 0; }
 float CheatFrame() { return 0; }
 void CheatInit() { cheatcount_total = world.cheatcount; }
 void CheatShutdown() { }
-void CheatShutdownClient() { }
 void Drag_MoveDrag(entity from, entity to) { }
 
 #else
@@ -53,14 +54,10 @@ void CheatShutdown()
 {
 }
 
-void CheatShutdownClient()
-{
-}
-
 float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking
 {SELFPARAM();
        // dead people cannot cheat
-       if(self.deadflag != DEAD_NO)
+       if(IS_DEAD(self))
                return 0;
        if(gamestart_sv_cheats < 2 && !IS_PLAYER(self))
                return 0;
@@ -172,14 +169,14 @@ float CheatImpulse(int imp)
                        IS_CHEAT(imp, 0, 0);
                        makevectors (self.v_angle);
                        self.velocity = self.velocity + v_forward * 300;
-                       CopyBody(1);
+                       CopyBody(self, 1);
                        self.lip += 1;
                        self.velocity = self.velocity - v_forward * 300;
                        DID_CHEAT();
                        break;
                case CHIMPULSE_CLONE_STANDING.impulse:
                        IS_CHEAT(imp, 0, 0);
-                       CopyBody(0);
+                       CopyBody(self, 0);
                        self.lip += 1;
                        DID_CHEAT();
                        break;
@@ -228,7 +225,7 @@ float CheatImpulse(int imp)
                                DID_CHEAT();
                                break;
                        }
-                       if(self.deadflag != DEAD_NO)
+                       if(IS_DEAD(self))
                                sprint(self, "UR DEAD AHAHAH))\n");
                        else
                                sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
@@ -265,7 +262,7 @@ float CheatImpulse(int imp)
                case CHIMPULSE_R00T.impulse:
                        IS_CHEAT(imp, 0, 0);
                        RandomSelection_Init();
-                       FOREACH_CLIENT(IS_PLAYER(it) && it.deadflag == DEAD_NO && DIFF_TEAM(it, self), LAMBDA(RandomSelection_Add(it, 0, string_null, 1, 1)));
+                       FOREACH_CLIENT(IS_PLAYER(it) && !IS_DEAD(it) && DIFF_TEAM(it, self), LAMBDA(RandomSelection_Add(it, 0, string_null, 1, 1)));
                        if(RandomSelection_chosen_ent)
                                e = RandomSelection_chosen_ent;
                        else
@@ -327,7 +324,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   effectname
                                effectnum = _particleeffectnum(argv(1));
-                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, MOVE_NORMAL, self);
                                __trailparticles(self, effectnum, w_shotorg, trace_endpos);
                                DID_CHEAT();
@@ -342,7 +339,7 @@ float CheatCommand(float argc)
                                // arguments:
                                //   modelname mode
                                f = stof(argv(2));
-                               W_SetupShot(self, false, false, "", CH_WEAPON_A, 0);
+                               W_SetupShot(self, false, false, SND_Null, CH_WEAPON_A, 0);
                                traceline(w_shotorg, w_shotorg + w_shotdir * 2048, MOVE_NORMAL, self);
                                if((trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT) || trace_fraction == 1)
                                {
@@ -448,7 +445,7 @@ float CheatCommand(float argc)
                        e.nextthink = time;
                        e.solid = 0; // nothing special
                        setmodel(e, MDL_MARKER);
-                       setsize(e, PL_MIN, PL_MAX);
+                       setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
                        e.skin = 2;
                        if(argc == 3)
                                e.cnt = stof(argv(1));
@@ -784,7 +781,7 @@ float Drag(float force_allow_pick, float ischeat)
                default:
                        if(Drag_IsDragging(self))
                        {
-                               if(self.BUTTON_DRAG)
+                               if(PHYS_INPUT_BUTTON_DRAG(self))
                                {
                                        if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
                                        {
@@ -816,7 +813,7 @@ float Drag(float force_allow_pick, float ischeat)
                        else
                        {
                                if(Drag_CanDrag(self))
-                                       if(self.BUTTON_DRAG)
+                                       if(PHYS_INPUT_BUTTON_DRAG(self))
                                        {
                                                crosshair_trace_plusvisibletriggers(self);
                                                entity e = trace_ent;
@@ -1018,7 +1015,7 @@ void Drag_Update(entity dragger)
 
 float Drag_CanDrag(entity dragger)
 {
-       return (dragger.deadflag == DEAD_NO) || (IS_PLAYER(dragger));
+       return (!IS_DEAD(dragger)) || (IS_PLAYER(dragger));
 }
 
 float Drag_IsDragging(entity dragger)