Merge branch 'Mirio/balance' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / vaporizer.qc
1 #include "vaporizer.qh"
2 #ifndef IMPLEMENTATION
3 CLASS(Vaporizer, Weapon)
4 /* ammotype  */ ATTRIB(Vaporizer, ammo_field, .int, ammo_cells);
5 /* impulse   */ ATTRIB(Vaporizer, impulse, int, 7);
6 /* flags     */ ATTRIB(Vaporizer, spawnflags, int, WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_FLAG_SUPERWEAPON | WEP_TYPE_HITSCAN);
7 /* rating    */ ATTRIB(Vaporizer, bot_pickupbasevalue, float, BOT_PICKUP_RATING_HIGH);
8 /* color     */ ATTRIB(Vaporizer, wpcolor, vector, '0.5 1 1');
9 /* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
10 #ifdef GAMEQC
11 /* model     */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
12 #endif
13 /* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
14 /* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
15 /* wepimg    */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
16 /* refname   */ ATTRIB(Vaporizer, netname, string, "vaporizer");
17 /* wepname   */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
18
19 #define X(BEGIN, P, END, class, prefix) \
20         BEGIN(class) \
21                 P(class, prefix, ammo, float, PRI) \
22         P(class, prefix, animtime, float, PRI) \
23         P(class, prefix, damage, float, PRI) \
24         P(class, prefix, refire, float, PRI) \
25         P(class, prefix, ammo, float, SEC) \
26         P(class, prefix, animtime, float, SEC) \
27         P(class, prefix, damage, float, SEC) \
28         P(class, prefix, delay, float, SEC) \
29         P(class, prefix, edgedamage, float, SEC) \
30         P(class, prefix, force, float, SEC) \
31         P(class, prefix, lifetime, float, SEC) \
32         P(class, prefix, radius, float, SEC) \
33         P(class, prefix, refire, float, SEC) \
34         P(class, prefix, shotangle, float, SEC) \
35         P(class, prefix, speed, float, SEC) \
36         P(class, prefix, spread, float, SEC) \
37         P(class, prefix, reload_ammo, float, NONE) \
38         P(class, prefix, reload_time, float, NONE) \
39         P(class, prefix, switchdelay_raise, float, NONE) \
40         P(class, prefix, switchdelay_drop, float, NONE) \
41         P(class, prefix, weaponreplace, string, NONE) \
42         P(class, prefix, weaponstart, float, NONE) \
43         P(class, prefix, weaponstartoverride, float, NONE) \
44         P(class, prefix, weaponthrowable, float, NONE) \
45         END()
46     W_PROPS(X, Vaporizer, vaporizer)
47 #undef X
48
49 ENDCLASS(Vaporizer)
50 REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
51
52
53 #ifdef SVQC
54 .float vaporizer_lasthit;
55 .float jump_interval;
56 .float jump_interval2;
57 .bool held_down;
58 .float rm_force;
59 .float rm_damage;
60 .float rm_edmg;
61 #endif
62 #endif
63 #ifdef IMPLEMENTATION
64
65 REGISTER_NET_TEMP(TE_CSQC_VAPORBEAMPARTICLE)
66
67 #if defined(SVQC)
68 void SendCSQCVaporizerBeamParticle(entity player, int hit) {
69         vector v;
70         v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
71         WriteHeader(MSG_BROADCAST, TE_CSQC_VAPORBEAMPARTICLE);
72         WriteCoord(MSG_BROADCAST, w_shotorg.x);
73         WriteCoord(MSG_BROADCAST, w_shotorg.y);
74         WriteCoord(MSG_BROADCAST, w_shotorg.z);
75         WriteCoord(MSG_BROADCAST, v.x);
76         WriteCoord(MSG_BROADCAST, v.y);
77         WriteCoord(MSG_BROADCAST, v.z);
78         WriteByte(MSG_BROADCAST, hit);
79         WriteByte(MSG_BROADCAST, etof(player));
80         WriteByte(MSG_BROADCAST, player.team);
81 }
82 #elif defined(CSQC)
83 bool autocvar_cl_vaporizerbeam_particle = false;
84 float autocvar_cl_vaporizerbeam_lifetime = 0.8;
85 float autocvar_cl_vaporizerbeam_colorboost = 0.7;
86
87 string Draw_VaporizerBeam_trace_callback_tex;
88 float Draw_VaporizerBeam_trace_callback_rnd;
89 vector Draw_VaporizerBeam_trace_callback_rgb;
90 float Draw_VaporizerBeam_trace_callback_a;
91 void Draw_VaporizerBeam_trace_callback(vector start, vector hit, vector end)
92 {
93         float i;
94         vector vorg;
95         vorg = WarpZone_TransformOrigin(WarpZone_trace_transform, view_origin);
96         for(i = 0; i < Draw_VaporizerBeam_trace_callback_a; ++i)
97                 Draw_CylindricLine(hit, start, 8, Draw_VaporizerBeam_trace_callback_tex, 0.25, Draw_VaporizerBeam_trace_callback_rnd, Draw_VaporizerBeam_trace_callback_rgb, min(1, Draw_VaporizerBeam_trace_callback_a - i), DRAWFLAG_NORMAL, vorg);
98         Draw_VaporizerBeam_trace_callback_rnd += 0.25 * vlen(hit - start) / 8;
99 }
100
101 .vector vorg1, vorg2;
102 .float spawn_time;
103 void VaporizerBeam_Draw(entity this)
104 {
105         //draw either the old v2.3 beam or the new beam
106         particles_alphamin = particles_alphamax = particles_fade = 1;
107
108         string tex = "particles/lgbeam";
109         if(this.cnt)
110                 tex = "particles/gauntletbeam";
111         vector rgb;
112         //entity e = CSQCModel_server2csqc(this.sv_entnum - 1);
113         //if (e == NULL)
114         //{
115                 rgb = colormapPaletteColor(entcs_GetClientColors(this.sv_entnum - 1) & 0x0F, true);
116                 //rgb = '1 1 1';
117         //}
118         //else
119         //      rgb = e.glowmod;
120         rgb *= (1 + autocvar_cl_vaporizerbeam_colorboost);
121
122         float fail = (this.nextthink - time);
123
124         Draw_VaporizerBeam_trace_callback_tex = tex;
125         Draw_VaporizerBeam_trace_callback_rnd = 0;
126         Draw_VaporizerBeam_trace_callback_rgb = rgb;
127         Draw_VaporizerBeam_trace_callback_a = bound(0, fail, 1);
128         WarpZone_TraceBox_ThroughZone(this.vorg1, '0 0 0', '0 0 0', this.vorg2, MOVE_NOTHING, NULL, NULL, Draw_VaporizerBeam_trace_callback);
129         Draw_VaporizerBeam_trace_callback_tex = string_null;
130
131         /*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
132         if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
133                 WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
134         else
135                 WarpZone_TrailParticles_WithMultiplier(NULL, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
136 }
137
138 NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
139 {
140         Net_Accept(vortex_beam);
141         setthink(this, SUB_Remove);
142         this.nextthink = time + bound(0, autocvar_cl_vaporizerbeam_lifetime, 10);
143         this.draw = VaporizerBeam_Draw;
144         if (isNew) IL_PUSH(g_drawables, this);
145         this.drawmask = MASK_NORMAL;
146
147         this.vorg1_x = ReadCoord(); this.vorg1_y = ReadCoord(); this.vorg1_z = ReadCoord();
148         this.vorg2_x = ReadCoord(); this.vorg2_y = ReadCoord(); this.vorg2_z = ReadCoord();
149         this.cnt = ReadByte();
150         int myowner = ReadByte();
151         this.owner = playerslots[myowner - 1];
152         this.sv_entnum = myowner;
153         this.team = ReadByte() - 1;
154
155         pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
156
157         if(autocvar_cl_vaporizerbeam_particle)
158         {
159                 WarpZone_TrailParticles(NULL, particleeffectnum(((this.cnt) ? EFFECT_VAPORIZER_HIT(this.team) : EFFECT_VAPORIZER(this.team))), this.vorg1, this.vorg2);
160                 this.draw = func_null;
161                 this.drawmask = MASK_NORMAL;
162                 delete(this);
163         }
164
165         return true;
166 }
167 #endif
168
169 #ifdef SVQC
170 spawnfunc(weapon_vaporizer) { weapon_defaultspawnfunc(this, WEP_VAPORIZER); }
171 spawnfunc(weapon_minstanex) { spawnfunc_weapon_vaporizer(this); }
172
173 void W_RocketMinsta_Explosion(entity actor, vector loc)
174 {
175         if(accuracy_canbegooddamage(actor))
176                 accuracy_add(actor, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
177         entity dmgent = spawn();
178         dmgent.owner = dmgent.realowner = actor;
179         setorigin(dmgent, loc);
180         RadiusDamage (dmgent, actor, autocvar_g_rm_damage, autocvar_g_rm_edgedamage, autocvar_g_rm_radius, NULL, NULL, autocvar_g_rm_force, WEP_DEVASTATOR.m_id | HITTYPE_SPLASH, other);
181         delete(dmgent);
182 }
183
184 void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
185 {
186         bool flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
187         float vaporizer_damage = ((WEP_CVAR_PRI(vaporizer, damage) > 0) ? WEP_CVAR_PRI(vaporizer, damage) : 10000);
188
189         W_SetupShot(actor, weaponentity, true, 0, SND_Null, CH_WEAPON_A, vaporizer_damage);
190         // handle sound separately so we can change the volume
191         // added bonus: no longer plays the strength sound (strength gives no bonus to instakill anyway)
192         sound (actor, CH_WEAPON_A, SND_MINSTANEXFIRE, VOL_BASE * 0.8, ATTEN_NORM);
193
194         yoda = 0;
195         damage_goodhits = 0;
196         FireRailgunBullet(actor, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, 800, 0, 0, 0, 0, WEP_VAPORIZER.m_id);
197
198         // do this now, as goodhits is disabled below
199         SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
200
201         if(yoda && flying)
202                 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
203         if(damage_goodhits && actor.vaporizer_lasthit)
204         {
205                 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
206                 damage_goodhits = 0; // only every second time
207         }
208
209         actor.vaporizer_lasthit = damage_goodhits;
210
211         if(autocvar_g_rm)
212         if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT)))
213                 W_RocketMinsta_Explosion(actor, trace_endpos);
214
215         W_DecreaseAmmo(thiswep, actor, ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo)));
216 }
217
218 void W_RocketMinsta_Laser_Explode (entity this, entity directhitentity)
219 {
220         if(directhitentity.takedamage == DAMAGE_AIM)
221                 if(IS_PLAYER(directhitentity))
222                         if(DIFF_TEAM(this.realowner, directhitentity))
223                                 if(!IS_DEAD(directhitentity))
224                                         if(IsFlying(directhitentity))
225                                                 Send_Notification(NOTIF_ONE, this.realowner, MSG_ANNCE, ANNCE_ACHIEVEMENT_ELECTROBITCH);
226
227         this.event_damage = func_null;
228         this.takedamage = DAMAGE_NO;
229         RadiusDamage (this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, directhitentity);
230         delete(this);
231 }
232
233 void W_RocketMinsta_Laser_Explode_use(entity this, entity actor, entity trigger)
234 {
235         W_RocketMinsta_Laser_Explode(this, trigger); // we probably don't want trigger used here, but this matches closest to old behaviour
236 }
237
238 void W_RocketMinsta_Laser_Touch(entity this, entity toucher)
239 {
240         PROJECTILE_TOUCH(this, toucher);
241         //W_RocketMinsta_Laser_Explode ();
242         RadiusDamage(this, this.realowner, this.rm_damage, this.rm_edmg, autocvar_g_rm_laser_radius, NULL, NULL, this.rm_force, this.projectiledeathtype, toucher);
243         delete(this);
244 }
245
246 void W_RocketMinsta_Attack2(entity actor, .entity weaponentity)
247 {
248         makevectors(actor.v_angle);
249
250         entity proj;
251         float counter = 0;
252         float total = autocvar_g_rm_laser_count;
253         float spread = autocvar_g_rm_laser_spread;
254         float rndspread = autocvar_g_rm_laser_spread_random;
255
256         Weapon w = PS(actor).m_weapon;
257         PS(actor).m_weapon = WEP_ELECTRO;
258         W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage);
259         PS(actor).m_weapon = w;
260
261         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
262
263     while(counter < total)
264         {
265         proj = new(plasma_prim);
266         proj.owner = proj.realowner = actor;
267         proj.bot_dodge = true;
268         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
269         proj.use = W_RocketMinsta_Laser_Explode_use;
270         setthink(proj, adaptor_think2use_hittype_splash);
271         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
272         PROJECTILE_MAKETRIGGER(proj);
273         proj.projectiledeathtype = WEP_ELECTRO.m_id;
274         setorigin(proj, w_shotorg);
275
276                 proj.rm_force = autocvar_g_rm_laser_force / total;
277                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
278                 proj.rm_edmg = proj.rm_damage;
279
280         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
281
282         set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
283         //W_SETUPPROJECTILEVELOCITY(proj, g_balance_minstanex_laser);
284                 proj.velocity = (w_shotdir + (((counter + 0.5) / total) * 2 - 1) * v_right * (spread * (rndspread ? random() : 1))) * cvar("g_rm_laser_speed");
285                 proj.velocity_z = proj.velocity_z + cvar("g_rm_laser_zspread") * (random() - 0.5);
286                 proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
287         proj.angles = vectoangles(proj.velocity);
288         settouch(proj, W_RocketMinsta_Laser_Touch);
289         setsize(proj, '0 0 -3', '0 0 -3');
290         proj.flags = FL_PROJECTILE;
291         IL_PUSH(g_projectiles, proj);
292         IL_PUSH(g_bot_dodge, proj);
293         proj.missile_flags = MIF_SPLASH;
294
295         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
296
297         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
298         counter++;
299     }
300 }
301
302 void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity)
303 {
304         makevectors(actor.v_angle);
305
306         entity proj;
307         float counter = 0;
308         float total = 1;
309
310         Weapon w = PS(actor).m_weapon;
311         PS(actor).m_weapon = WEP_ELECTRO;
312         W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage);
313         PS(actor).m_weapon = w;
314
315         Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
316
317     while(counter < total)
318         {
319         proj = new(plasma_prim);
320         proj.owner = proj.realowner = actor;
321         proj.bot_dodge = true;
322         proj.bot_dodgerating = autocvar_g_rm_laser_damage;
323         proj.use = W_RocketMinsta_Laser_Explode_use;
324         setthink(proj, adaptor_think2use_hittype_splash);
325         proj.nextthink = time + autocvar_g_rm_laser_lifetime;
326         PROJECTILE_MAKETRIGGER(proj);
327         proj.projectiledeathtype = WEP_ELECTRO.m_id;
328         setorigin(proj, w_shotorg);
329
330                 proj.rm_force = autocvar_g_rm_laser_force / total;
331                 proj.rm_damage = autocvar_g_rm_laser_damage / total;
332                 proj.rm_edmg = proj.rm_damage;
333
334         //W_SetupProjectileVelocity(proj, autocvar_g_rm_laser_speed, spread * (rndspread ? random() : 1) * autocvar_g_rm_laser_speed);
335
336         set_movetype(proj, MOVETYPE_BOUNCEMISSILE);
337                 proj.velocity = w_shotdir * autocvar_g_rm_laser_speed;
338                 proj.velocity = W_CalculateProjectileVelocity(actor, actor.velocity, proj.velocity, true);
339         proj.angles = vectoangles(proj.velocity);
340         settouch(proj, W_RocketMinsta_Laser_Touch);
341         setsize(proj, '0 0 -3', '0 0 -3');
342         proj.flags = FL_PROJECTILE;
343         IL_PUSH(g_projectiles, proj);
344         IL_PUSH(g_bot_dodge, proj);
345         proj.missile_flags = MIF_SPLASH;
346
347         CSQCProjectile(proj, true, PROJECTILE_ROCKETMINSTA_LASER, true);
348
349         MUTATOR_CALLHOOK(EditProjectile, actor, proj);
350         counter++;
351     }
352 }
353
354 METHOD(Vaporizer, wr_aim, void(entity thiswep, entity actor))
355 {
356     if(actor.(thiswep.ammo_field) > 0)
357         PHYS_INPUT_BUTTON_ATCK(actor) = bot_aim(actor, 1000000, 0, 1, false);
358     else
359         PHYS_INPUT_BUTTON_ATCK2(actor) = bot_aim(actor, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
360 }
361 METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
362 {
363     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
364     // if the laser uses load, we also consider its ammo for reloading
365     if(WEP_CVAR(vaporizer, reload_ammo) && WEP_CVAR_SEC(vaporizer, ammo) && actor.clip_load < min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo))) { // forced reload
366         thiswep.wr_reload(thiswep, actor, weaponentity);
367     } else if(WEP_CVAR(vaporizer, reload_ammo) && actor.clip_load < vaporizer_ammo) { // forced reload
368         thiswep.wr_reload(thiswep, actor, weaponentity);
369     }
370     if((fire & 1) && (actor.ammo_cells || !autocvar_g_rm) && !forbidWeaponUse(actor))
371     {
372         if(weapon_prepareattack(thiswep, actor, weaponentity, false, WEP_CVAR_PRI(vaporizer, refire)))
373         {
374             W_Vaporizer_Attack(thiswep, actor, weaponentity);
375             weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(vaporizer, animtime), w_ready);
376         }
377     }
378     if((fire & 2) || ((fire & 1) && !actor.ammo_cells && autocvar_g_rm))
379     {
380         if((autocvar_g_rm && autocvar_g_rm_laser) || autocvar_g_rm_laser == 2)
381         {
382             bool rapid = autocvar_g_rm_laser_rapid;
383             if(actor.jump_interval <= time && !actor.held_down)
384             {
385                 if(rapid)
386                     actor.held_down = true;
387                 actor.jump_interval = time + autocvar_g_rm_laser_refire;
388                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_delay;
389                 damage_goodhits = 0;
390                 W_RocketMinsta_Attack2(actor, weaponentity);
391             }
392             else if(rapid && actor.jump_interval2 <= time && actor.held_down)
393             {
394                 actor.jump_interval2 = time + autocvar_g_rm_laser_rapid_refire;
395                 damage_goodhits = 0;
396                 W_RocketMinsta_Attack3(actor, weaponentity);
397                 //weapon_thinkf(actor, WFRAME_FIRE2, autocvar_g_rm_laser_rapid_animtime, w_ready);
398             }
399         }
400         else if (actor.jump_interval <= time)
401         {
402             // handle refire manually, so that primary and secondary can be fired without conflictions (important for instagib)
403             actor.jump_interval = time + WEP_CVAR_SEC(vaporizer, refire) * W_WeaponRateFactor(actor);
404
405             // decrease ammo for the laser?
406             if(WEP_CVAR_SEC(vaporizer, ammo))
407                 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_SEC(vaporizer, ammo));
408
409             // ugly instagib hack to reuse the fire mode of the laser
410             makevectors(actor.v_angle);
411             Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
412             PS(actor).m_weapon = WEP_BLASTER;
413             W_Blaster_Attack(
414                 actor,
415                 weaponentity,
416                 WEP_BLASTER.m_id | HITTYPE_SECONDARY,
417                 WEP_CVAR_SEC(vaporizer, shotangle),
418                 WEP_CVAR_SEC(vaporizer, damage),
419                 WEP_CVAR_SEC(vaporizer, edgedamage),
420                 WEP_CVAR_SEC(vaporizer, radius),
421                 WEP_CVAR_SEC(vaporizer, force),
422                 WEP_CVAR_SEC(vaporizer, speed),
423                 WEP_CVAR_SEC(vaporizer, spread),
424                 WEP_CVAR_SEC(vaporizer, delay),
425                 WEP_CVAR_SEC(vaporizer, lifetime)
426             );
427             PS(actor).m_weapon = oldwep;
428
429             // now do normal refire
430             weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
431         }
432     }
433     else
434         actor.held_down = false;
435 }
436 METHOD(Vaporizer, wr_setup, void(entity thiswep, entity actor))
437 {
438     actor.ammo_field = (thiswep.ammo_field);
439     actor.vaporizer_lasthit = 0;
440 }
441 METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep, entity actor))
442 {
443     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
444     float ammo_amount = actor.(thiswep.ammo_field) >= vaporizer_ammo;
445     ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
446     return ammo_amount;
447 }
448 METHOD(Vaporizer, wr_checkammo2, bool(entity thiswep, entity actor))
449 {
450     if(!WEP_CVAR_SEC(vaporizer, ammo))
451         return true;
452     float ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
453     ammo_amount += actor.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
454     return ammo_amount;
455 }
456 METHOD(Vaporizer, wr_resetplayer, void(entity thiswep, entity actor))
457 {
458     actor.vaporizer_lasthit = 0;
459 }
460 METHOD(Vaporizer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
461 {
462     float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
463     float used_ammo;
464     if(WEP_CVAR_SEC(vaporizer, ammo))
465         used_ammo = min(vaporizer_ammo, WEP_CVAR_SEC(vaporizer, ammo));
466     else
467         used_ammo = vaporizer_ammo;
468
469     W_Reload(actor, weaponentity, used_ammo, SND_RELOAD);
470 }
471 METHOD(Vaporizer, wr_suicidemessage, Notification(entity thiswep))
472 {
473     return WEAPON_THINKING_WITH_PORTALS;
474 }
475 METHOD(Vaporizer, wr_killmessage, Notification(entity thiswep))
476 {
477     return WEAPON_VAPORIZER_MURDER;
478 }
479
480 #endif
481 #ifdef CSQC
482
483 METHOD(Vaporizer, wr_impacteffect, void(entity thiswep, entity actor))
484 {
485     vector org2 = w_org + w_backoff * 6;
486     if(w_deathtype & HITTYPE_SECONDARY)
487     {
488         pointparticles(EFFECT_BLASTER_IMPACT, org2, w_backoff * 1000, 1);
489         if(!w_issilent) { sound(actor, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTN_NORM); }
490     }
491     else
492     {
493         pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
494         if(!w_issilent) { sound(actor, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM); }
495     }
496 }
497 METHOD(Vaporizer, wr_init, void(entity thiswep))
498 {
499     if(autocvar_cl_reticle && autocvar_cl_reticle_weapon)
500     {
501         precache_pic("gfx/reticle_nex");
502     }
503 }
504 METHOD(Vaporizer, wr_zoomreticle, bool(entity thiswep))
505 {
506     if(button_zoom || zoomscript_caught)
507     {
508         reticle_image = "gfx/reticle_nex";
509         return true;
510     }
511     else
512     {
513         // no weapon specific image for this weapon
514         return false;
515     }
516 }
517
518 #endif
519 #endif