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))
15 Damage (other, self, self.owner, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
16 else if (other.health < 1) // corpses gib
17 Damage (other, self, self.owner, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
18 else // dead bodies and monsters gib themselves instead of telefragging
19 Damage (self.owner, self, self.owner, 10000, DEATH_TELEFRAG, self.owner.origin, '0 0 0');
22 // org2 is where they will return to if the teleport fails
23 void(vector org, entity death_owner, vector org2) spawn_tdeath =
28 // death.classname = "teledeath";
29 death.movetype = MOVETYPE_NONE;
30 death.solid = SOLID_TRIGGER;
31 death.angles = '0 0 0';
33 setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
34 setorigin (death, org);
35 death.touch = tdeath_touch;
36 death.nextthink = time + 0.2;
37 death.think = SUB_Remove;
38 death.owner = death_owner;
40 force_retouch = 2; // make sure even still objects get hit
43 void Teleport_Touch (void)
47 if (other.classname != "player") // FIXME: Make missiles firable through the teleport too
50 // Make teleport effect where the player left
51 sound (other, CHAN_ITEM, "misc/teleport.ogg", 1, ATTN_NORM);
52 te_teleport (other.origin);
54 dest = find (world, targetname, self.target);
56 objerror ("Teleporter with nonexistant target");
58 // Make teleport effect where the player arrived
59 sound (other, CHAN_ITEM, "misc/teleport.ogg", 1, ATTN_NORM);
60 makevectors (dest.mangle);
61 te_teleport (dest.origin + v_forward * 32);
63 spawn_tdeath(dest.origin, other, other.origin);
65 // Relocate the player
66 //setorigin (other, dest.origin);
67 setorigin (other, dest.origin + '0 0 1' * (1 - other.mins_z - 24));
68 other.angles = dest.mangle;
69 other.fixangle = TRUE;
71 other.velocity = '0 0 0';
73 other.flags = other.flags - (other.flags & FL_ONGROUND);
74 // reset tracking of oldvelocity for impact damage (sudden velocity changes)
75 other.oldvelocity = other.velocity;
76 // reset tracking of who pushed you into a hazard (for kill credit)
80 void info_teleport_destination (void)
82 self.mangle = self.angles;
83 self.angles = '0 0 0';
85 //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake
86 setorigin (self, self.origin);
89 objerror ("Teleport destination without a targetname");
92 void misc_teleporter_dest (void)
94 info_teleport_destination();
97 void trigger_teleport (void)
99 self.angles = '0 0 0';
101 self.solid = SOLID_TRIGGER;
102 self.movetype = MOVETYPE_NONE;
104 setmodel (self, self.model);
109 self.touch = Teleport_Touch;
112 objerror ("Teleporter with no target");