#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
- #include "../../lib/warpzone/common.qh"
- #include "../../lib/warpzone/util_server.qh"
- #include "../../lib/warpzone/server.qh"
+ #include <lib/warpzone/common.qh>
+ #include <lib/warpzone/util_server.qh>
+ #include <lib/warpzone/server.qh>
#include "../constants.qh"
#include "../triggers/subs.qh"
#include "../util.qh"
- #include "../../server/weapons/csqcprojectile.qh"
- #include "../../server/autocvars.qh"
- #include "../../server/constants.qh"
- #include "../../server/defs.qh"
+ #include <server/weapons/csqcprojectile.qh>
+ #include <server/autocvars.qh>
+ #include <server/constants.qh>
+ #include <server/defs.qh>
#include "../deathtypes/all.qh"
#include "../turrets/sv_turrets.qh"
#include "../vehicles/all.qh"
#include "../mapinfo.qh"
- #include "../../server/anticheat.qh"
+ #include <server/anticheat.qh>
#endif
float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
{
- if (IS_PLAYER(player) && !PHYS_DEAD(player))
+ if (IS_PLAYER(player) && !IS_DEAD(player))
{
TDEATHLOOP(org)
{
if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team))
#endif
if(IS_PLAYER(head))
- if(!PHYS_DEAD(head))
+ if(!IS_DEAD(head))
return 1;
}
}
#endif
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
-{SELFPARAM();
+{
entity telefragger;
vector from;
#ifdef SVQC
if(player.teleportable == TELEPORT_NORMAL) // don't play sounds or show particles for anything that isn't a player, maybe change later to block only observers
{
- if(self.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
+ if(teleporter.pushltime < time) // only show one teleport effect per teleporter per 0.2 seconds, for better fps
{
if(tflags & TELEPORT_FLAG_SOUND)
- sound (player, CH_TRIGGER, SND_TELEPORT, VOL_BASE, ATTEN_NORM);
+ {
+ string thesound = SND(TELEPORT);
+ if(teleporter.noise != "")
+ {
+ RandomSelection_Init();
+ FOREACH_WORD(teleporter.noise, true,
+ {
+ RandomSelection_Add(NULL, 0, it, 1, 1);
+ });
+ thesound = RandomSelection_chosen_string;
+ }
+ _sound (player, CH_TRIGGER, thesound, VOL_BASE, ATTEN_NORM);
+ }
if(tflags & TELEPORT_FLAG_PARTICLES)
{
Send_Effect(EFFECT_TELEPORT, player.origin, '0 0 0', 1);
Send_Effect(EFFECT_TELEPORT, to + v_forward * 32, '0 0 0', 1);
}
- self.pushltime = time + 0.2;
+ teleporter.pushltime = time + 0.2;
}
}
#endif
// assuming to allows PL_MIN to PL_MAX box and some more
#ifdef SVQC
from = player.origin;
- setorigin (player, to);
+ setorigin(player, to);
player.oldorigin = to; // don't undo the teleport by unsticking
player.angles = to_angles;
player.fixangle = true;
if(IS_PLAYER(player))
{
if(tflags & TELEPORT_FLAG_TDEATH)
- if(player.takedamage && player.deadflag == DEAD_NO && !g_race && !g_cts && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH)))
+ if(player.takedamage && !IS_DEAD(player) && !g_race && !g_cts && (autocvar_g_telefrags || (tflags & TELEPORT_FLAG_FORCE_TDEATH)))
tdeath(player, teleporter, telefragger, telefragmin, telefragmax);
// player no longer is on ground
- player.flags &= ~FL_ONGROUND;
+ UNSET_ONGROUND(player);
// reset tracking of oldvelocity for impact damage (sudden velocity changes)
player.oldvelocity = player.velocity;
{
player.pusher = teleporter.owner;
player.pushltime = time + autocvar_g_maxpushtime;
- player.istypefrag = player.BUTTON_CHAT;
+ player.istypefrag = PHYS_INPUT_BUTTON_CHAT(player);
}
else
{
#ifdef SVQC
if(e.speed)
- if(vlen(player.velocity) > e.speed)
+ if(vdist(player.velocity, >, e.speed))
player.velocity = normalize(player.velocity) * max(0, e.speed);
#elif defined(CSQC)
if(e.speed)
- if(vlen(player.move_velocity) > e.speed)
+ if(vdist(player.move_velocity, >, e.speed))
player.move_velocity = normalize(player.move_velocity) * max(0, e.speed);
#endif
#ifdef SVQC
if(STAT(TELEPORT_MAXSPEED, player))
- if(vlen(player.velocity) > STAT(TELEPORT_MAXSPEED, player))
+ if(vdist(player.velocity, >, STAT(TELEPORT_MAXSPEED, player)))
player.velocity = normalize(player.velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
#elif defined(CSQC)
if(STAT(TELEPORT_MAXSPEED, player))
- if(vlen(player.move_velocity) > STAT(TELEPORT_MAXSPEED, player))
+ if(vdist(player.move_velocity, >, STAT(TELEPORT_MAXSPEED, player)))
player.move_velocity = normalize(player.move_velocity) * max(0, STAT(TELEPORT_MAXSPEED, player));
#endif
return e;
}
-void teleport_findtarget()
+void teleport_findtarget(entity this)
{
int n = 0;
entity e;
- for(e = world; (e = find(e, targetname, self.target)); )
+ for(e = world; (e = find(e, targetname, this.target)); )
{
++n;
#ifdef SVQC
if(e.movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(self, e.origin, 0);
+ waypoint_spawnforteleporter(this, e.origin, 0);
if(e.classname != "info_teleport_destination")
LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n");
#endif
if(n == 0)
{
// no dest!
- objerror ("Teleporter with nonexistant target");
+ objerror (this, "Teleporter with nonexistant target");
return;
}
else if(n == 1)
{
// exactly one dest - bots love that
- self.enemy = find(e, targetname, self.target);
+ this.enemy = find(e, targetname, this.target);
}
else
{
// have to use random selection every single time
- self.enemy = world;
+ this.enemy = world;
}
// now enable touch
+ settouch(this, Teleport_Touch);
#ifdef SVQC
- self.touch = Teleport_Touch;
-
- trigger_teleport_link(self);
-#elif defined(CSQC)
- self.move_touch = Teleport_Touch;
+ trigger_teleport_link(this);
#endif
}
}
void WarpZone_PostTeleportPlayer_Callback(entity pl)
-{SELFPARAM();
+{
#ifdef SVQC
makevectors(pl.angles);
Reset_ArcBeam(pl, v_forward);
UpdateCSQCProjectileAfterTeleport(pl);
UpdateItemAfterTeleport(pl);
- {
- WITH(entity, self, pl, anticheat_fixangle());
- }
+ if (IS_PLAYER(pl)) anticheat_fixangle(pl);
#endif
// "disown" projectiles after teleport
if(pl.owner)