Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
follow.qc File Reference
#include "follow.qh"
Include dependency graph for follow.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void follow_init (entity this)
 spawnfunc (misc_follow)

Function Documentation

◆ follow_init()

void follow_init ( entity this)

Definition at line 5 of file follow.qc.

6{
7 entity src, dst;
8 src = NULL;
9 dst = NULL;
10 if(this.killtarget != "")
11 src = find(NULL, targetname, this.killtarget);
12 if(this.target != "")
13 dst = find(NULL, targetname, this.target);
14
15 if(!src && !dst)
16 {
17 objerror(this, "follow: could not find target/killtarget");
18 return;
19 }
20
21 if(this.jointtype)
22 {
23 // already done :P entity must stay
24 this.aiment = src;
25 this.enemy = dst;
26 }
27 else if(!src || !dst)
28 {
29 objerror(this, "follow: could not find target/killtarget");
30 return;
31 }
32 else if(this.spawnflags & FOLLOW_ATTACH)
33 {
34 // attach
35 if(this.spawnflags & FOLLOW_LOCAL)
36 {
37 setattachment(dst, src, this.message);
38 }
39 else
40 {
41 attach_sameorigin(dst, src, this.message);
42 }
43
44 dst.solid = SOLID_NOT; // solid doesn't work with attachment
45 delete(this);
46 }
47 else
48 {
49 if(this.spawnflags & FOLLOW_LOCAL)
50 {
52 dst.aiment = src;
53 // dst.punchangle = '0 0 0'; // keep unchanged
54 dst.view_ofs = dst.origin;
55 dst.v_angle = dst.angles;
56 }
57 else
58 {
59 follow_sameorigin(dst, src);
60 }
61
62 delete(this);
63 }
64}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string message
Definition powerups.qc:19
int spawnflags
Definition ammo.qh:15
void attach_sameorigin(entity e, entity to, string tag)
Definition util.qc:1960
void follow_sameorigin(entity e, entity to)
Definition util.qc:2014
const float SOLID_NOT
float jointtype
const int FOLLOW_ATTACH
Definition follow.qh:4
const int FOLLOW_LOCAL
Definition follow.qh:5
entity find(entity start,.string field, string match)
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_FOLLOW
Definition movetypes.qh:141
entity aiment
Definition movetypes.qh:90
#define NULL
Definition post.qh:14
#define objerror
Definition pre.qh:8
string killtarget
Definition subs.qh:48
entity enemy
Definition sv_ctf.qh:153
string targetname
Definition triggers.qh:56
string target
Definition triggers.qh:55

References aiment, attach_sameorigin(), enemy, entity(), find(), FOLLOW_ATTACH, FOLLOW_LOCAL, follow_sameorigin(), jointtype, killtarget, message, MOVETYPE_FOLLOW, NULL, objerror, set_movetype(), SOLID_NOT, spawnflags, target, and targetname.

Referenced by spawnfunc().

◆ spawnfunc()

spawnfunc ( misc_follow )

Definition at line 66 of file follow.qc.

67{
69}
const int INITPRIO_FINDTARGET
Definition constants.qh:96
void follow_init(entity this)
Definition follow.qc:5
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2209

References follow_init(), InitializeEntity(), and INITPRIO_FINDTARGET.