]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/phaser.qc
Merge branch 'master' into terencehill/spectatee_status_update
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / phaser.qc
1 #include "phaser.qh"
2
3 #ifdef IMPLEMENTATION
4
5 #ifdef SVQC
6
7 spawnfunc(turret_phaser) { if (!turret_initialize(this, TUR_PHASER)) delete(this); }
8
9 .int fireflag;
10
11 METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
12 {
13     if (it.tur_head.frame != 0)
14     {
15         if (it.fireflag == 1)
16         {
17             if (it.tur_head.frame == 10)
18                 it.tur_head.frame = 1;
19             else
20                 it.tur_head.frame = it.tur_head.frame +1;
21         }
22         else if (it.fireflag == 2 )
23         {
24             it.tur_head.frame = it.tur_head.frame +1;
25             if (it.tur_head.frame == 15)
26             {
27                 it.tur_head.frame = 0;
28                 it.fireflag = 0;
29             }
30         }
31     }
32 }
33 bool turret_phaser_firecheck(entity this);
34 METHOD(PhaserTurret, tr_setup, void(PhaserTurret this, entity it))
35 {
36     it.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
37     it.aim_flags = TFL_AIM_LEAD;
38
39     it.turret_firecheckfunc = turret_phaser_firecheck;
40 }
41 bool turret_phaser_firecheck(entity this)
42 {
43     if (this.fireflag != 0) return false;
44     return turret_firecheck(this);
45 }
46
47 #endif
48 #endif