1 void Teleport_Touch (void)
8 if (!other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too
13 sound (other, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
14 pointparticles(particleeffectnum("teleport"), other.origin, '0 0 0', 1);
17 // Make teleport effect where the player left
18 sound (self, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
19 pointparticles(particleeffectnum("teleport"), other.origin, '0 0 0', 1);
21 // Make teleport effect where the player arrived
22 sound (self.enemy, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
25 makevectors (self.enemy.mangle);
26 pointparticles(particleeffectnum("teleport"), self.enemy.origin + v_forward * 32, '0 0 0', 1);
28 // Relocate the player
29 setorigin (other, self.enemy.origin + '0 0 1' * (1 - other.mins_z - 24));
30 other.angles = self.enemy.mangle;
31 other.fixangle = TRUE;
32 other.velocity = v_forward * vlen(other.velocity);
34 // Kill anyone else in the teleporter box (NO MORE TDEATH)
35 if(other.takedamage && !g_race)
40 deathmin = other.absmin;
41 deathmax = other.absmax;
42 deathradius = max(vlen(deathmin), vlen(deathmax));
43 for(head = findradius(other.origin, deathradius); head; head = head.chain)
46 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
48 if ((other.classname == "player") && (other.health >= 1))
49 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
50 else if (other.health < 1) // corpses gib
51 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
52 else // dead bodies and monsters gib themselves instead of telefragging
53 Damage (other, self, other, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
58 other.effects = other.effects | EF_NODRAW;
59 if (other.weaponentity) // misuse FL_FLY to avoid EF_NODRAW on viewmodel
60 other.weaponentity.flags = other.weaponentity.flags | FL_FLY;
61 other.teleport_time = time + cvar("sys_ticrate");
63 other.flags = other.flags - (other.flags & FL_ONGROUND);
64 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
65 other.oldvelocity = other.velocity;
66 // reset tracking of who pushed you into a hazard (for kill credit)
69 // stop player name display
73 ClearSelectedPlayer();
87 void spawnfunc_info_teleport_destination (void)
89 self.mangle = self.angles;
90 self.angles = '0 0 0';
92 //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
93 setorigin (self, self.origin);
96 objerror ("Teleport destination without a targetname");
99 void spawnfunc_misc_teleporter_dest (void)
101 spawnfunc_info_teleport_destination();
104 void spawnfunc_target_teleporter (void)
106 spawnfunc_info_teleport_destination();
109 void teleport_findtarget (void)
112 self.touch = Teleport_Touch;
114 self.enemy = find (world, targetname, self.target);
117 objerror ("Teleporter with nonexistant target");
122 self.dest = self.enemy.origin;
123 waypoint_spawnforteleporter(self, self.dest, 0);
126 void spawnfunc_trigger_teleport (void)
128 self.angles = '0 0 0';
132 // this must be called to spawn the teleport waypoints for bots
133 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
136 objerror ("Teleporter with no target");