]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_crylink.qc
renamed and moved all gamec/*.[ch] files to *.q[ch]
[divverent/nexuiz.git] / data / qcsrc / server / w_crylink.qc
1
2 .float gravity;
3 const vector proj_color = '1 1 1';
4
5 .entity realowner;
6 void W_Crylink_Touch (void)
7 {
8         if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
9         {
10                 remove(self);
11                 return;
12         }
13         RadiusDamage (self, self.realowner, cvar("g_balance_crylink_primary_damage"), cvar("g_balance_crylink_primary_edgedamage"), cvar("g_balance_crylink_primary_radius"), world, cvar("g_balance_crylink_primary_force"), IT_CRYLINK);
14         te_gunshotquad(self.origin);
15         remove (self);
16         /*
17         //te_smallflash(self.origin);
18         if (other.takedamage == DAMAGE_AIM)
19         {
20                 remove (self);
21                 return;
22         }
23         self.owner = world;
24         self.touch = SUB_Null;
25         setmodel (self, "models/plasma.mdl");
26         setsize (self, '0 0 0', '0 0 0');
27         self.gravity = 0;
28         self.glow_size = 0;
29         self.glow_color = 0;
30         self.think = SUB_Remove;
31         self.movetype = MOVETYPE_NONE;
32         self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
33         SUB_SetFade(self, time, 1);
34         //remove (self);
35         */
36 }
37
38 void W_Crylink_Touch2 (void)
39 {
40         if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
41         {
42                 remove(self);
43                 return;
44         }
45         RadiusDamage (self, self.realowner, cvar("g_balance_crylink_secondary_damage"), cvar("g_balance_crylink_secondary_edgedamage"), cvar("g_balance_crylink_secondary_radius"), world, cvar("g_balance_crylink_secondary_force"), IT_CRYLINK);
46         te_gunshotquad(self.origin);
47         remove (self);
48         /*
49         //te_smallflash(self.origin);
50         if (other.takedamage == DAMAGE_AIM)
51         {
52                 remove (self);
53                 return;
54         }
55         self.owner = world;
56         self.touch = SUB_Null;
57         setmodel (self, "models/plasma.mdl");
58         setsize (self, '0 0 0', '0 0 0');
59         self.gravity = 0;
60         self.glow_size = 0;
61         self.glow_color = 0;
62         self.think = SUB_Remove;
63         self.movetype = MOVETYPE_NONE;
64         self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
65         SUB_SetFade(self, time, 1);
66         //remove (self);
67         */
68 }
69
70 void W_Crylink_Attack (void)
71 {
72         local float counter, shots;
73         local entity proj;
74
75         if (cvar("g_use_ammunition"))
76                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
77
78         W_SetupShot (self, '15 8 -8', FALSE, 2, "weapons/crylink_fire.ogg");
79         te_smallflash(w_shotorg);
80
81         shots = cvar("g_balance_crylink_primary_shots");
82         while (counter < shots)
83         {
84                 proj = spawn ();
85                 proj.realowner = proj.owner = self;
86                 proj.classname = "spike";
87                 proj.bot_dodge = TRUE;
88                 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
89
90                 proj.movetype = MOVETYPE_BOUNCE;
91                 proj.solid = SOLID_BBOX;
92                 proj.gravity = 0.001;
93
94                 setmodel (proj, "models/plasmatrail.mdl");
95                 setsize (proj, '0 0 0', '0 0 0');
96                 setorigin (proj, w_shotorg);
97
98                 proj.velocity = (w_shotdir + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
99                 proj.touch = W_Crylink_Touch;
100                 proj.think = SUB_Remove;
101                 proj.nextthink = time + cvar("g_balance_crylink_primary_lifetime");
102
103                 proj.angles = vectoangles (proj.velocity);
104
105                 //proj.glow_size = 20;
106
107                 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
108                 proj.flags = FL_PROJECTILE;
109                 proj.colormod = proj_color;
110                 counter = counter + 1;
111         }
112 }
113
114 void W_Crylink_Attack2 (void)
115 {
116         local float counter, shots;
117         local entity proj;
118
119         if (cvar("g_use_ammunition"))
120                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
121
122         W_SetupShot (self, '15 8 -8', FALSE, 2, "weapons/crylink_fire.ogg");
123         te_smallflash(w_shotorg);
124
125         shots = cvar("g_balance_crylink_secondary_shots");
126         while (counter < shots)
127         {
128                 proj = spawn ();
129                 proj.realowner = proj.owner = self;
130                 proj.classname = "spike";
131                 proj.bot_dodge = TRUE;
132                 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
133
134                 proj.movetype = MOVETYPE_BOUNCE;
135                 proj.solid = SOLID_BBOX;
136                 proj.gravity = 0.001;
137
138                 setmodel (proj, "models/plasmatrail.mdl");
139                 setsize (proj, '0 0 0', '0 0 0');
140                 setorigin (proj, w_shotorg);
141
142                 proj.velocity = (w_shotdir + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
143                 proj.touch = W_Crylink_Touch2;
144                 proj.think = SUB_Remove;
145                 proj.nextthink = time + cvar("g_balance_crylink_secondary_lifetime");
146
147                 proj.angles = vectoangles (proj.velocity);
148
149                 //proj.glow_size = 20;
150
151                 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
152                 proj.flags = FL_PROJECTILE;
153                 proj.colormod = proj_color;
154                 counter = counter + 1;
155         }
156 }
157
158
159 /*
160 // experimental lightning gun
161 void W_Crylink_Attack3 (void)
162 {
163         if (cvar("g_use_ammunition"))
164                 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
165         //W_SetupShot(self, '10 5 -14', TRUE, 0, "weapons/crylink_fire.ogg");
166         W_SetupShot (self, '15 7 -8', TRUE, 0, "weapons/crylink_fire.ogg");
167
168         // use traceline_hitcorpse to make sure it can hit gibs and corpses too
169         traceline_hitcorpse(self, w_shotorg, w_shotorg + w_shotdir * 1000, FALSE, self);
170
171         te_smallflash(w_shotorg);
172         te_plasmaburn(trace_endpos);
173         te_lightning2(self, w_shotorg, trace_endpos);
174
175         if (trace_fraction < 1)
176                 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), IT_CRYLINK, trace_endpos, '0 0 0');
177 }
178 */
179
180 float(float req) w_crylink =
181 {
182         if (req == WR_AIM)
183                 self.button0 = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_lifetime"), FALSE);
184         else if (req == WR_THINK)
185         {
186                 if (self.button0)
187                 if (weapon_prepareattack(0, cvar("g_balance_crylink_primary_refire")))
188                 {
189                         W_Crylink_Attack();
190                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), w_ready);
191                 }
192                 if (self.button3)
193                 if (weapon_prepareattack(1, cvar("g_balance_crylink_secondary_refire")))
194                 {
195                         W_Crylink_Attack2();
196                         weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), w_ready);
197                 }
198         }
199         else if (req == WR_SETUP)
200                 weapon_setup(WEP_CRYLINK, "crylink", IT_CELLS);
201         else if (req == WR_CHECKAMMO1)
202                 return self.ammo_cells >= cvar("g_balance_crylink_primary_ammo");
203         else if (req == WR_CHECKAMMO2)
204                 return self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo");
205         return TRUE;
206 };