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);
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;
}
#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)