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 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);
48 //te_smallflash(self.origin);
49 if (other.takedamage == DAMAGE_AIM)
55 self.touch = SUB_Null;
56 setmodel (self, "models/plasma.mdl");
57 setsize (self, '0 0 0', '0 0 0');
61 self.think = SUB_Remove;
62 self.movetype = MOVETYPE_NONE;
63 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
64 SUB_SetFade(self, time, 1);
68 void W_Crylink_Touch2 (void)
70 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);
71 //te_smallflash(self.origin);
72 if (other.takedamage == DAMAGE_AIM)
78 self.touch = SUB_Null;
79 setmodel (self, "models/plasma.mdl");
80 setsize (self, '0 0 0', '0 0 0');
84 self.think = SUB_Remove;
85 self.movetype = MOVETYPE_NONE;
86 self.effects = EF_FULLBRIGHT | EF_LOWPRECISION;
87 SUB_SetFade(self, time, 1);
91 void W_Crylink_Attack (void)
93 local float counter, shots;
98 trueaim = W_TrueAim();
100 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
101 if (self.items & IT_STRENGTH) {
102 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
105 if (cvar("g_use_ammunition"))
106 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
107 self.punchangle_x = -2;
108 org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
111 shots = cvar("g_balance_crylink_primary_shots");
112 while (counter < shots)
115 proj.realowner = proj.owner = self;
116 proj.classname = "spike";
118 proj.movetype = MOVETYPE_BOUNCE;
119 proj.solid = SOLID_BBOX;
120 proj.gravity = 0.001;
122 setmodel (proj, "models/plasmatrail.mdl");
123 setsize (proj, '0 0 0', '0 0 0');
124 setorigin (proj, org);
126 proj.velocity = (normalize(trueaim - org) + randomvec() * cvar("g_balance_crylink_primary_spread")) * cvar("g_balance_crylink_primary_speed");
127 proj.touch = W_Crylink_Touch;
128 proj.think = SUB_Remove;
129 proj.nextthink = time + cvar("g_balance_crylink_primary_lifetime");
131 proj.angles = vectoangles (proj.velocity);
133 //proj.glow_size = 20;
135 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
136 proj.colormod = proj_color;
137 counter = counter + 1;
141 void W_Crylink_Attack2 (void)
143 local float counter, shots;
147 local vector trueaim;
148 trueaim = W_TrueAim();
150 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
151 if (self.items & IT_STRENGTH) {
152 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
155 if (cvar("g_use_ammunition"))
156 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_secondary_ammo");
157 self.punchangle_x = -2;
158 org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
161 shots = cvar("g_balance_crylink_secondary_shots");
162 while (counter < shots)
165 proj.realowner = proj.owner = self;
166 proj.classname = "spike";
168 proj.movetype = MOVETYPE_BOUNCE;
169 proj.solid = SOLID_BBOX;
170 proj.gravity = 0.001;
172 setmodel (proj, "models/plasmatrail.mdl");
173 setsize (proj, '0 0 0', '0 0 0');
174 setorigin (proj, org);
176 proj.velocity = (normalize(trueaim - org) + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread")) * cvar("g_balance_crylink_secondary_speed");
177 proj.touch = W_Crylink_Touch2;
178 proj.think = SUB_Remove;
179 proj.nextthink = time + cvar("g_balance_crylink_secondary_lifetime");
181 proj.angles = vectoangles (proj.velocity);
183 //proj.glow_size = 20;
185 proj.effects = EF_NOSHADOW | EF_FULLBRIGHT | EF_LOWPRECISION;
186 proj.colormod = proj_color;
187 counter = counter + 1;
193 void() crylink_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, crylink_ready_01); self.weaponentity.state = WS_READY;};
194 void() crylink_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
195 void() crylink_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
196 void() crylink_fire1_01 =
198 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack);
199 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);
201 void() crylink_fire2_01 =
203 weapon_doattack(crylink_check2, crylink_check2, W_Crylink_Attack2);
204 weapon_thinkf(WFRAME_FIRE2, cvar("g_balance_crylink_secondary_animtime"), crylink_ready_01);
208 // experimental lightning gun
209 void W_Crylink_Attack3 (void)
211 local vector org, dir;
213 local vector trueaim;
214 trueaim = W_TrueAim();
216 sound (self, CHAN_WEAPON, "weapons/crylink_fire.ogg", 1, ATTN_NORM);
217 if (self.items & IT_STRENGTH) {
218 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
221 if (cvar("g_use_ammunition"))
222 self.ammo_cells = self.ammo_cells - cvar("g_balance_crylink_primary_ammo");
223 //self.punchangle_x = -2;
224 org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14;
226 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
227 dir = normalize(trueaim - org);
228 traceline_hitcorpse(self, org, org + dir * 1000, FALSE, self);
231 te_plasmaburn(trace_endpos);
232 te_lightning2(self, org, trace_endpos);
234 if (trace_fraction < 1)
235 Damage(trace_ent, self, self, cvar("g_balance_crylink_primary_damage"), IT_CRYLINK, trace_endpos, '0 0 0');
237 void() crylink_fire1_01 =
239 weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack3);
241 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_fire1_01);
243 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_crylink_primary_animtime"), crylink_ready_01);