]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Merge branch 'master' into Mario/hagar_notfixed
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index 7dab5ade00d9ade8b4fc8cd717fca0a531c85c47..e13678dce5995e6381c3dd248cdb275aecc174a8 100644 (file)
@@ -97,15 +97,15 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        cheatcount_total += n; \
        e.cheatcount += n
 #define END_CHEAT_FUNCTION() \
-       ADD_CHEATS(self,cheating); \
+       ADD_CHEATS(this, cheating); \
        return attempting
 #define IS_CHEAT(i,argc,fr) \
        if((++attempting, !CheatsAllowed(i,argc,fr))) \
                break
 
 float num_autoscreenshot;
-void info_autoscreenshot_findtarget()
-{SELFPARAM();
+void info_autoscreenshot_findtarget(entity this)
+{
        entity e;
        e = find(world, targetname, self.target);
        if(!e)
@@ -358,7 +358,7 @@ float CheatCommand(float argc)
                                                e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
                                                e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
                                        }
-                                       WITH(entity, self, e, spawnfunc_func_breakable(e));
+                                       WITHSELF(e, spawnfunc_func_breakable(e));
                                        // now, is it valid?
                                        if(f == 0)
                                        {
@@ -696,7 +696,7 @@ float CheatCommand(float argc)
                        setself(new(cheattriggerteleport));
                        setorigin(self, self.origin);
                        self.target = argv(1);
-                       teleport_findtarget();
+                       teleport_findtarget(self);
                        if(!wasfreed(self))
                        {
                                Simple_TeleportPlayer(self, this);
@@ -736,10 +736,10 @@ float CheatFrame()
        switch(0)
        {
                default:
-                       if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+                       if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
                        {
                                // use cheat dragging if cheats are enabled
-                               crosshair_trace_plusvisibletriggers(self);
+                               crosshair_trace_plusvisibletriggers(this);
                                Drag(true, true);
                        }
                        else
@@ -779,43 +779,43 @@ float Drag(float force_allow_pick, float ischeat)
        switch(0)
        {
                default:
-                       if(Drag_IsDragging(self))
+                       if(Drag_IsDragging(this))
                        {
-                               if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(PHYS_INPUT_BUTTON_DRAG(this))
                                {
-                                       if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+                                       if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
                                        {
-                                               Drag_MoveForward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveForward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+                                       else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
                                        {
-                                               Drag_MoveBackward(self);
-                                               self.impulse = 0;
+                                               Drag_MoveBackward(this);
+                                               this.impulse = 0;
                                        }
-                                       else if(self.impulse >= 1 && self.impulse <= 9)
+                                       else if(this.impulse >= 1 && this.impulse <= 9)
                                        {
-                                               Drag_SetSpeed(self, self.impulse - 1);
+                                               Drag_SetSpeed(this, this.impulse - 1);
                                        }
-                                       else if(self.impulse == 14)
+                                       else if(this.impulse == 14)
                                        {
-                                               Drag_SetSpeed(self, 9);
+                                               Drag_SetSpeed(this, 9);
                                        }
 
                                        if(frametime)
-                                               Drag_Update(self);
+                                               Drag_Update(this);
                                }
                                else
                                {
-                                       Drag_Finish(self);
+                                       Drag_Finish(this);
                                }
                        }
                        else
                        {
-                               if(Drag_CanDrag(self))
-                                       if(PHYS_INPUT_BUTTON_DRAG(self))
+                               if(Drag_CanDrag(this))
+                                       if(PHYS_INPUT_BUTTON_DRAG(this))
                                        {
-                                               crosshair_trace_plusvisibletriggers(self);
+                                               crosshair_trace_plusvisibletriggers(this);
                                                entity e = trace_ent;
                                                float pick = force_allow_pick;
                                                if (e && !pick)
@@ -825,18 +825,18 @@ float Drag(float force_allow_pick, float ischeat)
                                                        // This also makes sure that an object can only pe picked up if in range, but does not get dropped if
                                                        // it goes out of range while slinging it around.
 
-                                                       if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+                                                       if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
                                                        {
                                                                switch(e.grab)
                                                                {
                                                                        case 0: // can't grab
                                                                                break;
                                                                        case 1: // owner can grab
-                                                                               if(e.owner == self || e.realowner == self)
+                                                                               if(e.owner == this || e.realowner == this)
                                                                                        pick = true;
                                                                                break;
                                                                        case 2: // owner and team mates can grab
-                                                                               if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+                                                                               if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
                                                                                        pick = true;
                                                                                break;
                                                                        case 3: // anyone can grab
@@ -857,7 +857,7 @@ float Drag(float force_allow_pick, float ischeat)
                                                                        Drag_Finish(e.draggedby);
                                                                if(e.tag_entity)
                                                                        detach_sameorigin(e);
-                                                               Drag_Begin(self, e, trace_endpos);
+                                                               Drag_Begin(this, e, trace_endpos);
                                                                if(ischeat)
                                                                        DID_CHEAT();
                                                                return true;
@@ -1047,38 +1047,38 @@ void Drag_MoveDrag(entity from, entity to)
 
 void DragBox_Think()
 {SELFPARAM();
-       if(self.aiment && self.enemy)
+       if(this.aiment && this.enemy)
        {
-               self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
-               self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
-               self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
-               self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
-               self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
-               self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
-               self.mins = -1 * self.maxs;
-               setorigin(self, self.origin);
-               setsize(self, self.mins, self.maxs); // link edict
+               this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+               this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+               this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+               this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+               this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+               this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+               this.mins = -1 * this.maxs;
+               setorigin(this, this.origin);
+               setsize(this, this.mins, this.maxs); // link edict
        }
 
-       if(self.cnt == -1) // actually race_place -1
+       if(this.cnt == -1) // actually race_place -1
        {
                // show "10 10" for qualifying spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(10));
        }
-       else if(self.cnt == -2) // actually race_place 0
+       else if(this.cnt == -2) // actually race_place 0
        {
                // show "10 0" for loser spawns
-               setmodel(self.killindicator, MDL_NUM(10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(0));
+               setmodel(this.killindicator, MDL_NUM(10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(0));
        }
        else
        {
-               setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
-               setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+               setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+               setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
        }
 
-       self.nextthink = time;
+       this.nextthink = time;
 }
 
 #endif