]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/mlrs_weapon.qc
Merge branch 'master' into terencehill/dynamic_hud
[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 | WEP_FLAG_MUTATORBLOCKED);
6 /* impulse   */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
7 /* refname   */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
8 /* wepname   */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
9 ENDCLASS(MLRSTurretAttack)
10 REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
11
12 #endif
13
14 #ifdef IMPLEMENTATION
15
16 #ifdef SVQC
17 SOUND(MLRSTurretAttack_FIRE, W_Sound("electro_fire"));
18 METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
19 {
20     bool isPlayer = IS_PLAYER(actor);
21     if (fire & 1)
22     if (!isPlayer || weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR(machinegun, sustained_refire))) {
23         if (isPlayer) {
24             turret_initparams(actor);
25             W_SetupShot_Dir(actor, v_forward, false, 0, SND_MLRSTurretAttack_FIRE, CH_WEAPON_B, 0);
26             actor.tur_shotdir_updated = w_shotdir;
27             actor.tur_shotorg = w_shotorg;
28             actor.tur_head = actor;
29             actor.shot_radius = 500;
30             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
31         }
32         turret_tag_fire_update();
33         entity missile = turret_projectile(SND_ROCKET_FIRE, 6, 10, DEATH_TURRET_MLRS.m_id, PROJECTILE_ROCKET, true, true);
34         missile.nextthink = time + max(actor.tur_impacttime,(actor.shot_radius * 2) / actor.shot_speed);
35         missile.missile_flags = MIF_SPLASH;
36         te_explosion (missile.origin);
37     }
38 }
39
40 #endif
41
42 #endif