]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/mlrs_weapon.qc
Weapons: hide from menu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / mlrs_weapon.qc
1 #ifndef TURRET_MLRS_WEAPON_H
2 #define TURRET_MLRS_WEAPON_H
3
4 CLASS(MLRSTurretAttack, PortoLaunch)
5 /* flags     */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN);
6 /* impulse   */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
7 /* refname   */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
8 /* wepname   */ ATTRIB(MLRSTurretAttack, message, string, _("MLRS"));
9 ENDCLASS(MLRSTurretAttack)
10 REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
11
12 #endif
13
14 #ifdef IMPLEMENTATION
15
16 #ifdef SVQC
17
18 METHOD(MLRSTurretAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2))
19 {
20     SELFPARAM();
21     bool isPlayer = IS_PLAYER(self);
22     if (fire1)
23     if (!isPlayer || weapon_prepareattack(false, WEP_CVAR(machinegun, sustained_refire))) {
24         if (isPlayer) {
25             turret_initparams(self);
26             W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
27             self.tur_shotdir_updated = w_shotdir;
28             self.tur_shotorg = w_shotorg;
29             self.tur_head = self;
30             self.shot_radius = 500;
31             weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
32         }
33         turret_tag_fire_update();
34         entity missile = turret_projectile(SND(ROCKET_FIRE), 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE);
35         missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
36         missile.missile_flags = MIF_SPLASH;
37         te_explosion (missile.origin);
38     }
39     return true;
40 }
41
42 #endif
43
44 #endif