]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_minstanex.qc
use the old Nex model and old Nex shot origin; make csqc aware of the weapon impulses...
[divverent/nexuiz.git] / data / qcsrc / server / w_minstanex.qc
1 void W_MinstaNex_Attack (void)
2 {
3         float flying;
4         flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
5
6         W_SetupShot (self, '25 8 -4', TRUE, 5, "weapons/nexfire.wav");
7
8         yoda = 0;
9         FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 1000, 800, WEP_MINSTANEX);
10
11         if(!g_minstagib)
12         if(yoda)
13         if(flying)
14                 announce(self, "announcer/male/yoda.ogg");
15
16         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
17
18         // beam effect
19         trailparticles(world, particleeffectnum("TE_TEI_G3"), w_shotorg, 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         soundat (self, trace_endpos, CHAN_PROJECTILE, "weapons/neximpact.wav", VOL_BASE, ATTN_NORM);
25
26         if (cvar("g_use_ammunition"))
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_minstanex_ammo");
32         }
33 }
34
35
36 .float minstagib_nextthink;
37 void minstagib_ammocheck (void)
38 {
39         if (time < self.minstagib_nextthink || self.deadflag || gameover)
40                 return;
41
42         if (self.ammo_cells <= 0)
43         {
44                 if (self.health == 5)
45                 {
46                         centerprint(self, "you're dead now...\n");
47                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
48                         announce(self, "announcer/robotic/terminated.ogg");
49                 }
50                 if (self.health == 10)
51                 {
52                         centerprint(self, "^11^7 second left to find some ammo\n");
53                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
54                         announce(self, "announcer/robotic/1.ogg");
55                 }
56                 if (self.health == 20)
57                 {
58                         centerprint(self, "^12^7 seconds left to find some ammo\n");
59                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
60                         announce(self, "announcer/robotic/2.ogg");
61                 }
62                 if (self.health == 30)
63                 {
64                         centerprint(self, "^13^7 seconds left to find some ammo\n");
65                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
66                         announce(self, "announcer/robotic/3.ogg");
67                 }
68                 if (self.health == 40)
69                 {
70                         centerprint(self, "^14^7 seconds left to find some ammo\n");
71                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
72                         announce(self, "announcer/robotic/4.ogg");
73                 }
74                 if (self.health == 50)
75                 {
76                         centerprint(self, "^15^7 seconds left to find some ammo\n");
77                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
78                         announce(self, "announcer/robotic/5.ogg");
79                 }
80                 if (self.health == 60)
81                 {
82                         centerprint(self, "^36^7 seconds left to find some ammo\n");
83                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
84                         announce(self, "announcer/robotic/6.ogg");
85                 }
86                 if (self.health == 70)
87                 {
88                         centerprint(self, "^37^7 seconds left to find some ammo\n");
89                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
90                         announce(self, "announcer/robotic/7.ogg");
91                 }
92                 if (self.health == 80)
93                 {
94                         centerprint(self, "^38^7 seconds left to find some ammo\n");
95                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
96                         announce(self, "announcer/robotic/8.ogg");
97                 }
98                 if (self.health == 90)
99                 {
100                         centerprint(self, "^39^7 seconds left to find some ammo\n");
101                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
102                         announce(self, "announcer/robotic/9.ogg");
103                 }
104                 if (self.health == 100)
105                 {
106                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
107                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
108                         announce(self, "announcer/robotic/10.ogg");
109                 }
110         }
111         self.minstagib_nextthink = time + 1;
112 }
113
114 void spawnfunc_weapon_minstanex (void); // defined in t_items.qc
115
116 float w_minstanex(float req)
117 {
118         if (req == WR_AIM)
119                 self.BUTTON_ATCK = bot_aim(1000000, 0, 1, FALSE);
120         else if (req == WR_THINK)
121         {
122                 if (self.BUTTON_ATCK)
123                 {
124                         if (weapon_prepareattack(0, cvar("g_balance_minstanex_refire")))
125                         {
126                                 W_MinstaNex_Attack();
127                                 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstanex_animtime"), w_ready);
128                         }
129                 }
130                 else if (self.BUTTON_ATCK2)
131                 {
132                         if (self.jump_interval <= time)
133                         {
134                                 self.jump_interval = time + 0.9;
135                                 W_Laser_Attack(FALSE);
136                         }
137                 }
138         }
139         else if (req == WR_PRECACHE)
140         {
141                 precache_model ("models/nexflash.md3");
142                 precache_model ("models/weapons/g_nex.md3");
143                 precache_model ("models/weapons/v_nex.md3");
144                 precache_model ("models/weapons/w_nex.zym");
145                 precache_sound ("weapons/nexfire.wav");
146                 precache_sound ("weapons/neximpact.wav");
147                 w_laser(WR_PRECACHE);
148         }
149         else if (req == WR_SETUP)
150                 weapon_setup(WEP_MINSTANEX);
151         else if (req == WR_CHECKAMMO1)
152         {
153                 if (g_minstagib)
154                         return self.ammo_cells >= 1;
155                 else
156                         return self.ammo_cells >= cvar("g_balance_minstanex_ammo");
157         }
158         else if (req == WR_CHECKAMMO2)
159                 return FALSE;
160         else if (req == WR_SUICIDEMESSAGE)
161                 w_deathtypestring = "did the impossible";
162         else if (req == WR_KILLMESSAGE)
163                 w_deathtypestring = "has been vaporized by";
164         else if (req == WR_SPAWNFUNC)
165                 spawnfunc_weapon_minstanex();
166         return TRUE;
167 };