]> icculus.org git repositories - divverent/nexuiz.git/blob - attic/TeamNexuiz/game/gamec/tfai.c
moved navnodeedit & TeamNexuiz to attic
[divverent/nexuiz.git] / attic / TeamNexuiz / game / gamec / tfai.c
1 void() ai_face = \r
2 {\r
3         self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);\r
4         self.ideal_yaw = anglemod(self.ideal_yaw);\r
5         ChangeYaw();\r
6 };\r
7 \r
8 void(float normal) SUB_AttackFinished = \r
9 {\r
10         self.cnt = TF_FLARE_LIT;\r
11 //      if (skill < 3)\r
12 //      {\r
13                 self.attack_finished = time + normal;\r
14 //      }\r
15 };\r
16 \r
17 float(entity targ) range = \r
18 {\r
19         local vector spot1;\r
20         local vector spot2;\r
21         local float r;\r
22         spot1 = self.origin + self.view_ofs;\r
23         spot2 = targ.origin + targ.view_ofs;\r
24         r = vlen(spot1 - spot2);\r
25         if (r < 120)\r
26         {\r
27                 return TF_FLARE_LIT;\r
28         }\r
29         if (r < 500)\r
30         {\r
31                 return TF_FLARE_OFF;\r
32         }\r
33         if (r < 1000)\r
34         {\r
35                 return 2;\r
36         }\r
37         return 3;\r
38 };\r
39 \r
40 float(entity targ) infront = \r
41 {\r
42         local vector vec;\r
43         local float dot;\r
44         makevectors(self.angles);\r
45         vec = normalize(targ.origin - self.origin);\r
46         dot = vec * v_forward;\r
47         if (dot > 0.3)\r
48         {\r
49                 return TF_FLARE_OFF;\r
50         }\r
51         return TF_FLARE_LIT;\r
52 };\r
53 \r
54 void() t_movetarget = \r
55 {\r
56         local entity temp;\r
57         if (other.movetarget != self)\r
58         {\r
59                 return;\r
60         }\r
61         if (other.enemy)\r
62         {\r
63                 return;\r
64         }\r
65         temp = self;\r
66         self = other;\r
67         other = temp;\r
68         if (self.classname == "monster_ogre")\r
69         {\r
70                 sound(self, 2, "ogre/ogdrag.wav", TF_FLARE_OFF, 2);\r
71         }\r
72         self.goalentity = self.movetarget = find(world, targetname, other.target);\r
73         self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);\r
74         if (!(self.movetarget))\r
75         {\r
76                 self.pausetime = time + 999999;\r
77                 self.th_stand();\r
78                 return;\r
79         }\r
80 };\r
81 \r
82 void() movetarget_f = \r
83 {\r
84         if (!(self.targetname))\r
85         {\r
86                 objerror("monster_movetarget: no targetname");\r
87         }\r
88         self.solid = TF_FLARE_OFF;\r
89         self.touch = t_movetarget;\r
90         setsize(self, '-8 -8 -8', '8 8 8');\r
91 };\r
92 \r
93 void() path_corner = \r
94 {\r
95         if (CheckExistence() == TF_FLARE_LIT)\r
96         {\r
97                 dremove(self);\r
98                 return;\r
99         }\r
100         movetarget_f();\r
101 };