player.qc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837
  1. /* Copyright (C) 1996-2022 id Software LLC
  2. This program is free software; you can redistribute it and/or modify
  3. it under the terms of the GNU General Public License as published by
  4. the Free Software Foundation; either version 2 of the License, or
  5. (at your option) any later version.
  6. This program is distributed in the hope that it will be useful,
  7. but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. GNU General Public License for more details.
  10. You should have received a copy of the GNU General Public License
  11. along with this program; if not, write to the Free Software
  12. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  13. See file, 'COPYING', for details.
  14. */
  15. void() bubble_bob;
  16. /*
  17. ==============================================================================
  18. PLAYER
  19. ==============================================================================
  20. */
  21. $cd /raid/quake/id1/models/player_4
  22. $origin 0 -6 24
  23. $base base
  24. $skin skin
  25. //
  26. // running
  27. //
  28. $frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
  29. $frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
  30. //
  31. // standing
  32. //
  33. $frame stand1 stand2 stand3 stand4 stand5
  34. $frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
  35. $frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
  36. //
  37. // pain
  38. //
  39. $frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
  40. $frame pain1 pain2 pain3 pain4 pain5 pain6
  41. //
  42. // death
  43. //
  44. $frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
  45. $frame axdeth7 axdeth8 axdeth9
  46. $frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
  47. $frame deatha9 deatha10 deatha11
  48. $frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
  49. $frame deathb9
  50. $frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
  51. $frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
  52. $frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
  53. $frame deathd8 deathd9
  54. $frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
  55. $frame deathe8 deathe9
  56. //
  57. // attacks
  58. //
  59. $frame nailatt1 nailatt2
  60. $frame light1 light2
  61. $frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
  62. $frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
  63. $frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
  64. $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
  65. $frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
  66. $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
  67. /*
  68. ==============================================================================
  69. PLAYER
  70. ==============================================================================
  71. */
  72. void() player_run;
  73. void() player_stand1 =[ $axstnd1, player_stand1 ]
  74. {
  75. self.weaponframe=0;
  76. if (self.velocity_x || self.velocity_y)
  77. {
  78. self.walkframe=0;
  79. player_run();
  80. return;
  81. }
  82. if (self.weapon == IT_AXE)
  83. {
  84. if (self.walkframe >= 12)
  85. self.walkframe = 0;
  86. self.frame = $axstnd1 + self.walkframe;
  87. }
  88. else
  89. {
  90. if (self.walkframe >= 5)
  91. self.walkframe = 0;
  92. self.frame = $stand1 + self.walkframe;
  93. }
  94. self.walkframe = self.walkframe + 1;
  95. };
  96. void() player_run =[ $rockrun1, player_run ]
  97. {
  98. self.weaponframe=0;
  99. if (!self.velocity_x && !self.velocity_y)
  100. {
  101. self.walkframe=0;
  102. player_stand1();
  103. return;
  104. }
  105. if (self.weapon == IT_AXE)
  106. {
  107. if (self.walkframe == 6)
  108. self.walkframe = 0;
  109. self.frame = $axrun1 + self.walkframe;
  110. }
  111. else
  112. {
  113. if (self.walkframe == 6)
  114. self.walkframe = 0;
  115. self.frame = self.frame + self.walkframe;
  116. }
  117. self.walkframe = self.walkframe + 1;
  118. };
  119. void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;
  120. self.effects = self.effects | EF_MUZZLEFLASH;};
  121. void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
  122. void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
  123. void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
  124. void() player_shot5 = [$shotatt5, player_shot6 ] {self.weaponframe=5;};
  125. void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
  126. void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
  127. void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};
  128. void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe=3;W_FireAxe();};
  129. void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
  130. void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe=5;};
  131. void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe=6;};
  132. void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe=7;W_FireAxe();};
  133. void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
  134. void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe=1;};
  135. void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe=2;};
  136. void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe=3;W_FireAxe();};
  137. void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
  138. void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe=5;};
  139. void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe=6;};
  140. void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe=7;W_FireAxe();};
  141. void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
  142. //============================================================================
  143. //ZOID--
  144. void() player_grapple3;
  145. void() player_grapple4;
  146. void() player_grapple5;
  147. void() player_grapple1 = [$axattd1, player_grapple2 ]
  148. { self.weaponframe=1; W_FireGrapple(); };
  149. // { self.weaponframe=2; W_FireGrapple(); };
  150. void() player_grapple2 = [$axattd2, player_grapple3 ]
  151. { self.weaponframe=2; };
  152. // { self.weaponframe=3; };
  153. void() player_grapple3 = [$axattd3, player_grapple3 ]
  154. {
  155. // self.weaponframe=3;
  156. self.weaponframe=2;
  157. if (!self.hook_out) {
  158. player_grapple5();
  159. return;
  160. }
  161. if (vlen(self.hook.origin - self.origin) >= 50) {
  162. if (self.on_hook) {
  163. player_grapple4();
  164. return;
  165. }
  166. }
  167. };
  168. void() player_grapple4 = [$deathc4, player_grapple4 ]
  169. {
  170. // self.weaponframe=4;
  171. self.weaponframe=2;
  172. if (!self.hook_out) {
  173. player_grapple5();
  174. return;
  175. }
  176. if (vlen(self.hook.origin - self.origin) < 50 || !self.on_hook) {
  177. player_grapple3();
  178. return;
  179. }
  180. };
  181. void() player_grapple5 = [$axattd4, player_run ]
  182. // {self.weaponframe=5;};
  183. {self.weaponframe=1;};
  184. //--ZOID
  185. //============================================================================
  186. void() player_nail1 =[$nailatt1, player_nail2 ]
  187. {
  188. self.effects = self.effects | EF_MUZZLEFLASH;
  189. if (!self.button0)
  190. {player_run ();return;}
  191. self.weaponframe = self.weaponframe + 1;
  192. if (self.weaponframe == 9)
  193. self.weaponframe = 1;
  194. SuperDamageSound();
  195. W_FireSpikes (4);
  196. self.attack_finished = time + 0.2;
  197. };
  198. void() player_nail2 =[$nailatt2, player_nail1 ]
  199. {
  200. self.effects = self.effects | EF_MUZZLEFLASH;
  201. if (!self.button0)
  202. {player_run ();return;}
  203. self.weaponframe = self.weaponframe + 1;
  204. if (self.weaponframe == 9)
  205. self.weaponframe = 1;
  206. SuperDamageSound();
  207. W_FireSpikes (-4);
  208. self.attack_finished = time + 0.2;
  209. };
  210. //============================================================================
  211. void(float ox) W_FireLavaSpikes;
  212. void() player_lava_nail1 =[$nailatt1, player_lava_nail2 ]
  213. {
  214. self.effects = self.effects | EF_MUZZLEFLASH;
  215. if (!self.button0)
  216. {player_run ();return;}
  217. self.weaponframe = self.weaponframe + 1;
  218. if (self.weaponframe == 9)
  219. self.weaponframe = 1;
  220. SuperDamageSound();
  221. W_FireLavaSpikes (4);
  222. self.attack_finished = time + 0.2;
  223. };
  224. void() player_lava_nail2 =[$nailatt2, player_lava_nail1 ]
  225. {
  226. self.effects = self.effects | EF_MUZZLEFLASH;
  227. if (!self.button0)
  228. {player_run ();return;}
  229. self.weaponframe = self.weaponframe + 1;
  230. if (self.weaponframe == 9)
  231. self.weaponframe = 1;
  232. SuperDamageSound();
  233. W_FireLavaSpikes (-4);
  234. self.attack_finished = time + 0.2;
  235. };
  236. //============================================================================
  237. void() W_FirePlasma;
  238. void() player_light1 =[$light1, player_light2 ]
  239. {
  240. self.effects = self.effects | EF_MUZZLEFLASH;
  241. if (!self.button0)
  242. {player_run ();return;}
  243. self.weaponframe = self.weaponframe + 1;
  244. if (self.weaponframe == 5)
  245. self.weaponframe = 1;
  246. SuperDamageSound();
  247. if (self.weapon == IT_LIGHTNING)
  248. {
  249. W_FireLightning();
  250. self.attack_finished = time + 0.2;
  251. }
  252. else if (self.weapon == IT_PLASMA_GUN)
  253. {
  254. W_FirePlasma();
  255. player_run();
  256. return;
  257. }
  258. };
  259. void() player_light2 =[$light2, player_light1 ]
  260. {
  261. self.effects = self.effects | EF_MUZZLEFLASH;
  262. if (!self.button0)
  263. {player_run ();return;}
  264. self.weaponframe = self.weaponframe + 1;
  265. if (self.weaponframe == 5)
  266. self.weaponframe = 1;
  267. SuperDamageSound();
  268. if (self.weapon == IT_LIGHTNING)
  269. {
  270. W_FireLightning();
  271. self.attack_finished = time + 0.2;
  272. }
  273. };
  274. //============================================================================
  275. void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
  276. self.effects = self.effects | EF_MUZZLEFLASH;};
  277. void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
  278. void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
  279. void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
  280. void() player_rocket5 =[$rockatt5, player_rocket6 ] {self.weaponframe=5;};
  281. void() player_rocket6 =[$rockatt6, player_run ] {self.weaponframe=6;};
  282. void(float num_bubbles) DeathBubbles;
  283. void() PainSound =
  284. {
  285. local float rs;
  286. if (self.health < 0)
  287. return;
  288. if (damage_attacker.classname == "teledeath")
  289. {
  290. sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  291. return;
  292. }
  293. // water pain sounds
  294. if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
  295. {
  296. DeathBubbles(1);
  297. if (random() > 0.5)
  298. sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
  299. else
  300. sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
  301. return;
  302. }
  303. // slime pain sounds
  304. if (self.watertype == CONTENT_SLIME)
  305. {
  306. // FIX ME put in some steam here
  307. if (random() > 0.5)
  308. sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  309. else
  310. sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  311. return;
  312. }
  313. if (self.watertype == CONTENT_LAVA)
  314. {
  315. if (random() > 0.5)
  316. sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
  317. else
  318. sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
  319. return;
  320. }
  321. if (self.pain_finished > time)
  322. {
  323. self.axhitme = 0;
  324. return;
  325. }
  326. self.pain_finished = time + 0.5;
  327. // don't make multiple pain sounds right after each other
  328. // ax pain sound
  329. if (self.axhitme == 1)
  330. {
  331. self.axhitme = 0;
  332. sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
  333. return;
  334. }
  335. rs = rint((random() * 5) + 1);
  336. self.noise = "";
  337. if (rs == 1)
  338. self.noise = "player/pain1.wav";
  339. else if (rs == 2)
  340. self.noise = "player/pain2.wav";
  341. else if (rs == 3)
  342. self.noise = "player/pain3.wav";
  343. else if (rs == 4)
  344. self.noise = "player/pain4.wav";
  345. else if (rs == 5)
  346. self.noise = "player/pain5.wav";
  347. else
  348. self.noise = "player/pain6.wav";
  349. sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
  350. return;
  351. };
  352. void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
  353. void() player_pain2 = [ $pain2, player_pain3 ] {};
  354. void() player_pain3 = [ $pain3, player_pain4 ] {};
  355. void() player_pain4 = [ $pain4, player_pain5 ] {};
  356. void() player_pain5 = [ $pain5, player_pain6 ] {};
  357. void() player_pain6 = [ $pain6, player_run ] {};
  358. void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
  359. void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
  360. void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
  361. void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
  362. void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
  363. void() player_axpain6 = [ $axpain6, player_run ] {};
  364. void() player_pain =
  365. {
  366. if (self.weaponframe)
  367. return;
  368. if (self.invisible_finished > time)
  369. return; // eyes don't have pain frames
  370. if (self.weapon == IT_AXE)
  371. player_axpain1 ();
  372. else
  373. player_pain1 ();
  374. };
  375. void() player_diea1;
  376. void() player_dieb1;
  377. void() player_diec1;
  378. void() player_died1;
  379. void() player_diee1;
  380. void() player_die_ax1;
  381. void() DeathBubblesSpawn =
  382. {
  383. local entity bubble;
  384. if (self.owner.waterlevel != 3)
  385. return;
  386. bubble = spawn();
  387. setmodel (bubble, "progs/s_bubble.spr");
  388. setorigin (bubble, self.owner.origin + '0 0 24');
  389. bubble.movetype = MOVETYPE_NOCLIP;
  390. bubble.solid = SOLID_NOT;
  391. bubble.velocity = '0 0 15';
  392. bubble.nextthink = time + 0.5;
  393. bubble.think = bubble_bob;
  394. bubble.classname = "bubble";
  395. bubble.frame = 0;
  396. bubble.cnt = 0;
  397. setsize (bubble, '-8 -8 -8', '8 8 8');
  398. self.nextthink = time + 0.1;
  399. self.think = DeathBubblesSpawn;
  400. self.air_finished = self.air_finished + 1;
  401. if (self.air_finished >= self.bubble_count)
  402. remove(self);
  403. };
  404. void(float num_bubbles) DeathBubbles =
  405. {
  406. local entity bubble_spawner;
  407. bubble_spawner = spawn();
  408. setorigin (bubble_spawner, self.origin);
  409. bubble_spawner.movetype = MOVETYPE_NONE;
  410. bubble_spawner.solid = SOLID_NOT;
  411. bubble_spawner.nextthink = time + 0.1;
  412. bubble_spawner.think = DeathBubblesSpawn;
  413. bubble_spawner.air_finished = 0;
  414. bubble_spawner.owner = self;
  415. bubble_spawner.bubble_count = num_bubbles;
  416. return;
  417. };
  418. void() DeathSound =
  419. {
  420. local float rs;
  421. // water death sounds
  422. if (self.waterlevel == 3)
  423. {
  424. DeathBubbles(20);
  425. sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
  426. return;
  427. }
  428. rs = rint ((random() * 4) + 1);
  429. if (rs == 1)
  430. self.noise = "player/death1.wav";
  431. if (rs == 2)
  432. self.noise = "player/death2.wav";
  433. if (rs == 3)
  434. self.noise = "player/death3.wav";
  435. if (rs == 4)
  436. self.noise = "player/death4.wav";
  437. if (rs == 5)
  438. self.noise = "player/death5.wav";
  439. sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
  440. return;
  441. };
  442. void() PlayerDead =
  443. {
  444. self.nextthink = -1;
  445. // allow respawn after a certain time
  446. self.deadflag = DEAD_DEAD;
  447. };
  448. vector(float dm) VelocityForDamage =
  449. {
  450. local vector v;
  451. v_x = 100 * crandom();
  452. v_y = 100 * crandom();
  453. v_z = 200 + 100 * random();
  454. if (dm > -50)
  455. {
  456. // dprint ("level 1\n");
  457. v = v * 0.7;
  458. }
  459. else if (dm > -200)
  460. {
  461. // dprint ("level 3\n");
  462. v = v * 2;
  463. }
  464. else
  465. v = v * 10;
  466. return v;
  467. };
  468. void(string gibname, float dm) ThrowGib =
  469. {
  470. local entity new;
  471. new = spawn();
  472. new.origin = self.origin;
  473. setmodel (new, gibname);
  474. setsize (new, '0 0 0', '0 0 0');
  475. new.velocity = VelocityForDamage (dm);
  476. new.movetype = MOVETYPE_BOUNCE;
  477. new.solid = SOLID_NOT;
  478. new.avelocity_x = random()*600;
  479. new.avelocity_y = random()*600;
  480. new.avelocity_z = random()*600;
  481. new.think = SUB_Remove;
  482. new.ltime = time;
  483. new.nextthink = time + 10 + random()*10;
  484. new.frame = 0;
  485. new.flags = 0;
  486. };
  487. void(string gibname, float dm) ThrowHead =
  488. {
  489. setmodel (self, gibname);
  490. self.frame = 0;
  491. self.nextthink = -1;
  492. self.movetype = MOVETYPE_BOUNCE;
  493. self.takedamage = DAMAGE_NO;
  494. self.solid = SOLID_NOT;
  495. self.view_ofs = '0 0 8';
  496. setsize (self, '-16 -16 0', '16 16 56');
  497. self.velocity = VelocityForDamage (dm);
  498. self.origin_z = self.origin_z - 24;
  499. self.flags = self.flags - (self.flags & FL_ONGROUND);
  500. self.avelocity = crandom() * '0 600 0';
  501. };
  502. void() GibPlayer =
  503. {
  504. ThrowHead ("progs/h_player.mdl", self.health);
  505. ThrowGib ("progs/gib1.mdl", self.health);
  506. ThrowGib ("progs/gib2.mdl", self.health);
  507. ThrowGib ("progs/gib3.mdl", self.health);
  508. self.deadflag = DEAD_DEAD;
  509. if (damage_attacker.classname == "teledeath")
  510. {
  511. sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  512. return;
  513. }
  514. if (damage_attacker.classname == "teledeath2")
  515. {
  516. sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
  517. return;
  518. }
  519. if (random() < 0.5)
  520. sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
  521. else
  522. sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
  523. };
  524. void() PlayerDie =
  525. {
  526. local float i;
  527. self.items = self.items - (self.items & IT_INVISIBILITY);
  528. self.invisible_finished = 0; // don't die as eyes
  529. self.invincible_finished = 0;
  530. self.super_damage_finished = 0;
  531. self.radsuit_finished = 0;
  532. self.modelindex = modelindex_player; // don't use eyes
  533. self.gravity = 1.0;
  534. self.shield_finished = 0;
  535. self.antigrav_finished = 0;
  536. //ZOID--
  537. if (deathmatch || coop)
  538. {
  539. DropBackpack();
  540. TeamDropFlagOfPlayer(self);
  541. DropRune();
  542. }
  543. if (self.ctf_killed == 2)
  544. self.ctf_killed = 0;
  545. else
  546. self.ctf_killed = 1;
  547. //--ZOID
  548. self.weaponmodel="";
  549. self.view_ofs = '0 0 -8';
  550. self.deadflag = DEAD_DYING;
  551. self.solid = SOLID_NOT;
  552. self.flags = self.flags - (self.flags & FL_ONGROUND);
  553. self.movetype = MOVETYPE_TOSS;
  554. if (self.velocity_z < 10)
  555. self.velocity_z = self.velocity_z + random()*300;
  556. if (self.health < -40)
  557. {
  558. GibPlayer ();
  559. return;
  560. }
  561. DeathSound();
  562. self.angles_x = 0;
  563. self.angles_z = 0;
  564. if (self.weapon == IT_AXE)
  565. {
  566. player_die_ax1 ();
  567. return;
  568. }
  569. i = cvar("temp1");
  570. if (!i)
  571. i = 1 + floor(random()*6);
  572. if (i == 1)
  573. player_diea1();
  574. else if (i == 2)
  575. player_dieb1();
  576. else if (i == 3)
  577. player_diec1();
  578. else if (i == 4)
  579. player_died1();
  580. else
  581. player_diee1();
  582. };
  583. void() set_suicide_frame =
  584. { // used by klill command and diconnect command
  585. if (self.model != "progs/player.mdl")
  586. return; // allready gibbed
  587. self.frame = $deatha11;
  588. self.solid = SOLID_NOT;
  589. self.movetype = MOVETYPE_TOSS;
  590. self.deadflag = DEAD_DEAD;
  591. self.nextthink = -1;
  592. };
  593. void() player_diea1 = [ $deatha1, player_diea2 ] {};
  594. void() player_diea2 = [ $deatha2, player_diea3 ] {};
  595. void() player_diea3 = [ $deatha3, player_diea4 ] {};
  596. void() player_diea4 = [ $deatha4, player_diea5 ] {};
  597. void() player_diea5 = [ $deatha5, player_diea6 ] {};
  598. void() player_diea6 = [ $deatha6, player_diea7 ] {};
  599. void() player_diea7 = [ $deatha7, player_diea8 ] {};
  600. void() player_diea8 = [ $deatha8, player_diea9 ] {};
  601. void() player_diea9 = [ $deatha9, player_diea10 ] {};
  602. void() player_diea10 = [ $deatha10, player_diea11 ] {};
  603. void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
  604. void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
  605. void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
  606. void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
  607. void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
  608. void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
  609. void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
  610. void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
  611. void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
  612. void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
  613. void() player_diec1 = [ $deathc1, player_diec2 ] {};
  614. void() player_diec2 = [ $deathc2, player_diec3 ] {};
  615. void() player_diec3 = [ $deathc3, player_diec4 ] {};
  616. void() player_diec4 = [ $deathc4, player_diec5 ] {};
  617. void() player_diec5 = [ $deathc5, player_diec6 ] {};
  618. void() player_diec6 = [ $deathc6, player_diec7 ] {};
  619. void() player_diec7 = [ $deathc7, player_diec8 ] {};
  620. void() player_diec8 = [ $deathc8, player_diec9 ] {};
  621. void() player_diec9 = [ $deathc9, player_diec10 ] {};
  622. void() player_diec10 = [ $deathc10, player_diec11 ] {};
  623. void() player_diec11 = [ $deathc11, player_diec12 ] {};
  624. void() player_diec12 = [ $deathc12, player_diec13 ] {};
  625. void() player_diec13 = [ $deathc13, player_diec14 ] {};
  626. void() player_diec14 = [ $deathc14, player_diec15 ] {};
  627. void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
  628. void() player_died1 = [ $deathd1, player_died2 ] {};
  629. void() player_died2 = [ $deathd2, player_died3 ] {};
  630. void() player_died3 = [ $deathd3, player_died4 ] {};
  631. void() player_died4 = [ $deathd4, player_died5 ] {};
  632. void() player_died5 = [ $deathd5, player_died6 ] {};
  633. void() player_died6 = [ $deathd6, player_died7 ] {};
  634. void() player_died7 = [ $deathd7, player_died8 ] {};
  635. void() player_died8 = [ $deathd8, player_died9 ] {};
  636. void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
  637. void() player_diee1 = [ $deathe1, player_diee2 ] {};
  638. void() player_diee2 = [ $deathe2, player_diee3 ] {};
  639. void() player_diee3 = [ $deathe3, player_diee4 ] {};
  640. void() player_diee4 = [ $deathe4, player_diee5 ] {};
  641. void() player_diee5 = [ $deathe5, player_diee6 ] {};
  642. void() player_diee6 = [ $deathe6, player_diee7 ] {};
  643. void() player_diee7 = [ $deathe7, player_diee8 ] {};
  644. void() player_diee8 = [ $deathe8, player_diee9 ] {};
  645. void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
  646. void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
  647. void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
  648. void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
  649. void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
  650. void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
  651. void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
  652. void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
  653. void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
  654. void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
  655. void(entity shieldOwner, vector dir) shield_spawn;
  656. void() player_touch =
  657. {
  658. local vector vec;
  659. local float dot;
  660. local float doDamage;
  661. if ( self.items2 & IT2_SHIELD)
  662. {
  663. if ( other.classname == "player")
  664. {
  665. makevectors ( self.angles );
  666. vec = normalize (other.origin - self.origin);
  667. dot = vec * v_forward;
  668. if (dot < 0.3)
  669. return;
  670. makevectors ( self.angles );
  671. other.velocity = v_forward * 500;
  672. other.velocity_z = 250;
  673. doDamage = FALSE;
  674. if (TeamArmorDam(other, self, self, 15))
  675. {
  676. if(self.shield_death_time < time)
  677. doDamage = TRUE;
  678. }
  679. // if shield has timed out, respawn it.
  680. // don't do particles more than twice a second.
  681. if ( self.shield_death_time < time)
  682. {
  683. sound(self,CHAN_WEAPON,"enforcer/enfstop.wav", 1, ATTN_NORM);
  684. WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
  685. WriteByte (MSG_BROADCAST, TE_EXPLOSION2);
  686. WriteCoord (MSG_BROADCAST, other.origin_x);
  687. WriteCoord (MSG_BROADCAST, other.origin_y);
  688. WriteCoord (MSG_BROADCAST, other.origin_z);
  689. WriteByte (MSG_BROADCAST, 230);
  690. WriteByte (MSG_BROADCAST, 5);
  691. shield_spawn ( self, v_forward );
  692. }
  693. if (doDamage)
  694. T_Damage (other, self.shield_entity, self.shield_entity, 15);
  695. // self.shield_death_time = time + 0.5;
  696. }
  697. }
  698. };