]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cheats.qc
Merge remote-tracking branch 'origin/master' into samual/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cheats.qc
index 220fb1c7d772e9e64446fcbde9a09a8a790b1d28..27e740b4f1b2af90a7bb8eabb3915fc24bf3d005 100644 (file)
@@ -48,7 +48,7 @@ float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as a
        // dead people cannot cheat
        if(self.deadflag != DEAD_NO)
                return 0;
-       if(self.classname != "player")
+       if(gamestart_sv_cheats < 2 && !IS_PLAYER(self))
                return 0;
        
        // sv_clones
@@ -236,7 +236,7 @@ float CheatImpulse(float i)
                                        break;
                                }
                        }
-                       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((gamestart_sv_cheats >= 2) ? 100000 : 100), 1024, 256))
+                       if(MoveToRandomMapLocation(self, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, ((gamestart_sv_cheats < 2) ? 100 : 100000), 384, 384))
                        {
                                sprint(self, "Emergency teleport used random location\n");
                                self.angles_x = -self.angles_x;
@@ -264,7 +264,7 @@ float CheatImpulse(float i)
 
                        e2 = spawn();
                        setorigin(e2, e.origin);
-                       RadiusDamage(e2, self, 1000, 0, 128, world, 500, DEATH_CHEAT, e);
+                       RadiusDamage(e2, self, 1000, 0, 128, world, world, 500, DEATH_CHEAT, e);
                        remove(e2);
 
                        print("404 Sportsmanship not found.\n");
@@ -695,6 +695,24 @@ float CheatCommand(float argc)
                        self = e;
                        DID_CHEAT();
                        break;
+               case "teleporttotarget":
+                       IS_CHEAT(0, argc, 0);
+                       e = self;
+                       self = spawn();
+                       setorigin(self, self.origin);
+                       self.classname = "cheattriggerteleport";
+                       self.target = argv(1);
+                       teleport_findtarget();
+                       if(!wasfreed(self))
+                       {
+                               Simple_TeleportPlayer(self, e);
+                               remove(self);
+                               self = e;
+                               DID_CHEAT();
+                       }
+                       else
+                               self = e;
+                       break;
        }
 
        END_CHEAT_FUNCTION();
@@ -925,9 +943,9 @@ float Drag_IsDraggable(entity draggee)
                return FALSE;
 //     if(draggee.model == "")
 //             return FALSE;
-       if(draggee.classname == "spectator")
+       if(IS_SPEC(draggee))
                return FALSE;
-       if(draggee.classname == "observer")
+       if(IS_OBSERVER(draggee))
                return FALSE;
        if(draggee.classname == "exteriorweaponentity")
                return FALSE;
@@ -993,7 +1011,7 @@ void Drag_Update(entity dragger)
 
 float Drag_CanDrag(entity dragger)
 {
-       return (dragger.deadflag == DEAD_NO) || (dragger.classname == "player");
+       return (dragger.deadflag == DEAD_NO) || (IS_PLAYER(dragger));
 }
 
 float Drag_IsDragging(entity dragger)