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