]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_nex.qc
make the minstagib Nex a separate weapon
[divverent/nexuiz.git] / data / qcsrc / server / w_nex.qc
1 void W_Nex_Attack (void)
2 {
3         float flying;
4         flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
5
6         W_SetupShot (self, '25 4 -4', TRUE, 5, "weapons/nexfire.wav");
7
8         yoda = 0;
9         FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), WEP_NEX);
10
11         if(yoda)
12         if(flying)
13                 announce(self, "announcer/male/yoda.ogg");
14
15         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
16
17         // beam effect
18         trailparticles(world, particleeffectnum("nex_beam"), w_shotorg, trace_endpos);
19         // flash and burn the wall
20         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
21                 pointparticles(particleeffectnum("nex_impact"), trace_endpos - w_shotdir * 6, '0 0 0', 1);
22         // play a sound
23         soundat (self, trace_endpos, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
24
25         if (cvar("g_use_ammunition"))
26         {
27                 self.ammo_cells = self.ammo_cells - cvar("g_balance_nex_ammo");
28         }
29 }
30
31 void spawnfunc_weapon_nex (void); // defined in t_items.qc
32
33 float w_nex(float req)
34 {
35         if (req == WR_AIM)
36                 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
37         else if (req == WR_THINK)
38         {
39                 if (self.BUTTON_ATCK)
40                 {
41                         if (weapon_prepareattack(0, cvar("g_balance_nex_refire")))
42                         {
43                                 W_Nex_Attack();
44                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_animtime"), w_ready);
45                         }
46                 }
47         }
48         else if (req == WR_PRECACHE)
49         {
50                 precache_model ("models/nexflash.md3");
51                 precache_model ("models/weapons/g_nex.md3");
52                 precache_model ("models/weapons/v_nex.md3");
53                 precache_model ("models/weapons/w_nex.zym");
54                 precache_sound ("weapons/nexfire.wav");
55                 precache_sound ("weapons/neximpact.wav");
56         }
57         else if (req == WR_SETUP)
58                 weapon_setup(WEP_NEX);
59         else if (req == WR_CHECKAMMO1)
60                 return self.ammo_cells >= cvar("g_balance_nex_ammo");
61         else if (req == WR_CHECKAMMO2)
62                 return FALSE;
63         else if (req == WR_SUICIDEMESSAGE)
64                 w_deathtypestring = "did the impossible";
65         else if (req == WR_KILLMESSAGE)
66                 w_deathtypestring = "has been vaporized by";
67         else if (req == WR_SPAWNFUNC)
68                 spawnfunc_weapon_nex();
69         return TRUE;
70 };