]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/turret/plasma.qc
Turrets: upgrade plasma
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / turret / plasma.qc
1 #ifndef TUR_PLASMA_H
2 #define TUR_PLASMA_H
3
4 CLASS(PlasmaTurret, Turret)
5 /* spawnflags */ ATTRIB(PlasmaTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
6 /* mins       */ ATTRIB(PlasmaTurret, mins, vector, '-32 -32 0');
7 /* maxs       */ ATTRIB(PlasmaTurret, maxs, vector, '32 32 64');
8 /* modelname  */ ATTRIB(PlasmaTurret, mdl, string, "base.md3");
9 /* model      */ ATTRIB(PlasmaTurret, model, string, strzone(strcat("models/turrets/", this.mdl)));
10 /* head_model */ ATTRIB(PlasmaTurret, head_model, string, strzone(strcat("models/turrets/", "plasma.md3")));
11 /* netname    */ ATTRIB(PlasmaTurret, netname, string, "plasma");
12 /* fullname   */ ATTRIB(PlasmaTurret, turret_name, string, _("Plasma Cannon"));
13 ENDCLASS(PlasmaTurret)
14
15 REGISTER_TURRET(PLASMA, NEW(PlasmaTurret));
16
17 #endif
18
19 #ifdef IMPLEMENTATION
20 #ifdef SVQC
21 void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA.m_id)) remove(self); }
22
23         METHOD(PlasmaTurret, tr_attack, bool(PlasmaTurret thistur))
24         {
25             if(g_instagib)
26             {
27                 float flying;
28                 flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
29
30                 FireRailgunBullet (self.tur_shotorg, self.tur_shotorg + self.tur_shotdir_updated * MAX_SHOT_DISTANCE, 10000000000,
31                                    800, 0, 0, 0, 0, DEATH_TURRET_PLASMA);
32
33                 Send_Effect(EFFECT_VORTEX_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
34
35                 // teamcolor / hit beam effect
36                 vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
37                 WarpZone_TrailParticles(world, particleeffectnum(EFFECT_VAPORIZER(self.team)), self.tur_shotorg, v);
38                 if (self.tur_head.frame == 0)
39                     self.tur_head.frame = 1;
40             }
41             else
42             {
43                 entity missile = turret_projectile(SND(HAGAR_FIRE), 1, 0, DEATH_TURRET_PLASMA, PROJECTILE_ELECTRO_BEAM, TRUE, TRUE);
44                 missile.missile_flags = MIF_SPLASH;
45
46                 Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
47                 if (self.tur_head.frame == 0)
48                     self.tur_head.frame = 1;
49             }
50
51             return true;
52         }
53         METHOD(PlasmaTurret, tr_think, bool(PlasmaTurret thistur))
54         {
55             if (self.tur_head.frame != 0)
56                 self.tur_head.frame = self.tur_head.frame + 1;
57
58             if (self.tur_head.frame > 5)
59                 self.tur_head.frame = 0;
60
61             return true;
62         }
63         METHOD(PlasmaTurret, tr_death, bool(PlasmaTurret thistur))
64         {
65             return true;
66         }
67         METHOD(PlasmaTurret, tr_setup, bool(PlasmaTurret thistur))
68         {
69             self.ammo_flags = TFL_AMMO_ENERGY | TFL_AMMO_RECHARGE | TFL_AMMO_RECIEVE;
70             self.damage_flags |= TFL_DMG_HEADSHAKE;
71             self.firecheck_flags |= TFL_FIRECHECK_AFF;
72             self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE | TFL_AIM_SPLASH;
73
74             turret_do_updates(self);
75
76             return true;
77         }
78         METHOD(PlasmaTurret, tr_precache, bool(PlasmaTurret thistur))
79         {
80             return true;
81         }
82
83 #endif // SVQC
84 #ifdef CSQC
85         METHOD(PlasmaTurret, tr_setup, bool(PlasmaTurret thistur))
86         {
87             return true;
88         }
89         METHOD(PlasmaTurret, tr_precache, bool(PlasmaTurret thistur))
90         {
91             return true;
92         }
93
94 #endif // CSQC
95 #endif // REGISTER_TURRET