1 #ifndef TUR_MACHINEGUN_H
2 #define TUR_MACHINEGUN_H
4 CLASS(MachineGunTurretAttack, PortoLaunch)
5 /* flags */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER);
6 /* impulse */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
7 /* refname */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
8 /* wepname */ ATTRIB(MachineGunTurretAttack, message, string, _("Machinegun"));
9 ENDCLASS(MachineGunTurretAttack)
10 REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
12 CLASS(MachineGunTurret, Turret)
13 /* spawnflags */ ATTRIB(MachineGunTurret, spawnflags, int, TUR_FLAG_PLAYER);
14 /* mins */ ATTRIB(MachineGunTurret, mins, vector, '-32 -32 0');
15 /* maxs */ ATTRIB(MachineGunTurret, maxs, vector, '32 32 64');
16 /* modelname */ ATTRIB(MachineGunTurret, mdl, string, "base.md3");
17 /* model */ ATTRIB(MachineGunTurret, model, string, strzone(strcat("models/turrets/", this.mdl)));
18 /* head_model */ ATTRIB(MachineGunTurret, head_model, string, strzone(strcat("models/turrets/", "machinegun.md3")));
19 /* netname */ ATTRIB(MachineGunTurret, netname, string, "machinegun");
20 /* fullname */ ATTRIB(MachineGunTurret, turret_name, string, _("Machinegun Turret"));
21 ATTRIB(MachineGunTurret, m_weapon, Weapon, WEP_TUR_MACHINEGUN);
22 ENDCLASS(MachineGunTurret)
23 REGISTER_TURRET(MACHINEGUN, NEW(MachineGunTurret));
29 void W_MachineGun_MuzzleFlash();
31 METHOD(MachineGunTurretAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
33 bool isPlayer = IS_PLAYER(self);
35 if (!isPlayer || weapon_prepareattack(false, WEP_CVAR(machinegun, sustained_refire))) {
37 turret_initparams(self);
38 W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
39 self.tur_shotdir_updated = w_shotdir;
40 self.tur_shotorg = w_shotorg;
42 weapon_thinkf(WFRAME_FIRE1, 0, w_ready);
44 fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_MACHINEGUN, 0);
45 W_MachineGun_MuzzleFlash();
46 setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
51 void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
53 METHOD(MachineGunTurret, tr_setup, void(MachineGunTurret this, entity it))
55 it.damage_flags |= TFL_DMG_HEADSHAKE;
56 it.target_select_flags = TFL_TARGETSELECT_PLAYERS | TFL_TARGETSELECT_RANGELIMITS | TFL_TARGETSELECT_TEAMCHECK;
57 it.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
58 it.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
59 it.turret_flags |= TUR_FLAG_HITSCAN;