1 // the way this entity works makes it no use to CSQC, as it removes itself instantly
4 void follow_init(entity this)
9 if(this.killtarget != "")
10 src = find(world, targetname, this.killtarget);
12 dst = find(world, targetname, this.target);
16 objerror(this, "follow: could not find target/killtarget");
22 // already done :P entity must stay
28 objerror(this, "follow: could not find target/killtarget");
31 else if(this.spawnflags & 1)
34 if(this.spawnflags & 2)
36 setattachment(dst, src, this.message);
40 attach_sameorigin(dst, src, this.message);
43 dst.solid = SOLID_NOT; // solid doesn't work with attachment
48 if(this.spawnflags & 2)
50 dst.movetype = MOVETYPE_FOLLOW;
52 // dst.punchangle = '0 0 0'; // keep unchanged
53 dst.view_ofs = dst.origin;
54 dst.v_angle = dst.angles;
58 follow_sameorigin(dst, src);
65 spawnfunc(misc_follow)
67 InitializeEntity(this, follow_init, INITPRIO_FINDTARGET);