]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_minstanex.qc
use sound/weapons/minstanexfire.ogg
[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, '25 8 -4', TRUE, 5, "weapons/minstanexfire.wav");
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.ogg");
19         }
20         else
21         {
22                 if(yoda && flying)
23                         announce(self, "announcer/male/yoda.ogg");
24                 if(headshot)
25                         announce(self, "announcer/male/headshot.ogg");
26                 if(damage_goodhits && self.minstanex_lasthit)
27                 {
28                         if(announce(self, "announcer/male/impressive.ogg"))
29                                 damage_goodhits = 0; // only every second time
30                 }
31         }
32
33         self.minstanex_lasthit = damage_goodhits;
34
35         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
36
37         // beam effect
38         trailparticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, trace_endpos);
39         // flash and burn the wall
40         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
41                 pointparticles(particleeffectnum("nex_impact"), trace_endpos - w_shotdir * 6, '0 0 0', 1);
42         // play a sound
43         soundat (self, trace_endpos, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
44
45         if not(self.items & IT_UNLIMITED_AMMO)
46         {
47                 if (g_minstagib)
48                         self.ammo_cells = self.ammo_cells - 1;
49                 else
50                         self.ammo_cells = self.ammo_cells - cvar("g_balance_minstanex_ammo");
51         }
52 }
53
54
55 .float minstagib_nextthink;
56 void minstagib_ammocheck (void)
57 {
58         if (time < self.minstagib_nextthink || self.deadflag || gameover)
59                 return;
60
61         if (self.ammo_cells <= 0)
62         {
63                 if (self.health == 5)
64                 {
65                         centerprint(self, "you're dead now...\n");
66                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
67                         announce(self, "announcer/robotic/terminated.ogg");
68                 }
69                 if (self.health == 10)
70                 {
71                         centerprint(self, "^11^7 second left to find some ammo\n");
72                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
73                         announce(self, "announcer/robotic/1.ogg");
74                 }
75                 if (self.health == 20)
76                 {
77                         centerprint(self, "^12^7 seconds left to find some ammo\n");
78                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
79                         announce(self, "announcer/robotic/2.ogg");
80                 }
81                 if (self.health == 30)
82                 {
83                         centerprint(self, "^13^7 seconds left to find some ammo\n");
84                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
85                         announce(self, "announcer/robotic/3.ogg");
86                 }
87                 if (self.health == 40)
88                 {
89                         centerprint(self, "^14^7 seconds left to find some ammo\n");
90                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
91                         announce(self, "announcer/robotic/4.ogg");
92                 }
93                 if (self.health == 50)
94                 {
95                         centerprint(self, "^15^7 seconds left to find some ammo\n");
96                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
97                         announce(self, "announcer/robotic/5.ogg");
98                 }
99                 if (self.health == 60)
100                 {
101                         centerprint(self, "^36^7 seconds left to find some ammo\n");
102                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
103                         announce(self, "announcer/robotic/6.ogg");
104                 }
105                 if (self.health == 70)
106                 {
107                         centerprint(self, "^37^7 seconds left to find some ammo\n");
108                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
109                         announce(self, "announcer/robotic/7.ogg");
110                 }
111                 if (self.health == 80)
112                 {
113                         centerprint(self, "^38^7 seconds left to find some ammo\n");
114                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
115                         announce(self, "announcer/robotic/8.ogg");
116                 }
117                 if (self.health == 90)
118                 {
119                         centerprint(self, "^39^7 seconds left to find some ammo\n");
120                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
121                         announce(self, "announcer/robotic/9.ogg");
122                 }
123                 if (self.health == 100)
124                 {
125                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
126                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
127                         announce(self, "announcer/robotic/10.ogg");
128                 }
129         }
130         self.minstagib_nextthink = time + 1;
131 }
132
133 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
134
135 float w_minstanex(float req)
136 {
137         if (req == WR_AIM)
138                 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
139         else if (req == WR_THINK)
140         {
141                 if (self.BUTTON_ATCK)
142                 {
143                         if (weapon_prepareattack(0, cvar("g_balance_minstanex_refire")))
144                         {
145                                 W_MinstaNex_Attack();
146                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstanex_animtime"), w_ready);
147                         }
148                 }
149                 else if (self.BUTTON_ATCK2)
150                 {
151                         if (self.jump_interval <= time)
152                         {
153                                 self.jump_interval = time + 0.9;
154                                 W_Laser_Attack(FALSE);
155                         }
156                 }
157         }
158         else if (req == WR_PRECACHE)
159         {
160                 precache_model ("models/nexflash.md3");
161                 precache_model ("models/weapons/g_minstanex.md3");
162                 precache_model ("models/weapons/v_minstanex.md3");
163                 precache_model ("models/weapons/w_minstanex.zym");
164                 precache_sound ("weapons/minstanexfire.wav");
165                 precache_sound ("weapons/neximpact.wav");
166                 w_laser(WR_PRECACHE);
167         }
168         else if (req == WR_SETUP)
169         {
170                 weapon_setup(WEP_MINSTANEX);
171                 self.minstanex_lasthit = 0;
172         }
173         else if (req == WR_CHECKAMMO1)
174         {
175                 if (g_minstagib)
176                         return self.ammo_cells >= 1;
177                 else
178                         return self.ammo_cells >= cvar("g_balance_minstanex_ammo");
179         }
180         else if (req == WR_CHECKAMMO2)
181                 return FALSE;
182         else if (req == WR_SUICIDEMESSAGE)
183                 w_deathtypestring = "did the impossible";
184         else if (req == WR_KILLMESSAGE)
185                 w_deathtypestring = "has been vaporized by";
186         return TRUE;
187 };