]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_nex.qc
added muzzleflash effects for all weapons (most emit light, all emit
[divverent/nexuiz.git] / data / qcsrc / server / w_nex.qc
1
2 void W_Nex_Attack (void)
3 {
4         //w_shotorg = self.origin + self.view_ofs + v_forward * 5 + v_right * 14 + v_up * -7;
5         W_SetupShot (self, '5 14 -8', TRUE, 5, "weapons/nexfire.wav");
6
7         // assure that nexdamage is high enough in minstagib
8         if (g_minstagib)
9                 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 1000, 800, IT_NEX);
10         else
11                 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), IT_NEX);
12
13         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg + v_forward * 32, v_forward * 1000, 1);
14
15         // show as if shot started outside of gun
16         // muzzleflash light
17         //te_smallflash (w_shotorg + w_shotdir * 24);
18         // beam effect
19         trailparticles(world, particleeffectnum("nex_beam"), w_shotorg + w_shotdir * 28, trace_endpos);
20         // flash and burn the wall
21         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
22                 pointparticles(particleeffectnum("nex_impact"), trace_endpos - w_shotdir * 6, '0 0 0', 1);
23         // play a sound
24         PointSound (trace_endpos, "weapons/neximpact.wav", 1, ATTN_NORM);
25
26         if (cvar("g_use_ammunition") && !g_instagib)
27         {
28                 if (g_minstagib)
29                         self.ammo_cells = self.ammo_cells - 1;
30                 else
31                         self.ammo_cells = self.ammo_cells - cvar("g_balance_nex_ammo");
32         }
33
34         /*
35         local entity flash;
36         flash = spawn ();
37         setorigin (flash, self.origin + self.view_ofs + v_forward * 33 + v_right * 14 + v_up * -7);
38         flash.angles = vectoangles (w_shotdir);
39         //setattachment(flash, self.weaponentity, "bone01");
40         //flash.origin = '150 0 0';
41         //setattachment(flash, self.weaponentity, "");
42         //flash.origin = '150 -16 -8';
43         //flash.angles_z = 90;
44         //flash.scale = 4;
45         setmodel (flash, "models/nexflash.md3"); // precision set below
46         SUB_SetFade (flash, time, 0.4);
47         flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
48         */
49 }
50
51
52 .float minstagib_nextthink;
53 void minstagib_ammocheck (void)
54 {
55         if (time < self.minstagib_nextthink || self.deadflag || gameover)
56                 return;
57
58         if (self.ammo_cells <= 0)
59         {
60                 if (self.health == 5)
61                 {
62                         centerprint(self, "you're dead now...\n");
63                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
64                         play2(self, "announcer/robotic/terminated.ogg");
65                 }
66                 if (self.health == 10)
67                 {
68                         centerprint(self, "^11^7 second left to find some ammo\n");
69                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
70                         play2(self, "announcer/robotic/1.ogg");
71                 }
72                 if (self.health == 20)
73                 {
74                         centerprint(self, "^12^7 seconds left to find some ammo\n");
75                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
76                         play2(self, "announcer/robotic/2.ogg");
77                 }
78                 if (self.health == 30)
79                 {
80                         centerprint(self, "^13^7 seconds left to find some ammo\n");
81                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
82                         play2(self, "announcer/robotic/3.ogg");
83                 }
84                 if (self.health == 40)
85                 {
86                         centerprint(self, "^14^7 seconds left to find some ammo\n");
87                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
88                         play2(self, "announcer/robotic/4.ogg");
89                 }
90                 if (self.health == 50)
91                 {
92                         centerprint(self, "^15^7 seconds left to find some ammo\n");
93                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
94                         play2(self, "announcer/robotic/5.ogg");
95                 }
96                 if (self.health == 60)
97                 {
98                         centerprint(self, "^36^7 seconds left to find some ammo\n");
99                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
100                         play2(self, "announcer/robotic/6.ogg");
101                 }
102                 if (self.health == 70)
103                 {
104                         centerprint(self, "^37^7 seconds left to find some ammo\n");
105                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
106                         play2(self, "announcer/robotic/7.ogg");
107                 }
108                 if (self.health == 80)
109                 {
110                         centerprint(self, "^38^7 seconds left to find some ammo\n");
111                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
112                         play2(self, "announcer/robotic/8.ogg");
113                 }
114                 if (self.health == 90)
115                 {
116                         centerprint(self, "^39^7 seconds left to find some ammo\n");
117                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
118                         play2(self, "announcer/robotic/9.ogg");
119                 }
120                 if (self.health == 100)
121                 {
122                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
123                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
124                         play2(self, "announcer/robotic/10.ogg");
125                 }
126         }
127         self.minstagib_nextthink = time + 1;
128 }
129
130 float(float req) w_nex =
131 {
132         if (req == WR_AIM)
133                 self.button0 = bot_aim(1000000, 0, 1, FALSE);
134         else if (req == WR_THINK)
135         {
136                 if (self.button0)
137                 {
138                         if(g_minstagib)
139                         {
140                                 if (weapon_prepareattack(0, cvar("g_balance_minstagib_nex_refire")))
141                                 {
142                                         W_Nex_Attack();
143                                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstagib_nex_animtime"), w_ready);
144                                 }
145                         }
146                         else
147                         {
148                                 if (weapon_prepareattack(0, cvar("g_balance_nex_refire")))
149                                 {
150                                         W_Nex_Attack();
151                                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_animtime"), w_ready);
152                                 }
153                         }
154                 }
155                 else if (self.button3)
156                 {
157                         if (g_minstagib)
158                         {
159                                 if (self.jump_interval <= time)
160                                 {
161                                         self.jump_interval = time + 0.9;
162                                         W_Laser_Attack(FALSE);
163                                 }
164                         }
165                 }
166         }
167         else if (req == WR_PRECACHE)
168         {
169                 precache_model ("models/nexflash.md3");
170                 precache_model ("models/weapons/g_nex.md3");
171                 precache_model ("models/weapons/v_nex.md3");
172                 precache_model ("models/weapons/w_nex.zym");
173                 precache_sound ("weapons/nexfire.wav");
174                 precache_sound ("weapons/neximpact.wav");
175         }
176         else if (req == WR_SETUP)
177                 weapon_setup(WEP_NEX, "nex", IT_CELLS);
178         else if (req == WR_CHECKAMMO1)
179         {
180                 if (g_minstagib)
181                         return self.ammo_cells >= 1;
182                 else
183                         return self.ammo_cells >= cvar("g_balance_nex_ammo");
184         }
185         else if (req == WR_CHECKAMMO2)
186                 return FALSE;
187         else if (req == WR_REGISTER)
188                 weapon_register(WEP_NEX, cvar("g_balance_nex_ammo"));
189         return TRUE;
190 };