1 void() crylink_ready_01;
2 void() crylink_fire1_01;
3 void() crylink_fire2_01;
4 void() crylink_deselect_01;
5 void() crylink_select_01;
8 const vector proj_color = '1 1 1';
10 float() crylink_check =
12 if (self.ammo_cells >= cvar("g_balance_crylink_primary_ammo"))
17 float() crylink_check2 =
19 if (self.ammo_cells >= cvar("g_balance_crylink_secondary_ammo"))
24 void(float req) w_crylink =
28 else if (req == WR_AIM)
29 self.button0 = bot_aim(cvar("g_balance_crylink_primary_speed"), 0, cvar("g_balance_crylink_primary_lifetime"), FALSE);
30 else if (req == WR_FIRE1)
31 weapon_prepareattack(crylink_check, crylink_check, crylink_fire1_01, cvar("g_balance_crylink_primary_refire"));
32 else if (req == WR_FIRE2)
33 weapon_prepareattack(crylink_check2, crylink_check2, crylink_fire2_01, cvar("g_balance_crylink_secondary_refire"));
34 else if (req == WR_RAISE)
36 else if (req == WR_UPDATECOUNTS)
37 self.currentammo = self.ammo_cells;
38 else if (req == WR_DROP)
39 crylink_deselect_01();
40 else if (req == WR_SETUP)
41 weapon_setup(WEP_CRYLINK, "w_crylink.zym", IT_CELLS);
42 else if (req == WR_CHECKAMMO)
43 weapon_hasammo = crylink_check() + crylink_check2();
47 void W_Crylink_Touch (void)
49 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
54 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);
55 te_gunshotquad(self.origin);
58 //te_smallflash(self.origin);
59 if (other.takedamage == DAMAGE_AIM)
65 self.touch = SUB_Null;
66 setmodel (self, "models/plasma.mdl");
67 setsize (self, '0 0 0', '0 0 0');
71 self.think = SUB_Remove;
72 self.movetype = MOVETYPE_NONE;
73 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
74 SUB_SetFade(self, time, 1);
79 void W_Crylink_Touch2 (void)
81 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
86 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);
87 te_gunshotquad(self.origin);
90 //te_smallflash(self.origin);
91 if (other.takedamage == DAMAGE_AIM)
97 self.touch = SUB_Null;
98 setmodel (self, "models/plasma.mdl");
99 setsize (self, '0 0 0', '0 0 0');
103 self.think = SUB_Remove;
104 self.movetype = MOVETYPE_NONE;
105 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
106 SUB_SetFade(self, time, 1);
111 void W_Crylink_Attack (void)
113 local float counter, shots;
117 local vector trueaim;
118 trueaim = W_TrueAim();
120 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
121 if (self.items & IT_STRENGTH)
122 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
124 if (cvar("g_use_ammunition"))
125 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
126 self.punchangle_x = -2;
128 org = W_MuzzleOrigin (self, '24 7 -8');
131 shots = cvar("g_balance_crylink_primary_shots");
132 while (counter < shots)
135 proj.realowner = proj.owner = self;
136 proj.classname = "spike";
137 proj.bot_dodge = TRUE;
138 proj.bot_dodgerating = cvar("g_balance_crylink_primary_damage");
140 proj.movetype = MOVETYPE_BOUNCE;
141 proj.solid = SOLID_BBOX;
142 proj.gravity = 0.001;
144 setmodel (proj, "models/plasmatrail.mdl");
145 setsize (proj, '0 0 0', '0 0 0');
146 setorigin (proj, org);
148 proj.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
149 proj.touch = W_Crylink_Touch;
150 proj.think = SUB_Remove;
151 proj.nextthink = time + cvar("g_balance_crylink_primary_lifetime");
153 proj.angles = vectoangles (proj.velocity);
155 //proj.glow_size = 20;
157 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
158 proj.flags = FL_PROJECTILE;
159 proj.colormod = proj_color;
160 counter = counter + 1;
164 void W_Crylink_Attack2 (void)
166 local float counter, shots;
170 local vector trueaim;
171 trueaim = W_TrueAim();
173 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
174 if (self.items & IT_STRENGTH)
175 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
177 if (cvar("g_use_ammunition"))
178 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
179 self.punchangle_x = -2;
181 org = W_MuzzleOrigin (self, '20 7 -8');
184 shots = cvar("g_balance_crylink_secondary_shots");
185 while (counter < shots)
188 proj.realowner = proj.owner = self;
189 proj.classname = "spike";
190 proj.bot_dodge = TRUE;
191 proj.bot_dodgerating = cvar("g_balance_crylink_secondary_damage");
193 proj.movetype = MOVETYPE_BOUNCE;
194 proj.solid = SOLID_BBOX;
195 proj.gravity = 0.001;
197 setmodel (proj, "models/plasmatrail.mdl");
198 setsize (proj, '0 0 0', '0 0 0');
199 setorigin (proj, org);
201 proj.velocity = (normalize(trueaim - org) + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
202 proj.touch = W_Crylink_Touch2;
203 proj.think = SUB_Remove;
204 proj.nextthink = time + cvar("g_balance_crylink_secondary_lifetime");
206 proj.angles = vectoangles (proj.velocity);
208 //proj.glow_size = 20;
210 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
211 proj.flags = FL_PROJECTILE;
212 proj.colormod = proj_color;
213 counter = counter + 1;
219 void() crylink_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, crylink_ready_01); self.weaponentity.state = WS_READY;};
220 void() crylink_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
221 void() crylink_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
222 void() crylink_fire1_01 =
224 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack);
225 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);
227 void() crylink_fire2_01 =
229 weapon_doattack(crylink_check2, crylink_check2, W_Crylink_Attack2);
230 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), crylink_ready_01);
234 // experimental lightning gun
235 void W_Crylink_Attack3 (void)
237 local vector org, dir;
239 local vector trueaim;
240 trueaim = W_TrueAim();
242 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
243 if (self.items & IT_STRENGTH) {
244 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
247 if (cvar("g_use_ammunition"))
248 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
249 //self.punchangle_x = -2;
250 org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
252 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
253 dir = normalize(trueaim - org);
254 traceline_hitcorpse(self, org, org + dir * 1000, FALSE, self);
257 te_plasmaburn(trace_endpos);
258 te_lightning2(self, org, trace_endpos);
260 if (trace_fraction < 1)
261 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), IT_CRYLINK, trace_endpos, '0 0 0');
263 void() crylink_fire1_01 =
265 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack3);
267 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_fire1_01);
269 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);