]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/t_teleporters.qc
Merge branch 'master' into Mario/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / t_teleporters.qc
index d61911ecdfd2e9e75033b69887c8c69eaf4b73c6..543c1cf0bb66919b8576259587a058f8e7a2fd99 100644 (file)
@@ -25,7 +25,7 @@ void trigger_teleport_use()
                if(head != player) \
                        if(head.takedamage) \
                                if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
-       
+
 
 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax)
 {
@@ -33,7 +33,7 @@ float check_tdeath(entity player, vector org, vector telefragmin, vector telefra
        {
                TDEATHLOOP(org)
                {
-                       if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
+                       if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team))
                                if(IS_PLAYER(head))
                                        if(head.health >= 1)
                                                return 1;
@@ -48,7 +48,7 @@ void tdeath(entity player, entity teleporter, entity telefragger, vector telefra
        {
                if (IS_PLAYER(player) && player.health >= 1)
                {
-                       if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
+                       if (!(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team))
                        {
                                if(IS_PLAYER(head))
                                        if(head.health >= 1)
@@ -80,6 +80,7 @@ void spawn_tdeath(vector v0, entity e, vector v)
 #define TELEPORT_NORMAL 1 // play sounds/effects etc
 #define TELEPORT_SIMPLE 2 // only do teleport, nothing special
 
+void Reset_ArcBeam(entity player, vector forward);
 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
 {
        entity telefragger;
@@ -117,6 +118,8 @@ void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angle
        player.velocity = to_velocity;
        BITXOR_ASSIGN(player.effects, EF_TELEPORT_BIT);
 
+       makevectors(player.angles);
+       Reset_ArcBeam(player, v_forward);
        UpdateCSQCProjectileAfterTeleport(player);
 
        if(IS_PLAYER(player))
@@ -153,14 +156,14 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
        vector locout;
        entity e;
        float p;
-       
+
        // Find the output teleporter
        if(teleporter.enemy)
        {
                e = teleporter.enemy;
        }
        else
-       { 
+       {
                RandomSelection_Init();
                for(e = world; (e = find(e, targetname, teleporter.target)); )
                {
@@ -177,13 +180,13 @@ entity Simple_TeleportPlayer(entity teleporter, entity player)
        }
 
        if(!e) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
-       
+
        makevectors(e.mangle);
 
        if(e.speed)
                if(vlen(player.velocity) > e.speed)
                        player.velocity = normalize(player.velocity) * max(0, e.speed);
-                       
+
        if(autocvar_g_teleport_maxspeed)
                if(vlen(player.velocity) > autocvar_g_teleport_maxspeed)
                        player.velocity = normalize(player.velocity) * max(0, autocvar_g_teleport_maxspeed);
@@ -201,17 +204,17 @@ void Teleport_Touch (void)
 
        if (self.active != ACTIVE_ACTIVE)
                return;
-       
-       if not(other.teleportable)
+
+       if (!other.teleportable)
                return;
-    
+
        if(other.vehicle)
        if(!other.vehicle.teleportable)
                return;
-                       
+
        if(other.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
                return;
-        
+
        if(other.deadflag != DEAD_NO)
                return;
 
@@ -223,14 +226,14 @@ void Teleport_Touch (void)
 
        if(IS_PLAYER(other))
                RemoveGrapplingHook(other);
-               
+
        entity e;
        e = Simple_TeleportPlayer(self, other);
 
        activator = other;
        s = self.target; self.target = string_null;
        SUB_UseTargets();
-       if not(self.target) self.target = s;
+       if (!self.target) self.target = s;
 
        oldself = self;
        self = e;
@@ -310,16 +313,16 @@ entity Teleport_Find(vector mi, vector ma)
        return world;
 }
 
-entity teleport_first; 
+entity teleport_first;
 .entity teleport_next;
 void spawnfunc_trigger_teleport (void)
 {
        self.angles = '0 0 0';
 
        EXACTTRIGGER_INIT;
-       
-       self.active = ACTIVE_ACTIVE;    
-       
+
+       self.active = ACTIVE_ACTIVE;
+
        self.use = trigger_teleport_use;
 
        // this must be called to spawn the teleport waypoints for bots
@@ -330,14 +333,22 @@ void spawnfunc_trigger_teleport (void)
                objerror ("Teleporter with no target");
                return;
        }
-       
+
        self.teleport_next = teleport_first;
        teleport_first = self;
 }
 
 void WarpZone_PostTeleportPlayer_Callback(entity pl)
 {
+       makevectors(pl.angles);
+       Reset_ArcBeam(pl, v_forward);
        UpdateCSQCProjectileAfterTeleport(pl);
+       {
+               entity oldself = self;
+               self = pl;
+               anticheat_fixangle();
+               self = oldself;
+       }
        // "disown" projectiles after teleport
        if(pl.owner)
        if(pl.owner == pl.realowner)