Remove an old unused model
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / tturrets.qc
1 #include "tturrets.qh"
2 #include "waypointsprites.qh"
3
4 #include "../server/movelib.qh"
5
6 string tid2info_base;
7 string tid2info_head;
8 string tid2info_name;
9 vector  tid2info_min;
10 vector  tid2info_max;
11
12 void turret_tid2info(float _tid);
13 void turret_precache(float _tid);
14 float turret_is_precache[TID_LAST];
15
16 void turrets_precache()
17 {
18     turret_precache(TID_COMMON);
19 }
20
21 void turret_precache(int _tid)
22 {
23     if (!turret_is_precache[TID_COMMON])
24     {
25         precache_sound ("weapons/rocket_impact.wav");
26         precache_model ("models/turrets/base-gib1.md3");
27         precache_model ("models/turrets/base-gib2.md3");
28         precache_model ("models/turrets/base-gib3.md3");
29         precache_model ("models/turrets/base-gib4.md3");
30         precache_model ("models/turrets/head-gib1.md3");
31         precache_model ("models/turrets/head-gib2.md3");
32         precache_model ("models/turrets/head-gib3.md3");
33         precache_model ("models/turrets/head-gib4.md3");
34         precache_model ("models/turrets/base.md3");
35         precache_model ("models/turrets/rocket.md3");
36     }
37     turret_tid2info(_tid);
38     if(turret_is_precache[_tid])
39         return;
40
41     switch(_tid)
42     {
43         case TID_EWHEEL:
44             precache_model ("models/turrets/ewheel-base2.md3");
45             precache_model ("models/turrets/ewheel-gun1.md3");
46             break;
47         case TID_FLAC:
48             precache_model ("models/turrets/flac.md3");
49             break;
50         case TID_FUSION:
51             precache_model ("models/turrets/reactor.md3");
52             break;
53         case TID_HELLION:
54             precache_model ("models/turrets/hellion.md3");
55             break;
56         case TID_HK:
57             precache_model ("models/turrets/hk.md3");
58             break;
59         case TID_MACHINEGUN:
60             precache_model ("models/turrets/machinegun.md3");
61             precache_sound ("weapons/uzi_fire.wav");
62             break;
63         case TID_MLRS:
64             precache_model ("models/turrets/mlrs.md3");
65             break;
66         case TID_PHASER:
67             precache_model ("models/turrets/phaser.md3");
68             precache_model ("models/turrets/phaser_beam.md3");
69             precache_sound ("turrets/phaser.wav");
70             break;
71         case TID_PLASMA:
72             precache_model ("models/turrets/plasma.md3");
73             break;
74         case TID_PLASMA_DUAL:
75             precache_model ("models/turrets/plasmad.md3");
76             break;
77         case TID_TESLA:
78             precache_model ("models/turrets/tesla_head.md3");
79             precache_model ("models/turrets/tesla_base.md3");
80             break;
81         case TID_WALKER:
82             precache_model ("models/turrets/walker_head_minigun.md3");
83             precache_model ("models/turrets/walker_body.md3");
84             precache_sound ("weapons/uzi_fire.wav");
85             break;
86     }
87     turret_is_precache[_tid] = true;
88 }
89
90 void turret_tid2info(float _tid)
91 {
92     tid2info_base = "models/turrets/base.md3";
93     tid2info_min = '-32 -32 0';
94     tid2info_max = '32 32 64';
95
96     switch(_tid)
97     {
98         case TID_EWHEEL:
99             tid2info_base = "models/turrets/ewheel-base2.md3";
100             tid2info_head = "models/turrets/ewheel-gun1.md3";
101             tid2info_name = "eWheel";
102             break;
103         case TID_FLAC:
104             tid2info_head = "models/turrets/flac.md3";
105             tid2info_name = "Flac Cannon";
106             break;
107         case TID_FUSION:
108             tid2info_head = "models/turrets/reactor.md3";
109             tid2info_name = "Fusion Reactor";
110             tid2info_min = '-34 -34 0';
111             tid2info_max = '34 34 90';
112             break;
113         case TID_HELLION:
114             tid2info_head = "models/turrets/hellion.md3";
115             tid2info_name = "Hellion";
116             break;
117         case TID_HK:
118             tid2info_head = "models/turrets/hk.md3";
119             tid2info_name = "Hunter-Killer";
120             break;
121         case TID_MACHINEGUN:
122             tid2info_head = "models/turrets/machinegun.md3";
123             tid2info_name = "Machinegun";
124             break;
125         case TID_MLRS:
126             tid2info_head = "models/turrets/mlrs.md3";
127             tid2info_name = "MLRS";
128             break;
129         case TID_PHASER:
130             tid2info_head = "models/turrets/phaser.md3";
131             tid2info_name = "Phaser";
132             break;
133         case TID_PLASMA:
134             tid2info_head = "models/turrets/plasma.md3";
135             tid2info_name = "Plasma";
136             break;
137         case TID_PLASMA_DUAL:
138             tid2info_head = "models/turrets/plasmad.md3";
139             tid2info_name = "Dual Plasma";
140             break;
141         case TID_TESLA:
142             tid2info_base = "models/turrets/tesla_base.md3";
143             tid2info_head = "models/turrets/tesla_head.md3";
144             tid2info_name = "Tesla coil";
145             tid2info_min = '-60 -60 0';
146             tid2info_max  ='60 60 128';
147             break;
148         case TID_WALKER:
149             tid2info_base = "models/turrets/walker_body.md3";
150             tid2info_head = "models/turrets/walker_head_minigun.md3";
151             tid2info_name = "Walker";
152             tid2info_min = '-70 -70 0';
153             tid2info_max = '70 70 95';
154             break;
155     }
156 }
157
158 void turret_remove()
159 {
160     remove(self.tur_head);
161     //remove(self.enemy);
162     self.tur_head = world;
163 }
164
165 .vector glowmod;
166 void turret_changeteam()
167 {
168         switch(self.team - 1)
169         {
170         case NUM_TEAM_1: // Red
171             self.glowmod = '2 0 0';
172             self.teamradar_color = '1 0 0';
173             break;
174
175         case NUM_TEAM_2: // Blue
176             self.glowmod = '0 0 2';
177             self.teamradar_color = '0 0 1';
178             break;
179
180         case NUM_TEAM_3: // Yellow
181             self.glowmod = '1 1 0';
182             self.teamradar_color = '1 1 0';
183             break;
184
185         case NUM_TEAM_4: // Pink
186             self.glowmod = '1 0 1';
187             self.teamradar_color = '1 0 1';
188             break;
189         }
190
191         if(self.team)
192         self.colormap = 1024 + (self.team - 1) * 17;
193
194         self.tur_head.colormap = self.colormap;
195         self.tur_head.glowmod = self.glowmod;
196
197 }
198
199 void turret_head_draw()
200 {
201     self.drawmask = MASK_NORMAL;
202 }
203
204 void turret_draw()
205 {
206     float dt;
207
208     dt = time - self.move_time;
209     self.move_time = time;
210     if(dt <= 0)
211         return;
212
213     self.tur_head.angles += dt * self.tur_head.move_avelocity;
214
215     if (self.health < 127)
216     {
217         dt = random();
218
219         if(dt < 0.03)
220             te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
221     }
222
223     if(self.health < 85)
224     if(dt < 0.01)
225         pointparticles(particleeffectnum("smoke_large"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
226
227     if(self.health < 32)
228     if(dt < 0.015)
229         pointparticles(particleeffectnum("smoke_small"), (self.origin + (randomvec() * 80)), '0 0 0', 1);
230
231 }
232
233 void turret_draw2d()
234 {
235         if(self.netname == "")
236             return;
237
238         if(!autocvar_g_waypointsprite_turrets)
239                 return;
240
241     if(autocvar_cl_hidewaypoints)
242         return;
243
244         float dist = vlen(self.origin - view_origin);
245     float t = (GetPlayerColor(player_localnum) + 1);
246
247         vector o;
248         string txt;
249
250         if(autocvar_cl_vehicles_hud_tactical)
251         if(dist < 10240 && t != self.team)
252         {
253         // TODO: Vehicle tactical hud
254         o = project_3d_to_2d(self.origin + '0 0 32');
255         if(o.z < 0
256         || o.x < (vid_conwidth * waypointsprite_edgeoffset_left)
257         || o.y < (vid_conheight * waypointsprite_edgeoffset_top)
258         || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
259         || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
260             return; // Dont draw wp's for turrets out of view
261         o.z = 0;
262         if(hud != HUD_NORMAL)
263         {
264             switch(hud)
265             {
266                 case HUD_SPIDERBOT:
267                 case HUD_WAKIZASHI:
268                 case HUD_RAPTOR:
269                 case HUD_BUMBLEBEE:
270                     if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
271                         txt = "gfx/vehicles/vth-mover.tga";
272                     else
273                         txt = "gfx/vehicles/vth-stationary.tga";
274
275                     vector pz = drawgetimagesize(txt) * 0.25;
276                     drawpic(o - pz * 0.5, txt, pz , '1 1 1', 0.75, DRAWFLAG_NORMAL);
277                     break;
278             }
279         }
280         }
281
282         if(dist > self.maxdistance)
283         return;
284
285         string spriteimage = self.netname;
286         float a = self.alpha * autocvar_hud_panel_fg_alpha;
287         vector rgb = spritelookupcolor(spriteimage, self.teamradar_color);
288
289
290         if(self.maxdistance > waypointsprite_normdistance)
291                 a *= pow(bound(0, (self.maxdistance - dist) / (self.maxdistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent);
292         else if(self.maxdistance > 0)
293                 a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
294
295         if(rgb == '0 0 0')
296         {
297                 self.teamradar_color = '1 0 1';
298                 printf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
299         }
300
301         txt = self.netname;
302         if(autocvar_g_waypointsprite_spam && waypointsprite_count >= autocvar_g_waypointsprite_spam)
303                 txt = _("Spam");
304         else
305                 txt = spritelookuptext(spriteimage);
306
307         if(time - floor(time) > 0.5 && t == self.team)
308         {
309                 if(self.helpme && time < self.helpme)
310                 {
311                     a *= SPRITE_HELPME_BLINK;
312                     txt = sprintf(_("%s under attack!"), txt);
313                 }
314                 else
315                         a *= spritelookupblinkvalue(spriteimage);
316         }
317
318         if(autocvar_g_waypointsprite_uppercase)
319                 txt = strtoupper(txt);
320
321         if(a > 1)
322         {
323                 rgb *= a;
324                 a = 1;
325         }
326
327         if(a <= 0)
328             return;
329
330         rgb = fixrgbexcess(rgb);
331
332         o = project_3d_to_2d(self.origin + '0 0 64');
333         if(o.z < 0
334         || o.x < (vid_conwidth * waypointsprite_edgeoffset_left)
335         || o.y < (vid_conheight * waypointsprite_edgeoffset_top)
336         || o.x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right))
337         || o.y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)))
338             return; // Dont draw wp's for turrets out of view
339
340         o.z = 0;
341
342         float edgedistance_min, crosshairdistance;
343                 edgedistance_min = min((o.y - (vid_conheight * waypointsprite_edgeoffset_top)),
344         (o.x - (vid_conwidth * waypointsprite_edgeoffset_left)),
345         (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o.x,
346         (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o.y);
347
348         float vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
349
350         crosshairdistance = sqrt( pow(o.x - vid_conwidth/2, 2) + pow(o.y - vid_conheight/2, 2) );
351
352         t = waypointsprite_scale * vidscale;
353         a *= waypointsprite_alpha;
354
355         {
356                 a = a * (1 - (1 - waypointsprite_distancefadealpha) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
357                 t = t * (1 - (1 - waypointsprite_distancefadescale) * (bound(0, dist/waypointsprite_distancefadedistance, 1)));
358         }
359         if (edgedistance_min < waypointsprite_edgefadedistance) {
360                 a = a * (1 - (1 - waypointsprite_edgefadealpha) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
361                 t = t * (1 - (1 - waypointsprite_edgefadescale) * (1 - bound(0, edgedistance_min/waypointsprite_edgefadedistance, 1)));
362         }
363         if(crosshairdistance < waypointsprite_crosshairfadedistance) {
364                 a = a * (1 - (1 - waypointsprite_crosshairfadealpha) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
365                 t = t * (1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance/waypointsprite_crosshairfadedistance, 1)));
366         }
367
368         o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
369     o = drawspritetext(o, M_PI, (SPRITE_HEALTHBAR_WIDTH + 2 * SPRITE_HEALTHBAR_BORDER) * t, rgb, a, waypointsprite_fontsize * '1 1 0', txt);
370     drawhealthbar(
371             o,
372             0,
373             self.health / 255,
374             '0 0 0',
375             '0 0 0',
376             0.5 * SPRITE_HEALTHBAR_WIDTH * t,
377             0.5 * SPRITE_HEALTHBAR_HEIGHT * t,
378             SPRITE_HEALTHBAR_MARGIN * t + 0.5 * waypointsprite_fontsize,
379             SPRITE_HEALTHBAR_BORDER * t,
380             0,
381             rgb,
382             a * SPRITE_HEALTHBAR_BORDERALPHA,
383             rgb,
384             a * SPRITE_HEALTHBAR_HEALTHALPHA,
385             DRAWFLAG_NORMAL
386             );
387 }
388
389 void turret_walker_draw()
390 {
391     float dt;
392
393     dt = time - self.move_time;
394     self.move_time = time;
395     if(dt <= 0)
396         return;
397
398     fixedmakevectors(self.angles);
399     movelib_groundalign4point(300, 100, 0.25, 45);
400     setorigin(self, self.origin + self.velocity * dt);
401     self.tur_head.angles += dt * self.tur_head.move_avelocity;
402     self.angles_y = self.move_angles.y;
403
404     if (self.health < 127)
405     if(random() < 0.15)
406         te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
407 }
408
409 void turret_ewheel_draw()
410 {
411     float dt;
412
413     dt = time - self.move_time;
414     self.move_time = time;
415     if(dt <= 0)
416         return;
417
418     fixedmakevectors(self.angles);
419     setorigin(self, self.origin + self.velocity * dt);
420     self.tur_head.angles += dt * self.tur_head.move_avelocity;
421     self.angles_y = self.move_angles.y;
422
423     if (self.health < 127)
424     if(random() < 0.05)
425         te_spark(self.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
426 }
427
428 void turret_construct()
429 {
430     if(self.tur_head == world)
431         self.tur_head = spawn();
432
433     turret_tid2info(self.turret_type);
434     self.netname = tid2info_name;
435
436     setorigin(self, self.origin);
437     setmodel(self, tid2info_base);
438     setmodel(self.tur_head, tid2info_head);
439     setsize(self, tid2info_min, tid2info_max);
440     setsize(self.tur_head, '0 0 0', '0 0 0');
441
442     if(self.turret_type == TID_EWHEEL)
443         setattachment(self.tur_head, self, "");
444     else
445         setattachment(self.tur_head, self, "tag_head");
446
447     self.tur_head.classname     = "turret_head";
448     self.tur_head.owner         = self;
449     self.tur_head.move_movetype = MOVETYPE_NOCLIP;
450     self.move_movetype          = MOVETYPE_NOCLIP;
451     self.tur_head.angles        = self.angles;
452     self.health                 = 255;
453     self.solid                  = SOLID_BBOX;
454     self.tur_head.solid         = SOLID_NOT;
455     self.movetype               = MOVETYPE_NOCLIP;
456     self.tur_head.movetype      = MOVETYPE_NOCLIP;
457     self.draw                   = turret_draw;
458     self.entremove              = turret_remove;
459     self.drawmask               = MASK_NORMAL;
460     self.tur_head.drawmask      = MASK_NORMAL;
461     self.anim_start_time        = 0;
462     self.draw2d = turret_draw2d;
463     self.maxdistance = autocvar_g_waypointsprite_turrets_maxdist;
464     self.teamradar_color = '1 0 0';
465     self.alpha = 1;
466
467     if(self.turret_type == TID_EWHEEL || self.turret_type == TID_WALKER)
468     {
469         self.gravity            = 1;
470         self.movetype           = MOVETYPE_BOUNCE;
471         self.move_movetype      = MOVETYPE_BOUNCE;
472         self.move_origin        = self.origin;
473         self.move_time          = time;
474         switch(self.turret_type)
475         {
476             case TID_EWHEEL:
477                 self.draw               = turret_ewheel_draw;
478                 break;
479             case TID_WALKER:
480                 self.draw               = turret_walker_draw;
481                 break;
482
483         }
484     }
485 }
486
487 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
488 void turret_gibboom();
489 void turret_gib_draw()
490 {
491     Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
492
493     self.drawmask = MASK_NORMAL;
494
495         if(self.cnt)
496         {
497             if(time >= self.nextthink)
498             {
499             turret_gibboom();
500             remove(self);
501             }
502         }
503         else
504         {
505         self.alpha = bound(0, self.nextthink - time, 1);
506         if(self.alpha < ALPHA_MIN_VISIBLE)
507             remove(self);
508         }
509 }
510
511 void turret_gibboom()
512 {
513     float i;
514
515     sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
516     pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
517
518     for (i = 1; i < 5; i = i + 1)
519         turret_gibtoss(strcat("models/turrets/head-gib", ftos(i), ".md3"), self.origin + '0 0 2', self.velocity + randomvec() * 700, '0 0 0', false);
520 }
521
522 entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
523 {
524     entity gib;
525
526     traceline(_from, _to, MOVE_NOMONSTERS, world);
527     if(trace_startsolid)
528         return world;
529
530     gib = spawn();
531     setorigin(gib, _from);
532     setmodel(gib, _model);
533     gib.colormod    = _cmod;
534         gib.solid       = SOLID_CORPSE;
535     gib.draw        = turret_gib_draw;
536     gib.cnt         = _explode;
537     setsize(gib, '-1 -1 -1', '1 1 1');
538     if(_explode)
539     {
540         gib.nextthink = time + 0.2 * (autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15));
541         gib.effects = EF_FLAME;
542     }
543     else
544         gib.nextthink = time + autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15);
545
546     gib.gravity         = 1;
547         gib.move_movetype   = MOVETYPE_BOUNCE;
548         gib.move_origin     = _from;
549         setorigin(gib,        _from);
550         gib.move_velocity   = _to;
551         gib.move_avelocity  = prandomvec() * 32;
552         gib.move_time       = time;
553         gib.damageforcescale = 1;
554         gib.classname = "turret_gib";
555
556         return gib;
557 }
558
559 void turret_die()
560 {
561
562     sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
563     pointparticles(particleeffectnum("rocket_explode"), self.origin, '0 0 0', 1);
564     turret_tid2info(self.turret_type);
565     if (!autocvar_cl_nogibs)
566     {
567         // Base
568         if(self.turret_type == TID_EWHEEL)
569             turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
570         else if (self.turret_type == TID_WALKER)
571             turret_gibtoss(tid2info_base, self.origin + '0 0 18', self.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
572         else if (self.turret_type == TID_TESLA)
573             turret_gibtoss(tid2info_base, self.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
574         else
575         {
576             if (random() > 0.5)
577             {
578                 turret_gibtoss("models/turrets/base-gib2.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
579                 turret_gibtoss("models/turrets/base-gib3.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
580                 turret_gibtoss("models/turrets/base-gib4.md3", self.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
581             }
582             else
583                 turret_gibtoss("models/turrets/base-gib1.md3", self.origin + '0 0 8', '0 0 0', '0 0 0', true);
584
585             entity headgib = turret_gibtoss(tid2info_head, self.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
586             if(headgib)
587             {
588                 headgib.angles = headgib.move_angles = self.tur_head.angles;
589                 headgib.avelocity = headgib.move_avelocity = self.tur_head.move_avelocity + randomvec() * 45;
590                 headgib.avelocity_y = headgib.move_avelocity_y = headgib.move_avelocity.y * 5;
591                 headgib.gravity = 0.5;
592             }
593         }
594     }
595
596     setmodel(self, "null");
597     setmodel(self.tur_head, "null");
598 }
599
600 void ent_turret()
601 {
602     int sf = ReadByte();
603
604         if(sf & TNSF_SETUP)
605         {
606             self.turret_type = ReadByte();
607
608             self.origin_x = ReadCoord();
609             self.origin_y = ReadCoord();
610             self.origin_z = ReadCoord();
611             setorigin(self, self.origin);
612
613             self.angles_x = ReadAngle();
614             self.angles_y = ReadAngle();
615
616             turret_precache(self.turret_type);
617             turret_construct();
618             self.colormap = 1024;
619             self.glowmod = '0 1 1';
620             self.tur_head.colormap = self.colormap;
621             self.tur_head.glowmod = self.glowmod;
622     }
623
624     if(sf & TNSF_ANG)
625     {
626         if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
627             self.tur_head = spawn();
628
629         self.tur_head.move_angles_x = ReadShort();
630         self.tur_head.move_angles_y = ReadShort();
631         //self.tur_head.angles = self.angles + self.tur_head.move_angles;
632         self.tur_head.angles = self.tur_head.move_angles;
633     }
634
635     if(sf & TNSF_AVEL)
636     {
637         if(self.tur_head == world) // aparenly this can happpen before TNSF_SETUP. great.
638             self.tur_head = spawn();
639
640         self.tur_head.move_avelocity_x = ReadShort();
641         self.tur_head.move_avelocity_y = ReadShort();
642     }
643
644     if(sf & TNSF_MOVE)
645     {
646         self.origin_x = ReadShort();
647         self.origin_y = ReadShort();
648         self.origin_z = ReadShort();
649         setorigin(self, self.origin);
650
651         self.velocity_x = ReadShort();
652         self.velocity_y = ReadShort();
653         self.velocity_z = ReadShort();
654
655         self.move_angles_y = ReadShort();
656
657         self.move_time     = time;
658         self.move_velocity = self.velocity;
659         self.move_origin   = self.origin;
660     }
661
662     if(sf & TNSF_ANIM)
663     {
664         self.frame1time = ReadCoord();
665         self.frame      = ReadByte();
666     }
667
668     if(sf & TNSF_STATUS)
669     {
670         int _tmp = ReadByte();
671         if(_tmp != self.team)
672         {
673             self.team = _tmp;
674             turret_changeteam();
675         }
676
677         _tmp = ReadByte();
678         if(_tmp == 0 && self.health != 0)
679             turret_die();
680         else if(self.health && self.health != _tmp)
681             self.helpme = servertime + 10;
682
683         self.health = _tmp;
684     }
685     //self.enemy.health = self.health / 255;
686 }