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);
33 RemoveGrapplingHook(other);
35 // Kill anyone else in the teleporter box (NO MORE TDEATH)
36 if(other.takedamage && !g_race)
41 deathmin = other.absmin;
42 deathmax = other.absmax;
43 deathradius = max(vlen(deathmin), vlen(deathmax));
44 for(head = findradius(other.origin, deathradius); head; head = head.chain)
47 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
49 if ((other.classname == "player") && (other.health >= 1))
50 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
51 else if (other.health < 1) // corpses gib
52 Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
53 else // dead bodies and monsters gib themselves instead of telefragging
54 Damage (other, self, other, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
59 other.effects = other.effects | EF_NODRAW;
60 if (other.weaponentity) // misuse FL_FLY to avoid EF_NODRAW on viewmodel
61 other.weaponentity.flags = other.weaponentity.flags | FL_FLY;
62 other.teleport_time = time + cvar("sys_ticrate");
64 other.flags = other.flags - (other.flags & FL_ONGROUND);
65 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
66 other.oldvelocity = other.velocity;
67 // reset tracking of who pushed you into a hazard (for kill credit)
70 // stop player name display
74 ClearSelectedPlayer();
88 void spawnfunc_info_teleport_destination (void)
90 self.mangle = self.angles;
91 self.angles = '0 0 0';
93 //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
94 setorigin (self, self.origin);
100 objerror ("Teleport destination without a targetname");
103 void spawnfunc_misc_teleporter_dest (void)
105 spawnfunc_info_teleport_destination();
108 void spawnfunc_target_teleporter (void)
110 spawnfunc_info_teleport_destination();
113 void teleport_findtarget (void)
116 self.touch = Teleport_Touch;
118 self.enemy = find (world, targetname, self.target);
121 objerror ("Teleporter with nonexistant target");
126 self.dest = self.enemy.origin;
127 waypoint_spawnforteleporter(self, self.dest, 0);
130 void spawnfunc_trigger_teleport (void)
132 self.angles = '0 0 0';
136 // this must be called to spawn the teleport waypoints for bots
137 InitializeEntity(self, teleport_findtarget, INITPRIO_FINDTARGET);
140 objerror ("Teleporter with no target");