]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
make code for q3df trigger_teleport flags more concise
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 6 Feb 2023 05:17:41 +0000 (06:17 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Mon, 6 Feb 2023 05:38:30 +0000 (06:38 +0100)
qcsrc/common/mapobjects/teleporters.qc

index 8f55fb1d7f9b93aa9599283f9efc20a181d46926..cadd95f5ce5388c7d77bec29cea69e820425f31c 100644 (file)
@@ -223,13 +223,10 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
                if(vdist(player.velocity, >, e.speed))
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
 
-       bool keepspeed = false;
-       if(teleporter.classname == "trigger_teleport")
-               keepspeed = boolean(teleporter.spawnflags & TELEPORT_KEEP_SPEED);
-
-       if(!keepspeed && STAT(TELEPORT_MAXSPEED, player))
-               if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
-                       player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
+       if(!(teleporter.classname == "trigger_teleport" && teleporter.spawnflags & TELEPORT_KEEP_SPEED))
+               if(STAT(TELEPORT_MAXSPEED, player))
+                       if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
+                               player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
 
        locout = e.origin + '0 0 1' * (1 - player.mins.z - 24);