]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_minstanex.qc
Support for accuracy stats by Diabolik. See your stats with +showaccuracy or "sbar_hu...
[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, 5, "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         // beam effect
41         trailparticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, trace_endpos);
42         // flash and burn the wall
43         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
44                 Damage_DamageInfo(trace_endpos, 10000, 0, 0, 800 * w_shotdir, WEP_MINSTANEX);
45
46         if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
47         {
48                 if (g_minstagib)
49                         self.ammo_cells = self.ammo_cells - 1;
50                 else
51                         self.ammo_cells = self.ammo_cells - cvar("g_balance_minstanex_ammo");
52         }
53 }
54
55
56 .float minstagib_nextthink;
57 void minstagib_ammocheck (void)
58 {
59         if (time < self.minstagib_nextthink || self.deadflag || gameover)
60                 return;
61
62         if (self.ammo_cells <= 0)
63         {
64                 if (self.health == 5)
65                 {
66                         centerprint(self, "you're dead now...\n");
67                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
68                         announce(self, "announcer/robotic/terminated.wav");
69                 }
70                 if (self.health == 10)
71                 {
72                         centerprint(self, "^11^7 second left to find some ammo\n");
73                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
74                         announce(self, "announcer/robotic/1.wav");
75                 }
76                 if (self.health == 20)
77                 {
78                         centerprint(self, "^12^7 seconds left to find some ammo\n");
79                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
80                         announce(self, "announcer/robotic/2.wav");
81                 }
82                 if (self.health == 30)
83                 {
84                         centerprint(self, "^13^7 seconds left to find some ammo\n");
85                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
86                         announce(self, "announcer/robotic/3.wav");
87                 }
88                 if (self.health == 40)
89                 {
90                         centerprint(self, "^14^7 seconds left to find some ammo\n");
91                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
92                         announce(self, "announcer/robotic/4.wav");
93                 }
94                 if (self.health == 50)
95                 {
96                         centerprint(self, "^15^7 seconds left to find some ammo\n");
97                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
98                         announce(self, "announcer/robotic/5.wav");
99                 }
100                 if (self.health == 60)
101                 {
102                         centerprint(self, "^36^7 seconds left to find some ammo\n");
103                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
104                         announce(self, "announcer/robotic/6.wav");
105                 }
106                 if (self.health == 70)
107                 {
108                         centerprint(self, "^37^7 seconds left to find some ammo\n");
109                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
110                         announce(self, "announcer/robotic/7.wav");
111                 }
112                 if (self.health == 80)
113                 {
114                         centerprint(self, "^38^7 seconds left to find some ammo\n");
115                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
116                         announce(self, "announcer/robotic/8.wav");
117                 }
118                 if (self.health == 90)
119                 {
120                         centerprint(self, "^39^7 seconds left to find some ammo\n");
121                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
122                         announce(self, "announcer/robotic/9.wav");
123                 }
124                 if (self.health == 100)
125                 {
126                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
127                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
128                         announce(self, "announcer/robotic/10.wav");
129                 }
130         }
131         self.minstagib_nextthink = time + 1;
132 }
133
134 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
135
136 float w_minstanex(float req)
137 {
138         if (req == WR_AIM)
139                 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
140         else if (req == WR_THINK)
141         {
142                 if (self.BUTTON_ATCK)
143                 {
144                         if (weapon_prepareattack(0, cvar("g_balance_minstanex_refire")))
145                         {
146                                 W_MinstaNex_Attack();
147                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstanex_animtime"), w_ready);
148                         }
149                 }
150                 else if (self.BUTTON_ATCK2)
151                 {
152                         if (self.jump_interval <= time)
153                         {
154                                 self.jump_interval = time + 0.9;
155                                 W_Laser_Attack(FALSE);
156                         }
157                 }
158         }
159         else if (req == WR_PRECACHE)
160         {
161                 precache_model ("models/nexflash.md3");
162                 precache_model ("models/weapons/g_minstanex.md3");
163                 precache_model ("models/weapons/v_minstanex.md3");
164                 precache_model ("models/weapons/h_minstanex.dpm");
165                 precache_sound ("weapons/minstanexfire.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 TRUE;
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 };