2 // the way this entity works makes it no use to CSQC, as it removes itself instantly
5 void follow_init(entity this)
10 if(this.killtarget != "")
11 src = find(NULL, targetname, this.killtarget);
13 dst = find(NULL, targetname, this.target);
17 objerror(this, "follow: could not find target/killtarget");
23 // already done :P entity must stay
29 objerror(this, "follow: could not find target/killtarget");
32 else if(this.spawnflags & FOLLOW_ATTACH)
35 if(this.spawnflags & FOLLOW_LOCAL)
37 setattachment(dst, src, this.message);
41 attach_sameorigin(dst, src, this.message);
44 dst.solid = SOLID_NOT; // solid doesn't work with attachment
49 if(this.spawnflags & FOLLOW_LOCAL)
51 set_movetype(dst, MOVETYPE_FOLLOW);
53 // dst.punchangle = '0 0 0'; // keep unchanged
54 dst.view_ofs = dst.origin;
55 dst.v_angle = dst.angles;
59 follow_sameorigin(dst, src);
66 spawnfunc(misc_follow)
68 InitializeEntity(this, follow_init, INITPRIO_FINDTARGET);