]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/w_nex.qc
DP_QC_URI_ESCAPE
[divverent/nexuiz.git] / data / qcsrc / server / w_nex.qc
1
2 void W_Nex_Attack (void)
3 {
4         W_SetupShot (self, '25 4 -4', TRUE, 5, "weapons/nexfire.wav");
5         //W_SetupShot (self, '25 8 -8', TRUE, 2, "weapons/nexfire.wav"); // TODO: move model down a little
6
7         // assure that nexdamage is high enough in minstagib
8         if (g_minstagib)
9                 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, 1000, 800, IT_NEX);
10         else
11         {
12                 yoda = 0;
13                 FireRailgunBullet (w_shotorg, w_shotorg + w_shotdir * MAX_SHOT_DISTANCE, cvar("g_balance_nex_damage"), cvar("g_balance_nex_force"), IT_NEX);
14                 if(yoda)
15                         if(IsFlying(self))
16                                 announce(self, "announcer/male/yoda.ogg");
17         }
18
19         pointparticles(particleeffectnum("nex_muzzleflash"), w_shotorg, w_shotdir * 1000, 1);
20
21         // beam effect
22         trailparticles(world, particleeffectnum("nex_beam"), w_shotorg, trace_endpos);
23         // flash and burn the wall
24         if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
25                 pointparticles(particleeffectnum("nex_impact"), trace_endpos - w_shotdir * 6, '0 0 0', 1);
26         // play a sound
27         PointSound (trace_endpos, "weapons/neximpact.wav", 1, ATTN_NORM);
28
29         if (cvar("g_use_ammunition") && !g_instagib)
30         {
31                 if (g_minstagib)
32                         self.ammo_cells = self.ammo_cells - 1;
33                 else
34                         self.ammo_cells = self.ammo_cells - cvar("g_balance_nex_ammo");
35         }
36 }
37
38
39 .float minstagib_nextthink;
40 void minstagib_ammocheck (void)
41 {
42         if (time < self.minstagib_nextthink || self.deadflag || gameover)
43                 return;
44
45         if (self.ammo_cells <= 0)
46         {
47                 if (self.health == 5)
48                 {
49                         centerprint(self, "you're dead now...\n");
50                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
51                         announce(self, "announcer/robotic/terminated.ogg");
52                 }
53                 if (self.health == 10)
54                 {
55                         centerprint(self, "^11^7 second left to find some ammo\n");
56                         Damage(self, self, self, 5, DEATH_NOAMMO, self.origin, '0 0 0');
57                         announce(self, "announcer/robotic/1.ogg");
58                 }
59                 if (self.health == 20)
60                 {
61                         centerprint(self, "^12^7 seconds left to find some ammo\n");
62                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
63                         announce(self, "announcer/robotic/2.ogg");
64                 }
65                 if (self.health == 30)
66                 {
67                         centerprint(self, "^13^7 seconds left to find some ammo\n");
68                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
69                         announce(self, "announcer/robotic/3.ogg");
70                 }
71                 if (self.health == 40)
72                 {
73                         centerprint(self, "^14^7 seconds left to find some ammo\n");
74                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
75                         announce(self, "announcer/robotic/4.ogg");
76                 }
77                 if (self.health == 50)
78                 {
79                         centerprint(self, "^15^7 seconds left to find some ammo\n");
80                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
81                         announce(self, "announcer/robotic/5.ogg");
82                 }
83                 if (self.health == 60)
84                 {
85                         centerprint(self, "^36^7 seconds left to find some ammo\n");
86                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
87                         announce(self, "announcer/robotic/6.ogg");
88                 }
89                 if (self.health == 70)
90                 {
91                         centerprint(self, "^37^7 seconds left to find some ammo\n");
92                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
93                         announce(self, "announcer/robotic/7.ogg");
94                 }
95                 if (self.health == 80)
96                 {
97                         centerprint(self, "^38^7 seconds left to find some ammo\n");
98                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
99                         announce(self, "announcer/robotic/8.ogg");
100                 }
101                 if (self.health == 90)
102                 {
103                         centerprint(self, "^39^7 seconds left to find some ammo\n");
104                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
105                         announce(self, "announcer/robotic/9.ogg");
106                 }
107                 if (self.health == 100)
108                 {
109                         centerprint(self, "get some ammo or\nyou'll be dead in ^310^7 seconds...");
110                         Damage(self, self, self, 10, DEATH_NOAMMO, self.origin, '0 0 0');
111                         announce(self, "announcer/robotic/10.ogg");
112                 }
113         }
114         self.minstagib_nextthink = time + 1;
115 }
116
117 float(float req) w_nex =
118 {
119         if (req == WR_AIM)
120                 self.button0 = bot_aim(1000000, 0, 1, FALSE);
121         else if (req == WR_THINK)
122         {
123                 if (self.button0)
124                 {
125                         if(g_minstagib)
126                         {
127                                 if (weapon_prepareattack(0, cvar("g_balance_minstagib_nex_refire")))
128                                 {
129                                         W_Nex_Attack();
130                                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_minstagib_nex_animtime"), w_ready);
131                                 }
132                         }
133                         else
134                         {
135                                 if (weapon_prepareattack(0, cvar("g_balance_nex_refire")))
136                                 {
137                                         W_Nex_Attack();
138                                         weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_nex_animtime"), w_ready);
139                                 }
140                         }
141                 }
142                 else if (self.button3)
143                 {
144                         if (g_minstagib)
145                         {
146                                 if (self.jump_interval <= time)
147                                 {
148                                         self.jump_interval = time + 0.9;
149                                         W_Laser_Attack(FALSE);
150                                 }
151                         }
152                 }
153         }
154         else if (req == WR_PRECACHE)
155         {
156                 precache_model ("models/nexflash.md3");
157                 precache_model ("models/weapons/g_nex.md3");
158                 precache_model ("models/weapons/v_nex.md3");
159                 precache_model ("models/weapons/w_nex.zym");
160                 precache_sound ("weapons/nexfire.wav");
161                 precache_sound ("weapons/neximpact.wav");
162                 if(g_minstagib)
163                         w_laser(WR_PRECACHE);
164         }
165         else if (req == WR_SETUP)
166                 weapon_setup(WEP_NEX, "nex", IT_CELLS);
167         else if (req == WR_CHECKAMMO1)
168         {
169                 if (g_minstagib)
170                         return self.ammo_cells >= 1;
171                 else
172                         return self.ammo_cells >= cvar("g_balance_nex_ammo");
173         }
174         else if (req == WR_CHECKAMMO2)
175                 return FALSE;
176         else if (req == WR_REGISTER)
177         {
178                 if(g_minstagib)
179                         weapon_register(WEP_NEX, 1);
180                 else
181                         weapon_register(WEP_NEX, cvar("g_balance_nex_ammo"));
182         }
183         return TRUE;
184 };