]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/misc/follow.qc
spawnfunc and SendEntity3 have a 'this' parameter, use it
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / misc / follow.qc
index 2ac304a212d08fbfaa28183353538040cee7716f..dbe1cb7d8c0013aee51a65788547def7624610b3 100644 (file)
@@ -6,10 +6,10 @@ void follow_init(entity this)
        entity src, dst;
        src = world;
        dst = world;
-       if(self.killtarget != "")
-               src = find(world, targetname, self.killtarget);
-       if(self.target != "")
-               dst = find(world, targetname, self.target);
+       if(this.killtarget != "")
+               src = find(world, targetname, this.killtarget);
+       if(this.target != "")
+               dst = find(world, targetname, this.target);
 
        if(!src && !dst)
        {
@@ -17,35 +17,35 @@ void follow_init(entity this)
                return;
        }
 
-       if(self.jointtype)
+       if(this.jointtype)
        {
                // already done :P entity must stay
-               self.aiment = src;
-               self.enemy = dst;
+               this.aiment = src;
+               this.enemy = dst;
        }
        else if(!src || !dst)
        {
                objerror("follow: could not find target/killtarget");
                return;
        }
-       else if(self.spawnflags & 1)
+       else if(this.spawnflags & 1)
        {
                // attach
-               if(self.spawnflags & 2)
+               if(this.spawnflags & 2)
                {
-                       setattachment(dst, src, self.message);
+                       setattachment(dst, src, this.message);
                }
                else
                {
-                       attach_sameorigin(dst, src, self.message);
+                       attach_sameorigin(dst, src, this.message);
                }
 
                dst.solid = SOLID_NOT; // solid doesn't work with attachment
-               remove(self);
+               remove(this);
        }
        else
        {
-               if(self.spawnflags & 2)
+               if(this.spawnflags & 2)
                {
                        dst.movetype = MOVETYPE_FOLLOW;
                        dst.aiment = src;
@@ -58,12 +58,12 @@ void follow_init(entity this)
                        follow_sameorigin(dst, src);
                }
 
-               remove(self);
+               remove(this);
        }
 }
 
 spawnfunc(misc_follow)
 {
-       InitializeEntity(self, follow_init, INITPRIO_FINDTARGET);
+       InitializeEntity(this, follow_init, INITPRIO_FINDTARGET);
 }
 #endif