1 void Teleport_Touch (void)
8 if (!other.flags & FL_CLIENT) // FIXME: Make missiles firable through the teleport too
11 sound (other, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
12 pointparticles(particleeffectnum("teleport"), other.origin, '0 0 0', 1);
15 // Make teleport effect where the player left
16 sound (self, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
17 pointparticles(particleeffectnum("teleport"), other.origin, '0 0 0', 1);
19 // Make teleport effect where the player arrived
20 sound (self.enemy, CHAN_TRIGGER, "misc/teleport.wav", VOL_BASE, ATTN_NORM);
23 makevectors (self.enemy.mangle);
24 pointparticles(particleeffectnum("teleport"), self.enemy.origin + v_forward * 32, '0 0 0', 1);
26 // Relocate the player
27 setorigin (other, self.enemy.origin + '0 0 1' * (1 - other.mins_z - 24));
28 other.angles = self.enemy.mangle;
29 other.fixangle = TRUE;
30 other.velocity = v_forward * vlen(other.velocity);
32 // Kill anyone else in the teleporter box (NO MORE TDEATH)
33 if(other.takedamage && !g_race)
38 deathmin = other.absmin;
39 deathmax = other.absmax;
40 deathradius = max(vlen(deathmin), vlen(deathmax));
41 for(head = findradius(other.origin, deathradius); head; head = head.chain)
44 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
46 if ((other.classname == "player") && (other.health >= 1))
47 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
48 else if (other.health < 1) // corpses gib
49 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
50 else // dead bodies and monsters gib themselves instead of telefragging
51 Damage (other, self, other, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
56 other.effects = other.effects | EF_NODRAW;
57 if (other.weaponentity) // misuse FL_FLY to avoid EF_NODRAW on viewmodel
58 other.weaponentity.flags = other.weaponentity.flags | FL_FLY;
59 other.teleport_time = time + cvar("sys_ticrate");
61 other.flags = other.flags - (other.flags & FL_ONGROUND);
62 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
63 other.oldvelocity = other.velocity;
64 // reset tracking of who pushed you into a hazard (for kill credit)
67 // stop player name display
71 ClearSelectedPlayer();
85 void spawnfunc_info_teleport_destination (void)
87 self.mangle = self.angles;
88 self.angles = '0 0 0';
90 //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
91 setorigin (self, self.origin);
94 objerror ("Teleport destination without a targetname");
97 void spawnfunc_misc_teleporter_dest (void)
99 spawnfunc_info_teleport_destination();
102 void spawnfunc_target_teleporter (void)
104 spawnfunc_info_teleport_destination();
107 void teleport_findtarget (void)
110 self.touch = Teleport_Touch;
112 self.enemy = find (world, targetname, self.target);
115 objerror ("Teleporter with nonexistant target");
120 self.dest = self.enemy.origin;
121 waypoint_spawnforteleporter(self, self.dest, 0);
124 void spawnfunc_trigger_teleport (void)
126 self.angles = '0 0 0';
130 self.think = teleport_findtarget;
131 self.nextthink = time + 0.2;
134 objerror ("Teleporter with no target");