2003-10-24 21:43:32 +00:00
|
|
|
#include "common.qh"
|
|
|
|
#include "mapents_util.qh"
|
|
|
|
#include "damage.qh"
|
|
|
|
#include "effect.qh"
|
2003-10-27 22:27:29 +00:00
|
|
|
#include "misc.qh"
|
2003-10-24 21:43:32 +00:00
|
|
|
#include "teleport.qh"
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
.float (vector org) th_teleport;
|
2003-10-28 21:20:34 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_deathmsg_teleport =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local string att_nname, def_nname;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
def_nname = name (self);
|
|
|
|
att_nname = name (self.dmg_attacker);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
if (self.dmg_inflictor.owner == self)
|
2004-02-08 07:34:17 +00:00
|
|
|
bprint (PRINT_DEATH, "Satan's power deflects ", att_nname,
|
|
|
|
"'s telefrag.\n");
|
2003-10-24 21:43:32 +00:00
|
|
|
else
|
2004-02-08 07:34:17 +00:00
|
|
|
bprint (PRINT_DEATH, def_nname, " was telefragged by ", att_nname,
|
|
|
|
".\n");
|
2003-10-24 21:43:32 +00:00
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void ()
|
|
|
|
_teleport_death_touch =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
if (self.owner == other)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ghost_inflictor.classname = "TELEPORT_DEATH";
|
|
|
|
|
|
|
|
ghost_inflictor.dmg = DAMAGE_SHOULDDIE;
|
|
|
|
ghost_inflictor.mass = 800;
|
|
|
|
|
|
|
|
ghost_inflictor.velocity = '0 0 0';
|
|
|
|
ghost_inflictor.lip = 64;
|
|
|
|
ghost_inflictor.speed = 1000;
|
|
|
|
ghost_inflictor.owner = self.owner;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
damage (other, self.owner, ghost_inflictor, DAMAGE_SHOULDDIE,
|
|
|
|
_deathmsg_teleport);
|
2003-10-24 21:43:32 +00:00
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void (vector org, entity death_owner)
|
|
|
|
_teleport_death_spawn =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local entity death;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
death = spawn ("TELEDEATH");
|
2003-10-24 21:43:32 +00:00
|
|
|
death.owner = death_owner;
|
|
|
|
death.solid = SOLID_TRIGGER;
|
2004-02-08 07:34:17 +00:00
|
|
|
setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
|
|
|
|
setorigin (death, org);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
death.touch = _teleport_death_touch;
|
|
|
|
|
|
|
|
death.think = SUB_remove;
|
|
|
|
death.nextthink = time + 0.1;
|
|
|
|
|
|
|
|
force_retouch = 2;
|
|
|
|
};
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
void (entity e, entity spot)
|
|
|
|
teleport =
|
|
|
|
{
|
2003-10-24 21:43:32 +00:00
|
|
|
local float spd;
|
|
|
|
|
|
|
|
if (e.th_teleport) {
|
|
|
|
local entity oldself, oldother;
|
|
|
|
local float do_teleport;
|
|
|
|
|
|
|
|
oldself = self;
|
|
|
|
oldother = other;
|
|
|
|
|
|
|
|
self = e;
|
|
|
|
other = spot;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
do_teleport = self.th_teleport (other.origin);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
|
|
|
self = oldself;
|
|
|
|
other = oldother;
|
|
|
|
|
|
|
|
if (!do_teleport)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
spd = vlen (e.velocity);
|
2003-10-24 21:43:32 +00:00
|
|
|
if (spd < 200)
|
|
|
|
spd = 200;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
setorigin (e, spot.origin);
|
2003-10-24 21:43:32 +00:00
|
|
|
e.angles = spot.angles;
|
|
|
|
e.fixangle = TRUE;
|
|
|
|
e.teleport_time = 0.1;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
makevectors (e.angles);
|
2003-10-24 21:43:32 +00:00
|
|
|
e.velocity = v_forward*spd;
|
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
if (is_living (e))
|
|
|
|
_teleport_death_spawn (spot.origin, e);
|
2003-10-24 21:43:32 +00:00
|
|
|
|
2004-02-08 07:34:17 +00:00
|
|
|
effect_teleport_fog (spot.origin);
|
2003-10-24 21:43:32 +00:00
|
|
|
};
|