]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/phaser.qc
Merge branch 'master' into Mirio/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser.qc
1 #ifndef TURRET_PHASER_H
2 #define TURRET_PHASER_H
3
4 #include "phaser_weapon.qh"
5
6 CLASS(PhaserTurret, Turret)
7 /* spawnflags */ ATTRIB(PhaserTurret, spawnflags, int, TUR_FLAG_SNIPER | TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER);
8 /* mins       */ ATTRIB(PhaserTurret, mins, vector, '-32 -32 0');
9 /* maxs       */ ATTRIB(PhaserTurret, maxs, vector, '32 32 64');
10 /* modelname  */ ATTRIB(PhaserTurret, mdl, string, "base.md3");
11 /* model      */ ATTRIB_STRZONE(PhaserTurret, model, string, strcat("models/turrets/", this.mdl));
12 /* head_model */ ATTRIB_STRZONE(PhaserTurret, head_model, string, strcat("models/turrets/", "phaser.md3"));
13 /* netname    */ ATTRIB(PhaserTurret, netname, string, "phaser");
14 /* fullname   */ ATTRIB(PhaserTurret, turret_name, string, _("Phaser Cannon"));
15     ATTRIB(PhaserTurret, m_weapon, Weapon, WEP_PHASER);
16 ENDCLASS(PhaserTurret)
17 REGISTER_TURRET(PHASER, NEW(PhaserTurret));
18
19 #endif
20
21 #ifdef IMPLEMENTATION
22
23 #ifdef SVQC
24
25 spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); }
26
27 .int fireflag;
28
29 METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
30 {
31     SELFPARAM();
32     if (self.tur_head.frame != 0)
33     {
34         if (self.fireflag == 1)
35         {
36             if (self.tur_head.frame == 10)
37                 self.tur_head.frame = 1;
38             else
39                 self.tur_head.frame = self.tur_head.frame +1;
40         }
41         else if (self.fireflag == 2 )
42         {
43             self.tur_head.frame = self.tur_head.frame +1;
44             if (self.tur_head.frame == 15)
45             {
46                 self.tur_head.frame = 0;
47                 self.fireflag = 0;
48             }
49         }
50     }
51 }
52 float turret_phaser_firecheck();
53 METHOD(PhaserTurret, tr_setup, void(PhaserTurret this, entity it))
54 {
55     it.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
56     it.aim_flags = TFL_AIM_LEAD;
57
58     it.turret_firecheckfunc = turret_phaser_firecheck;
59 }
60 float turret_phaser_firecheck()
61 {
62     SELFPARAM();
63     if (self.fireflag != 0) return 0;
64     return turret_firecheck();
65 }
66
67 #endif
68 #endif