From 33837c65902d0cc3fd3c8c2c09ca6f3e1e3dcb1e Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Mon, 6 Feb 2023 06:17:41 +0100 Subject: [PATCH] make code for q3df trigger_teleport flags more concise --- qcsrc/common/mapobjects/teleporters.qc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/mapobjects/teleporters.qc b/qcsrc/common/mapobjects/teleporters.qc index 8f55fb1d7..cadd95f5c 100644 --- a/qcsrc/common/mapobjects/teleporters.qc +++ b/qcsrc/common/mapobjects/teleporters.qc @@ -223,13 +223,10 @@ entity Simple_TeleportPlayer(entity teleporter, entity player) if(vdist(player.velocity, >, e.speed)) player.velocity = normalize(player.velocity) * max(0, e.speed); - 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)); + if(!(teleporter.classname == "trigger_teleport" && teleporter.spawnflags & TELEPORT_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); -- 2.39.2