From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 5 Feb 2023 21:17:33 +0000 (+0100) Subject: q3df compat: implement q3df flags for trigger_teleport X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cb9daeb74872e2f60d96e45b9c1218163dd0b662;p=xonotic%2Fxonotic-data.pk3dir.git q3df compat: implement q3df flags for trigger_teleport --- diff --git a/qcsrc/common/mapobjects/teleporters.qc b/qcsrc/common/mapobjects/teleporters.qc index c8f9ad245..8f55fb1d7 100644 --- a/qcsrc/common/mapobjects/teleporters.qc +++ b/qcsrc/common/mapobjects/teleporters.qc @@ -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)); diff --git a/qcsrc/common/mapobjects/trigger/teleport.qc b/qcsrc/common/mapobjects/trigger/teleport.qc index ae82a82c1..42e1bd24f 100644 --- a/qcsrc/common/mapobjects/trigger/teleport.qc +++ b/qcsrc/common/mapobjects/trigger/teleport.qc @@ -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; diff --git a/qcsrc/common/mapobjects/trigger/teleport.qh b/qcsrc/common/mapobjects/trigger/teleport.qh index 6f70f09be..ff3fa079b 100644 --- a/qcsrc/common/mapobjects/trigger/teleport.qh +++ b/qcsrc/common/mapobjects/trigger/teleport.qh @@ -1 +1,5 @@ #pragma once + + +const int TELEPORT_SPECTATOR = BIT(0); +const int TELEPORT_KEEP_SPEED = BIT(1);