Merge branch 'Mirio/balance' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / plasma.qc
1 #include "plasma.qh"
2
3 #ifdef IMPLEMENTATION
4
5 #ifdef SVQC
6
7 spawnfunc(turret_plasma) { if (!turret_initialize(this, TUR_PLASMA)) delete(this); }
8
9 METHOD(PlasmaTurret, tr_attack, void(PlasmaTurret this, entity it))
10 {
11     if(g_instagib)
12     {
13         FireRailgunBullet (it, it.tur_shotorg, it.tur_shotorg + it.tur_shotdir_updated * max_shot_distance, 10000000000,
14                            800, 0, 0, 0, 0, DEATH_TURRET_PLASMA.m_id);
15
16         Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, it.tur_shotorg, it.tur_shotdir_updated * 1000, 1);
17
18         // teamcolor / hit beam effect
19         vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
20         WarpZone_TrailParticles(NULL, particleeffectnum(EFFECT_VAPORIZER(it.team)), it.tur_shotorg, v);
21     }
22     else
23     {
24         SUPER(PlasmaTurret).tr_attack(this, it);
25     }
26     if (it.tur_head.frame == 0)
27         it.tur_head.frame = 1;
28 }
29 METHOD(PlasmaTurret, tr_think, void(PlasmaTurret thistur, entity it))
30 {
31     if (it.tur_head.frame != 0)
32         it.tur_head.frame = it.tur_head.frame + 1;
33
34     if (it.tur_head.frame > 5)
35         it.tur_head.frame = 0;
36 }
37 METHOD(PlasmaTurret, tr_setup, void(PlasmaTurret this, entity it))
38 {
39     it.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
40     it.damage_flags |= TFL_DMG_HEADSHAKE;
41     it.firecheck_flags |= TFL_FIRECHECK_AFF;
42     it.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_SPLASH;
43
44     turret_do_updates(it);
45 }
46
47 #endif
48 #endif