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