]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_minstanex.qc
Team colored minstanex beams & flyby sound for near misses with nex and minstanex.
[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, 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                 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                 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                 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                 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                 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                 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                 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                 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                 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                 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                         announce(self, "announcer/robotic/10.wav");
161                 }
162         }
163         self.minstagib_nextthink = time + 1;
164 }
165
166 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
167
168 float w_minstanex(float req)
169 {
170         if (req == WR_AIM)
171                 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
172         else if (req == WR_THINK)
173         {
174                 if (self.BUTTON_ATCK)
175                 {
176                         if (weapon_prepareattack(0, cvar("g_balance_minstanex_refire")))
177                         {
178                                 W_MinstaNex_Attack();
179                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstanex_animtime"), w_ready);
180                         }
181                 }
182                 else if (self.BUTTON_ATCK2)
183                 {
184                         if (self.jump_interval <= time)
185                         {
186                                 self.jump_interval = time + 0.9 * W_WeaponRateFactor();
187                                 W_Laser_Attack(FALSE);
188                         }
189                 }
190         }
191         else if (req == WR_PRECACHE)
192         {
193                 precache_model ("models/nexflash.md3");
194                 precache_model ("models/weapons/g_minstanex.md3");
195                 precache_model ("models/weapons/v_minstanex.md3");
196                 precache_model ("models/weapons/h_minstanex.dpm");
197                 precache_sound ("weapons/minstanexfire.wav");
198                 precache_sound ("weapons/nexwhoosh1.ogg");
199                 precache_sound ("weapons/nexwhoosh2.ogg");
200                 precache_sound ("weapons/nexwhoosh3.ogg");
201                 w_laser(WR_PRECACHE);
202         }
203         else if (req == WR_SETUP)
204         {
205                 weapon_setup(WEP_MINSTANEX);
206                 self.minstanex_lasthit = 0;
207         }
208         else if (req == WR_CHECKAMMO1)
209         {
210                 if (g_minstagib)
211                         return self.ammo_cells >= 1;
212                 else
213                         return self.ammo_cells >= cvar("g_balance_minstanex_ammo");
214         }
215         else if (req == WR_CHECKAMMO2)
216                 return TRUE;
217         else if (req == WR_SUICIDEMESSAGE)
218                 w_deathtypestring = "did the impossible";
219         else if (req == WR_KILLMESSAGE)
220                 w_deathtypestring = "has been vaporized by";
221         return TRUE;
222 };