]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3df compat: implement q3df flags for trigger_teleport
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 5 Feb 2023 21:17:33 +0000 (22:17 +0100)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 5 Feb 2023 21:17:33 +0000 (22:17 +0100)
qcsrc/common/mapobjects/teleporters.qc
qcsrc/common/mapobjects/trigger/teleport.qc
qcsrc/common/mapobjects/trigger/teleport.qh

index c8f9ad245d0ca7c24a7311de92005e62dc9acb16..8f55fb1d7f9b93aa9599283f9efc20a181d46926 100644 (file)
@@ -223,7 +223,11 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
                if(vdist(player.velocity, >, e.speed))
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
 
-       if(STAT(TELEPORT_MAXSPEED, player))
+       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));
 
index ae82a82c1003a8b5da7f8e4e084143a919d5e770..42e1bd24fa06c4b5f93039725d81c461a579ffa7 100644 (file)
@@ -27,6 +27,9 @@ bool Teleport_Active(entity this, entity player)
 
        if(IS_TURRET(player))
                return false;
+
+       if((this.spawnflags & TELEPORT_SPECTATOR) && !IS_SPEC(player))
+               return false;
 #elif defined(CSQC)
        if(!IS_PLAYER(player))
                return false;
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..ff3fa079bd6187ef089916baf58800cbba8ea74c 100644 (file)
@@ -1 +1,5 @@
 #pragma once
+
+
+const int TELEPORT_SPECTATOR = BIT(0);
+const int TELEPORT_KEEP_SPEED = BIT(1);