Weapons: hide from menu
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / walker_weapon.qc
1 #ifndef TURRET_WALKER_WEAPON_H
2 #define TURRET_WALKER_WEAPON_H
3
4 CLASS(WalkerTurretAttack, PortoLaunch)
5 /* flags     */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN);
6 /* impulse   */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
7 /* refname   */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
8 /* wepname   */ ATTRIB(WalkerTurretAttack, message, string, _("Walker"));
9 ENDCLASS(WalkerTurretAttack)
10 REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
11
12 #endif
13
14 #ifdef IMPLEMENTATION
15
16 #ifdef SVQC
17
18 METHOD(WalkerTurretAttack, wr_think, bool(entity thiswep, bool fire1, bool fire2)) {
19     SELFPARAM();
20     bool isPlayer = IS_PLAYER(self);
21     if (fire1)
22     if (!isPlayer || weapon_prepareattack(false, WEP_CVAR_PRI(electro, refire))) {
23         if (isPlayer) {
24             turret_initparams(self);
25             W_SetupShot_Dir(self, v_forward, false, 0, W_Sound("electro_fire"), CH_WEAPON_B, 0);
26             self.tur_shotdir_updated = w_shotdir;
27             self.tur_shotorg = w_shotorg;
28             self.tur_head = self;
29             weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
30         }
31         sound (self, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
32         fireBullet (self.tur_shotorg, self.tur_shotdir_updated, self.shot_spread, 0, self.shot_dmg, self.shot_force, DEATH_TURRET_WALK_GUN, 0);
33         Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
34     }
35     return true;
36 }
37
38 #endif
39
40 #endif