1 #ifndef TUR_PLASMA_DUAL_H
2 #define TUR_PLASMA_DUAL_H
4 CLASS(DualPlasmaTurret, Turret)
5 /* spawnflags */ ATTRIB(DualPlasmaTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
6 /* mins */ ATTRIB(DualPlasmaTurret, mins, vector, '-32 -32 0');
7 /* maxs */ ATTRIB(DualPlasmaTurret, maxs, vector, '32 32 64');
8 /* modelname */ ATTRIB(DualPlasmaTurret, mdl, string, "base.md3");
9 /* model */ ATTRIB(DualPlasmaTurret, model, string, strzone(strcat("models/turrets/", this.mdl)));
10 /* head_model */ ATTRIB(DualPlasmaTurret, head_model, string, strzone(strcat("models/turrets/", "plasmad.md3")));
11 /* netname */ ATTRIB(DualPlasmaTurret, netname, string, "plasma_dual");
12 /* fullname */ ATTRIB(DualPlasmaTurret, turret_name, string, _("Dual Plasma Cannon"));
13 ENDCLASS(DualPlasmaTurret)
15 REGISTER_TURRET(PLASMA_DUAL, NEW(DualPlasmaTurret));
17 #include "../../weapons/all.qh"
19 CLASS(PlasmaDualAttack, PortoLaunch)
20 /* flags */ ATTRIB(PlasmaDualAttack, spawnflags, int, WEP_TYPE_OTHER);
21 /* impulse */ ATTRIB(PlasmaDualAttack, impulse, int, 5);
22 /* refname */ ATTRIB(PlasmaDualAttack, netname, string, "turret_plasmadual");
23 /* wepname */ ATTRIB(PlasmaDualAttack, message, string, _("Dual plasma"));
24 ENDCLASS(PlasmaDualAttack)
25 REGISTER_WEAPON(PLASMA_DUAL, NEW(PlasmaDualAttack));
33 void turret_initparams(entity tur);
34 METHOD(PlasmaDualAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
36 bool isPlayer = IS_PLAYER(self);
38 if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
40 turret_initparams(self);
41 W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
42 self.tur_shotdir_updated = w_shotdir;
43 self.tur_shotorg = w_shotorg;
45 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
47 entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, true, true);
48 missile.missile_flags = MIF_SPLASH;
49 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
54 void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL.m_id)) remove(self); }
56 METHOD(DualPlasmaTurret, tr_attack, void(DualPlasmaTurret thistur))
59 FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
60 800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
63 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
65 // teamcolor / hit beam effect
66 vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
67 WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
69 Weapon wep = WEP_PLASMA_DUAL;
70 wep.wr_think(wep, true, false);
72 self.tur_head.frame += 1;
74 METHOD(DualPlasmaTurret, tr_think, bool(DualPlasmaTurret thistur))
76 if ((self.tur_head.frame != 0) && (self.tur_head.frame != 3))
77 self.tur_head.frame = self.tur_head.frame + 1;
79 if (self.tur_head.frame > 6)
80 self.tur_head.frame = 0;
84 METHOD(DualPlasmaTurret, tr_death, bool(DualPlasmaTurret thistur))
88 METHOD(DualPlasmaTurret, tr_setup, bool(DualPlasmaTurret thistur))
90 self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
91 self.damage_flags |= TFL_DMG_HEADSHAKE;
92 self.firecheck_flags |= TFL_FIRECHECK_AFF;
93 self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_SPLASH;
95 turret_do_updates(self);
99 METHOD(DualPlasmaTurret, tr_precache, bool(DualPlasmaTurret thistur))
106 METHOD(DualPlasmaTurret, tr_setup, bool(DualPlasmaTurret thistur))
110 METHOD(DualPlasmaTurret, tr_precache, bool(DualPlasmaTurret thistur))
116 #endif // REGISTER_TURRET