]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3df teleporter flags
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Wed, 3 May 2023 22:41:34 +0000 (22:41 +0000)
committerterencehill <piuntn@gmail.com>
Wed, 3 May 2023 22:41:34 +0000 (22:41 +0000)
qcsrc/common/mapobjects/teleporters.qc
qcsrc/common/mapobjects/trigger/teleport.qc
qcsrc/common/mapobjects/trigger/teleport.qh

index c8f9ad245d0ca7c24a7311de92005e62dc9acb16..b9698446c2e67f6b4b9d214e047a3559d5a1c50d 100644 (file)
@@ -223,9 +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))
-               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) &&
+          !(teleporter.classname == "target_teleporter" && teleporter.spawnflags & TARGET_TELEPORTER_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);
 
index ae82a82c1003a8b5da7f8e4e084143a919d5e770..0ac4559ccb4a80228ca88102ef1c5f1c833e11c9 100644 (file)
@@ -39,6 +39,10 @@ bool Teleport_Active(entity this, entity player)
                if(((this.spawnflags & INVERT_TEAMS) == 0) == (DIFF_TEAM(this, player)))
                        return false;
 
+       // no need to call IS_OBSERVER(), observers never call use/touch functions which means this is never an observer
+       if(this.classname == "trigger_teleport" && this.spawnflags & TELEPORT_OBSERVERS_ONLY)
+               return false;
+
        return true;
 }
 
index 6f70f09beec2219624baeca92e2cd7deaa104fb4..de707eba0d751ff03145218e10a5d5d00af81d6b 100644 (file)
@@ -1 +1,11 @@
 #pragma once
+
+
+// q3df compat spawnflags, they may also be useful in xonotic
+
+// trigger_teleport
+#define TELEPORT_OBSERVERS_ONLY BIT(0) // named SPECTATOR in q3df, exists in q3 but is only documented in q3df
+#define TELEPORT_KEEP_SPEED BIT(1)
+
+// target_teleporter
+#define TARGET_TELEPORTER_KEEP_SPEED BIT(0)