+
+ // Find the output teleporter
+ if(!teleporter.enemy)
+ {
+ RandomSelection_Init();
+ for(e = world; (e = find(e, targetname, teleporter.target)); )
+ {
+ p = 1;
+ if(autocvar_g_telefrags_avoid)
+ {
+ locout = e.origin + '0 0 1' * (1 - player.mins_z - 24);
+ if(check_tdeath(player, locout, '0 0 0', '0 0 0'))
+ p = 0;
+ }
+ RandomSelection_Add(e, 0, string_null, (e.cnt ? e.cnt : 1), p);
+ }
+ teleporter.enemy = RandomSelection_chosen_ent;
+ }
+
+ if(!teleporter.enemy) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
+
+ makevectors(teleporter.enemy.mangle);
+
+ if(teleporter.enemy.speed)
+ if(vlen(player.velocity) > teleporter.enemy.speed)
+ player.velocity = normalize(player.velocity) * max(0, teleporter.enemy.speed);
+
+ if(autocvar_g_teleport_maxspeed)
+ if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
+ player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
+
+ locout = teleporter.enemy.origin + '0 0 1' * (1 - player.mins_z - 24);
+ TeleportPlayer(teleporter, player, locout, teleporter.enemy.mangle, v_forward * vlen(player.velocity), '0 0 0', '0 0 0', TELEPORT_FLAGS_TELEPORTER);
+}
+
+void Teleport_Touch (void)
+{
+ entity oldself;