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_FIRE1)
29 weapon_prepareattack(crylink_check, crylink_check, crylink_fire1_01, cvar("g_balance_crylink_primary_refire"));
30 else if (req == WR_FIRE2)
31 weapon_prepareattack(crylink_check2, crylink_check2, crylink_fire2_01, cvar("g_balance_crylink_secondary_refire"));
32 else if (req == WR_RAISE)
34 else if (req == WR_UPDATECOUNTS)
35 self.currentammo = self.ammo_cells;
36 else if (req == WR_DROP)
37 crylink_deselect_01();
38 else if (req == WR_SETUP)
39 weapon_setup(WEP_CRYLINK, "w_crylink.zym", IT_CELLS);
40 else if (req == WR_CHECKAMMO)
41 weapon_hasammo = crylink_check() + crylink_check2();
45 void W_Crylink_Touch (void)
47 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
52 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);
53 //te_smallflash(self.origin);
54 if (other.takedamage == DAMAGE_AIM)
60 self.touch = SUB_Null;
61 setmodel (self, "models/plasma.mdl");
62 setsize (self, '0 0 0', '0 0 0');
66 self.think = SUB_Remove;
67 self.movetype = MOVETYPE_NONE;
68 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
69 SUB_SetFade(self, time, 1);
73 void W_Crylink_Touch2 (void)
75 if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
80 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);
81 //te_smallflash(self.origin);
82 if (other.takedamage == DAMAGE_AIM)
88 self.touch = SUB_Null;
89 setmodel (self, "models/plasma.mdl");
90 setsize (self, '0 0 0', '0 0 0');
94 self.think = SUB_Remove;
95 self.movetype = MOVETYPE_NONE;
96 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
97 SUB_SetFade(self, time, 1);
101 void W_Crylink_Attack (void)
103 local float counter, shots;
107 local vector trueaim;
108 trueaim = W_TrueAim();
110 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
111 if (self.items & IT_STRENGTH)
112 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
114 if (cvar("g_use_ammunition"))
115 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
116 self.punchangle_x = -2;
118 org = W_MuzzleOrigin (self, '24 7 -8');
121 shots = cvar("g_balance_crylink_primary_shots");
122 while (counter < shots)
125 proj.realowner = proj.owner = self;
126 proj.classname = "spike";
128 proj.movetype = MOVETYPE_BOUNCE;
129 proj.solid = SOLID_BBOX;
130 proj.gravity = 0.001;
132 setmodel (proj, "models/plasmatrail.mdl");
133 setsize (proj, '0 0 0', '0 0 0');
134 setorigin (proj, org);
136 proj.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
137 proj.touch = W_Crylink_Touch;
138 proj.think = SUB_Remove;
139 proj.nextthink = time + cvar("g_balance_crylink_primary_lifetime");
141 proj.angles = vectoangles (proj.velocity);
143 //proj.glow_size = 20;
145 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
146 proj.colormod = proj_color;
147 counter = counter + 1;
151 void W_Crylink_Attack2 (void)
153 local float counter, shots;
157 local vector trueaim;
158 trueaim = W_TrueAim();
160 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
161 if (self.items & IT_STRENGTH)
162 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
164 if (cvar("g_use_ammunition"))
165 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
166 self.punchangle_x = -2;
168 org = W_MuzzleOrigin (self, '20 7 -8');
171 shots = cvar("g_balance_crylink_secondary_shots");
172 while (counter < shots)
175 proj.realowner = proj.owner = self;
176 proj.classname = "spike";
178 proj.movetype = MOVETYPE_BOUNCE;
179 proj.solid = SOLID_BBOX;
180 proj.gravity = 0.001;
182 setmodel (proj, "models/plasmatrail.mdl");
183 setsize (proj, '0 0 0', '0 0 0');
184 setorigin (proj, org);
186 proj.velocity = (normalize(trueaim - org) + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
187 proj.touch = W_Crylink_Touch2;
188 proj.think = SUB_Remove;
189 proj.nextthink = time + cvar("g_balance_crylink_secondary_lifetime");
191 proj.angles = vectoangles (proj.velocity);
193 //proj.glow_size = 20;
195 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
196 proj.colormod = proj_color;
197 counter = counter + 1;
203 void() crylink_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, crylink_ready_01); self.weaponentity.state = WS_READY;};
204 void() crylink_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
205 void() crylink_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
206 void() crylink_fire1_01 =
208 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack);
209 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);
211 void() crylink_fire2_01 =
213 weapon_doattack(crylink_check2, crylink_check2, W_Crylink_Attack2);
214 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), crylink_ready_01);
218 // experimental lightning gun
219 void W_Crylink_Attack3 (void)
221 local vector org, dir;
223 local vector trueaim;
224 trueaim = W_TrueAim();
226 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
227 if (self.items & IT_STRENGTH) {
228 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
231 if (cvar("g_use_ammunition"))
232 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
233 //self.punchangle_x = -2;
234 org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
236 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
237 dir = normalize(trueaim - org);
238 traceline_hitcorpse(self, org, org + dir * 1000, FALSE, self);
241 te_plasmaburn(trace_endpos);
242 te_lightning2(self, org, trace_endpos);
244 if (trace_fraction < 1)
245 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), IT_CRYLINK, trace_endpos, '0 0 0');
247 void() crylink_fire1_01 =
249 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack3);
251 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_fire1_01);
253 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);