1 void Damage (entity targ, entity inflictor, entity attacker, float
2 damage, float deathtype, vector hitloc, vector force);
6 if (other == self.owner)
8 // so teleporting shots etc can't telefrag
9 if (!self.owner.takedamage)
11 if (!other.takedamage)
14 if ((self.owner.classname == "player") && (self.owner.health >= 1))
16 Damage (other, self, self.owner, 10000, WEP_TELEPORTER, other.origin,
19 else if (other.health < 1) // corpses gib
20 Damage (other, self, self.owner, 10000, 0, other.origin, '0 0 0');
21 else // dead bodies and monsters gib themselves instead of telefragging
22 Damage (self.owner, self, other, 10000, 0, self.owner.origin, '0 0 0');
25 // org2 is where they will return to if the teleport fails
26 void(vector org, entity death_owner, vector org2) spawn_tdeath =
31 // death.classname = "teledeath";
32 death.movetype = MOVETYPE_NONE;
33 death.solid = SOLID_TRIGGER;
34 death.angles = '0 0 0';
36 setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
37 setorigin (death, org);
38 death.touch = tdeath_touch;
39 death.nextthink = time + 0.2;
40 death.think = SUB_Remove;
41 death.owner = death_owner;
43 force_retouch = 2; // make sure even still objects get hit
46 void Teleport_Touch (void)
50 if (other.classname != "player") // FIXME: Make missiles firable through the teleport too
53 // Make teleport effect where the player left
54 sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM);
55 te_teleport (other.origin);
57 dest = find (world, targetname, self.target);
59 objerror ("Teleporter with nonexistant target");
61 // Make teleport effect where the player arrived
62 sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM);
63 makevectors (dest.mangle);
64 te_teleport (dest.origin + v_forward * 32);
66 spawn_tdeath(dest.origin, other, other.origin);
68 // Relocate the player
69 //setorigin (other, dest.origin);
70 setorigin (other, dest.origin + '0 0 1' * (1 - other.mins_z - 24));
71 other.angles = dest.mangle;
72 other.fixangle = TRUE;
74 other.velocity = '0 0 0';
76 other.flags = other.flags - (other.flags & FL_ONGROUND);
79 void info_teleport_destination (void)
81 self.mangle = self.angles;
82 self.angles = '0 0 0';
84 //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
85 setorigin (self, self.origin);
88 objerror ("Teleport destination without a targetname");
91 void misc_teleporter_dest (void)
93 info_teleport_destination();
96 void trigger_teleport (void)
98 self.angles = '0 0 0';
100 self.solid = SOLID_TRIGGER;
101 self.movetype = MOVETYPE_NONE;
103 setmodel (self, self.model);
108 self.touch = Teleport_Touch;
111 objerror ("Teleporter with no target");