]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Add player argument to FixPlayermodel
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index 55440ca8c0be2615903fcc7039a96dad8d32bd1f..7dda060119dba09c91ab53fd6a0d23e8ad4f10a9 100644 (file)
@@ -33,7 +33,7 @@ void CopyBody(entity this, float keepvelocity);
 
 float CheatImpulse(entity this, int imp) { return 0; }
 float CheatCommand(entity this, int argc) { return 0; }
-float CheatFrame() { return 0; }
+float CheatFrame(entity this) { return 0; }
 void CheatInit() { cheatcount_total = world.cheatcount; }
 void CheatShutdown() { }
 void Drag_MoveDrag(entity from, entity to) { }
@@ -284,7 +284,7 @@ float CheatImpulse(entity this, int imp)
        END_CHEAT_FUNCTION();
 }
 
-void DragBox_Think();
+void DragBox_Think(entity this);
 float drag_lastcnt;
 float CheatCommand(entity this, int argc)
 {
@@ -295,7 +295,6 @@ float CheatCommand(entity this, int argc)
        {
                float effectnum, f;
                vector start, end;
-               entity oldself;
 
                case "pointparticles":
                        IS_CHEAT(this, 0, argc, 0);
@@ -552,11 +551,11 @@ float CheatCommand(entity this, int argc)
                                {
                                        start = '0 0 0';
                                        effectnum = 0;
-                                       for(oldself = world; (oldself = find(oldself, classname, "dragbox_box")); )
+                                       for(entity ent = world; (ent = find(ent, classname, "dragbox_box")); )
                                        {
-                                               if(e.cnt <= 0 && oldself.cnt == 0 || e.cnt == oldself.cnt)
+                                               if(e.cnt <= 0 && ent.cnt == 0 || e.cnt == ent.cnt)
                                                {
-                                                       start = start + oldself.origin;
+                                                       start = start + ent.origin;
                                                        ++effectnum;
                                                }
                                        }
@@ -583,12 +582,12 @@ float CheatCommand(entity this, int argc)
                                                        // these need race_place
                                                        // counting...
                                                        effectnum = 1;
-                                                       for(oldself = world; (oldself = find(oldself, classname, "dragpoint")); )
-                                                       if(oldself.cnt == 0)
+                                                       for(entity ent = world; (ent = find(ent, classname, "dragpoint")); )
+                                                       if(ent.cnt == 0)
                                                        {
-                                                               if(vlen(oldself.origin - start) < vlen(e.origin - start))
+                                                               if(vlen2(ent.origin - start) < vlen2(e.origin - start))
                                                                        ++effectnum;
-                                                               else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e))
+                                                               else if(vlen2(ent.origin - start) == vlen2(e.origin - start) && etof(ent) < etof(e))
                                                                        ++effectnum;
                                                        }
                                                        fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n"));
@@ -719,8 +718,8 @@ float Drag_IsDragging(entity dragger);
 void Drag_MoveDrag(entity from, entity to);
 .entity dragentity;
 
-float CheatFrame()
-{SELFPARAM();
+float CheatFrame(entity this)
+{
        BEGIN_CHEAT_FUNCTION();
 
        // Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active,
@@ -1040,8 +1039,8 @@ void Drag_MoveDrag(entity from, entity to)
        }
 }
 
-void DragBox_Think()
-{SELFPARAM();
+void DragBox_Think(entity this)
+{
        if(this.aiment && this.enemy)
        {
                this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;