]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/teleporters.qc
Mininum velocity for teleporter exits
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / teleporters.qc
index 651566c71b6fbec9ff4fd7ef5052a14dea7919ce..98864129cf20daa9e12d8d562a31995b8bc2e7f3 100644 (file)
@@ -225,9 +225,16 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
 
        if(!(teleporter.classname == "trigger_teleport" && (teleporter.spawnflags & TELEPORT_KEEP_SPEED)) &&
           !(teleporter.classname == "target_teleporter" && (teleporter.spawnflags & TARGET_TELEPORTER_KEEP_SPEED)))
+       {
+               // test if player is slower than min
+               if(STAT(TELEPORT_MINSPEED, player))
+                       if(vdist(player.velocity, <, STAT(TELEPORT_MINSPEED, player)))
+                               player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MINSPEED, player));
+               // test if player is faster than max (or if min is above max)
                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);