]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/mlrs.qc
c5f6865cc90c0357de7dee9228fd61391a7fdce4
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / mlrs.qc
1 #ifndef TURRET_MLRS_H
2 #define TURRET_MLRS_H
3
4 #include "mlrs_weapon.qc"
5
6 CLASS(MLRSTurret, Turret)
7 /* spawnflags */ ATTRIB(MLRSTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
8 /* mins       */ ATTRIB(MLRSTurret, mins, vector, '-32 -32 0');
9 /* maxs       */ ATTRIB(MLRSTurret, maxs, vector, '32 32 64');
10 /* modelname  */ ATTRIB(MLRSTurret, mdl, string, "base.md3");
11 /* model      */ ATTRIB_STRZONE(MLRSTurret, model, string, strcat("models/turrets/", this.mdl));
12 /* head_model */ ATTRIB_STRZONE(MLRSTurret, head_model, string, strcat("models/turrets/", "mlrs.md3"));
13 /* netname    */ ATTRIB(MLRSTurret, netname, string, "mlrs");
14 /* fullname   */ ATTRIB(MLRSTurret, turret_name, string, _("MLRS Turret"));
15     ATTRIB(MLRSTurret, m_weapon, Weapon, WEP_TUR_MLRS);
16 ENDCLASS(MLRSTurret)
17 REGISTER_TURRET(MLRS, NEW(MLRSTurret));
18
19 #endif
20
21 #ifdef IMPLEMENTATION
22
23 #include "mlrs_weapon.qc"
24
25 #ifdef SVQC
26
27 spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); }
28
29 METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it))
30 {
31     SELFPARAM();
32     // 0 = full, 6 = empty
33     self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6);
34     if(self.tur_head.frame < 0)
35     {
36         LOG_TRACE("ammo:",ftos(self.ammo),"\n");
37         LOG_TRACE("shot_dmg:",ftos(self.shot_dmg),"\n");
38     }
39 }
40 METHOD(MLRSTurret, tr_setup, void(MLRSTurret this, entity it))
41 {
42     it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
43     it.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
44
45     it.damage_flags |= TFL_DMG_HEADSHAKE;
46     it.shoot_flags  |= TFL_SHOOT_VOLLYALWAYS;
47     it.volly_counter = it.shot_volly;
48 }
49
50 #endif // SVQC
51 #endif