1 #ifndef TURRET_MLRS_WEAPON_H
2 #define TURRET_MLRS_WEAPON_H
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, message, string, _("MLRS"));
9 ENDCLASS(MLRSTurretAttack)
10 REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
18 METHOD(MLRSTurretAttack, wr_think, void(entity thiswep, entity actor, bool fire1, bool fire2))
20 bool isPlayer = IS_PLAYER(actor);
22 if (!isPlayer || weapon_prepareattack(thiswep, actor, false, WEP_CVAR(machinegun, sustained_refire))) {
24 turret_initparams(actor);
25 W_SetupShot_Dir(actor, v_forward, false, 0, W_Sound("electro_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, WFRAME_FIRE1, 0, w_ready);
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);