]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_minstanex.qc
Racer: return to spawn if left ("alive")for some time, rockets accelerate, better...
[divverent/nexuiz.git] / data / qcsrc / server / w_minstanex.qc
1 .float minstanex_lasthit;
2
3 void W_MinstaNex_Attack (void)
4 {
5         float flying;
6         flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
7
8         W_SetupShot (self, TRUE, 0, "weapons/minstanexfire.wav", 0);
9
10         yoda = 0;
11         damage_goodhits = 0;
12         headshot = 0;
13         FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 10000, 800, 0, 0, 0, 0, WEP_MINSTANEX);
14
15         if(g_minstagib)
16         {
17                 if(yoda)
18                         announce(self, "announcer/male/yoda.wav");
19         }
20         else
21         {
22                 if(yoda && flying)
23                         announce(self, "announcer/male/yoda.wav");
24                 if(headshot)
25                 {
26                         announce(self, "announcer/male/headshot.wav");
27                         print("h\n");
28                 }
29                 if(damage_goodhits && self.minstanex_lasthit)
30                 {
31                         if(announce(self, "announcer/male/impressive.wav"))
32                                 damage_goodhits = 0; // only every second time
33                 }
34         }
35
36         self.minstanex_lasthit = damage_goodhits;
37
38         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
39
40         // teamcolor / hit beam effect
41         if(teamplay)
42         {
43             switch(self.team)
44             {
45             case COLOR_TEAM1:   // Red
46                 if(damage_goodhits)
47                     trailparticles(world, particleeffectnum("TE_TEI_G3RED_HIT"), w_shotorg, trace_endpos);
48                 else
49                     trailparticles(world, particleeffectnum("TE_TEI_G3RED"), w_shotorg, trace_endpos);
50                 break;
51             case COLOR_TEAM2:   // Blue
52                 if(damage_goodhits)
53                     trailparticles(world, particleeffectnum("TE_TEI_G3BLUE_HIT"), w_shotorg, trace_endpos);
54                 else
55                     trailparticles(world, particleeffectnum("TE_TEI_G3BLUE"), w_shotorg, trace_endpos);
56                 break;
57             case COLOR_TEAM3:   // Yellow
58                 if(damage_goodhits)
59                     trailparticles(world, particleeffectnum("TE_TEI_G3YELLOW_HIT"), w_shotorg, trace_endpos);
60                 else
61                     trailparticles(world, particleeffectnum("TE_TEI_G3YELLOW"), w_shotorg, trace_endpos);
62                 break;
63             case COLOR_TEAM4:   // Pink
64                 if(damage_goodhits)
65                     trailparticles(world, particleeffectnum("TE_TEI_G3PINK_HIT"), w_shotorg, trace_endpos);
66                 else
67                     trailparticles(world, particleeffectnum("TE_TEI_G3PINK"), w_shotorg, trace_endpos);
68                 break;
69             }
70         }
71         else
72         trailparticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, trace_endpos);
73
74         // flash and burn the wall
75         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
76                 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX, self);
77
78         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
79         {
80                 if (g_minstagib)
81                         self.ammo_cells = self.ammo_cells - 1;
82                 else
83                         self.ammo_cells = self.ammo_cells - cvar("g_balance_minstanex_ammo");
84         }
85 }
86
87
88 .float minstagib_nextthink;
89 void minstagib_ammocheck (void)
90 {
91         if (time < self.minstagib_nextthink || self.deadflag || gameover)
92                 return;
93
94         if (self.ammo_cells <= 0)
95         {
96                 if (self.health == 5)
97                 {
98                         centerprint(self, "you're dead now...\n");
99                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
100                         announce(self, "announcer/robotic/terminated.wav");
101                 }
102                 else if (self.health == 10)
103                 {
104                         centerprint(self, "^11^7 second left to find some ammo\n");
105                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
106                         announce(self, "announcer/robotic/1.wav");
107                 }
108                 else if (self.health == 20)
109                 {
110                         centerprint(self, "^12^7 seconds left to find some ammo\n");
111                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
112                         announce(self, "announcer/robotic/2.wav");
113                 }
114                 else if (self.health == 30)
115                 {
116                         centerprint(self, "^13^7 seconds left to find some ammo\n");
117                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
118                         announce(self, "announcer/robotic/3.wav");
119                 }
120                 else if (self.health == 40)
121                 {
122                         centerprint(self, "^14^7 seconds left to find some ammo\n");
123                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
124                         announce(self, "announcer/robotic/4.wav");
125                 }
126                 else if (self.health == 50)
127                 {
128                         centerprint(self, "^15^7 seconds left to find some ammo\n");
129                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
130                         announce(self, "announcer/robotic/5.wav");
131                 }
132                 else if (self.health == 60)
133                 {
134                         centerprint(self, "^36^7 seconds left to find some ammo\n");
135                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
136                         announce(self, "announcer/robotic/6.wav");
137                 }
138                 else if (self.health == 70)
139                 {
140                         centerprint(self, "^37^7 seconds left to find some ammo\n");
141                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
142                         announce(self, "announcer/robotic/7.wav");
143                 }
144                 else if (self.health == 80)
145                 {
146                         centerprint(self, "^38^7 seconds left to find some ammo\n");
147                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
148                         announce(self, "announcer/robotic/8.wav");
149                 }
150                 else if (self.health == 90)
151                 {
152                         centerprint(self, "^39^7 seconds left to find some ammo\n");
153                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
154                         announce(self, "announcer/robotic/9.wav");
155                 }
156                 else if (self.health == 100)
157                 {
158                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
159                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
160                         if not(self.flags & FL_GODMODE)
161                                 announce(self, "announcer/robotic/10.wav");
162                 }
163         }
164         self.minstagib_nextthink = time + 1;
165 }
166
167 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
168
169 float w_minstanex(float req)
170 {
171         if (req == WR_AIM)
172         {
173                 if(self.ammo_cells>0)
174                         self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
175                 else
176                         self.BUTTON_ATCK2 = bot_aim(cvar("g_balance_laser_primary_speed"), 0, cvar("g_balance_laser_primary_lifetime"), FALSE);
177         }
178         else if (req == WR_THINK)
179         {
180                 if (self.BUTTON_ATCK)
181                 {
182                         if (weapon_prepareattack(0, cvar("g_balance_minstanex_refire")))
183                         {
184                                 W_MinstaNex_Attack();
185                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstanex_animtime"), w_ready);
186                         }
187                 }
188                 else if (self.BUTTON_ATCK2)
189                 {
190                         if (self.jump_interval <= time)
191                         {
192                                 self.jump_interval = time + 0.9 * W_WeaponRateFactor();
193
194                                 // ugly minstagib hack to reuse the fire mode of the laser
195                                 float w;
196                                 w = self.weapon;
197                                 self.weapon = WEP_LASER;
198                                 W_Laser_Attack(2);
199                                 self.weapon = w;
200                         }
201                 }
202         }
203         else if (req == WR_PRECACHE)
204         {
205                 precache_model ("models/nexflash.md3");
206                 precache_model ("models/weapons/g_minstanex.md3");
207                 precache_model ("models/weapons/v_minstanex.md3");
208                 precache_model ("models/weapons/h_minstanex.dpm");
209                 precache_sound ("weapons/minstanexfire.wav");
210                 precache_sound ("weapons/nexwhoosh1.wav");
211                 precache_sound ("weapons/nexwhoosh2.wav");
212                 precache_sound ("weapons/nexwhoosh3.wav");
213                 w_laser(WR_PRECACHE);
214         }
215         else if (req == WR_SETUP)
216         {
217                 weapon_setup(WEP_MINSTANEX);
218                 self.minstanex_lasthit = 0;
219         }
220         else if (req == WR_CHECKAMMO1)
221         {
222                 if (g_minstagib)
223                         return self.ammo_cells >= 1;
224                 else
225                         return self.ammo_cells >= cvar("g_balance_minstanex_ammo");
226         }
227         else if (req == WR_CHECKAMMO2)
228                 return TRUE;
229         else if (req == WR_SUICIDEMESSAGE)
230                 w_deathtypestring = "did the impossible";
231         else if (req == WR_KILLMESSAGE)
232                 w_deathtypestring = "has been vaporized by";
233         else if (req == WR_RESETPLAYER)
234         {
235                 self.minstanex_lasthit = 0;
236         }
237         return TRUE;
238 };