Guest User

Untitled

a guest
Jan 11th, 2015
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.14 KB | None | 0 0
  1. //sounds
  2. datablock AudioProfile(NerveFlayerFire1Sound)
  3. {
  4. filename = "./res/sounds/sniper/sniper_fire01.wav";
  5. description = AudioClose3d;
  6. preload = true;
  7. };
  8.  
  9. datablock AudioProfile(NerveFlayerFire2Sound)
  10. {
  11. filename = "./res/sounds/sniper/sniper_fire02.wav";
  12. description = AudioClose3d;
  13. preload = true;
  14. };
  15.  
  16. datablock AudioProfile(NerveFlayerFire3Sound)
  17. {
  18. filename = "./res/sounds/sniper/sniper_fire03.wav";
  19. description = AudioClose3d;
  20. preload = true;
  21. };
  22.  
  23. datablock AudioProfile(NerveFlayerReloadSound)
  24. {
  25. filename = "./res/sounds/sniper/sniper_reload.wav";
  26. description = AudioClosest3d;
  27. preload = true;
  28. };
  29.  
  30. datablock AudioProfile(NerveFlayerActivateSound)
  31. {
  32. filename = "./res/sounds/shared/generic_activate-03.wav";
  33. description = AudioClosest3d;
  34. preload = true;
  35. };
  36.  
  37. addDamageType("NerveFlayer", '', '%2 <bitmap:base/client/ui/ci/generic> %1', 0.2, 1);
  38. addDamageType("NerveFlayerCrit", '', '%2 <bitmap:base/client/ui/ci/skull> <bitmap:base/client/ui/ci/generic> %1', 0.2, 1);
  39.  
  40.  
  41. datablock ItemData(GenericSniperLizzyItem)
  42. {
  43. category = "Weapon";
  44. className = "Weapon";
  45.  
  46. shapeFile = "./res/shapes/SNIPER.dts";
  47. rotate = false;
  48. mass = 1;
  49. density = 0.2;
  50. elasticity = 0.2;
  51. friction = 0.6;
  52. emap = true;
  53.  
  54. uiName = "Nerve Flayer";
  55. image = GenericSniperLizzyImage;
  56. canDrop = true;
  57.  
  58. maxmag = 1;
  59. ammotype = "NF Ammo";
  60. reload = true;
  61. };
  62.  
  63. ////////////////
  64. //weapon image//
  65. ////////////////
  66. datablock ShapeBaseImageData(GenericSniperLizzyImage)
  67. {
  68. shapeFile = "./res/shapes/SNIPER.dts";
  69. emap = true;
  70.  
  71. mountPoint = 0;
  72. offset = "0 0 0";
  73. eyeOffset = "0.9 1.6 -0.8";
  74. rotation = eulerToMatrix( "0 0 0" );
  75.  
  76. correctMuzzleVector = true;
  77. className = "WeaponImage";
  78.  
  79. item = GenericSniperLizzyItem;
  80.  
  81. raycastEnabled = 1;
  82. raycastRange = 200;
  83. raycastHitExplosion = GenericProjectile;
  84. raycastHitPlayerExplosion = GenericPlayerImpactProjectile;
  85.  
  86. directDamage = 45;
  87. directDamageType = $DamageType::NerveFlayer;
  88.  
  89. directCritDamage = 135;
  90. directCritDamageType = $DamageType::NerveFlayerCrit;
  91.  
  92. raycastSpread = 2;
  93. raycastCount = 1;
  94.  
  95. raycastTracer = GenericTracerShapeData;
  96. raycastTracerTime = 64;
  97. raycastTracerSize = 0.5;
  98. raycastTracerColor = "0.9 0.5 0.1 1";
  99.  
  100. casing = GenericPistolShellDebris;
  101. shellExitDir = "0.5 -1.3 0.5";
  102. shellExitOffset = "0 0 0";
  103. shellExitVariance = 15.0;
  104. shellVelocity = 7.0;
  105.  
  106. melee = false;
  107. armReady = true;
  108.  
  109. doColorShift = 0.25;
  110. colorShiftColor = "0.342 0.196 0 1.000";
  111.  
  112. // stateName[0] = "Activate";
  113. // stateSequence[0] = "Activate";
  114. // stateTransitionOnTimeout[0] = "AmmoCheck";
  115.  
  116. // stateName[1] = "Ready";
  117. // stateTransitionOnNoAmmo[1] = "Empty";
  118. // stateTransitionOnTriggerDown[1] = "Fire";
  119. // stateAllowImageChange[1] = true;
  120.  
  121. // stateName[2] = "Fire";
  122. // stateTransitionOnTriggerUp[2] = "Smoke";
  123. // stateTimeoutValue[2] = 0.25;
  124. // stateFire[2] = true;
  125. // stateAllowImageChange[2] = false;
  126. // stateSequence[2] = "Fire";
  127. // stateScript[2] = "onFire";
  128. // stateWaitForTimeout[2] = true;
  129. // stateEmitter[2] = GenericPistolFlashEmitter;
  130. // stateEmitterTime[2] = 0.05;
  131. // stateEmitterNode[2] = "muzzleNode";
  132. // stateEjectShell[2] = true;
  133.  
  134. // stateName[3] = "AmmoCheck";
  135. // stateTransitionOnTimeout[3] = "Ready";
  136. // stateAllowImageChange[3] = 1;
  137. // stateScript[3] = "onAmmoCheck";
  138.  
  139. // stateName[4] = "Reload";
  140. // stateTransitionOnTimeout[4] = "ReloadReady";
  141. // stateTimeoutValue[4] = 1.4;
  142. // stateAllowImageChange[4] = false;
  143. // //stateScript[4] = "onReloadStart";
  144. // stateScript[4] = "onReload";
  145. // stateSequence[4] = "Reload";
  146. // stateSound[4] = NerveFlayerReloadSound;
  147.  
  148. // stateName[5] = "ReloadReady";
  149. // stateTransitionOnTimeout[5] = "CheckChamber";
  150. // stateTimeoutValue[5] = 0.1;
  151. // stateAllowImageChange[5] = false;
  152. // //stateScript[5] = "onReload";
  153. // stateScript[5] = "onReloadReady";
  154. // stateSequence[5] = "";
  155.  
  156. // stateName[6] = "Empty";
  157. // stateTransitionOnTriggerDown[6] = "EmptyFire";
  158. // stateAllowImageChange[6] = true;
  159. // tateTransitionOnAmmo[7] = "Reload";
  160. // stateScript[6] = "onEmpty";
  161. // stateTransitionOnAmmo[6] = "Reload";
  162. // //stateSequence[6] = "empty";
  163.  
  164. // stateName[7] = "EmptyFire";
  165. // stateTransitionOnTriggerUp[7] = "Empty";
  166. // stateTimeoutValue[7] = 0.13;
  167. // stateAllowImageChange[7] = false;
  168. // stateWaitForTimeout[7] = true;
  169. // stateSound[7] = GenericEmptySound;
  170. // stateSequence[7] = "emptyFire";
  171. // stateScript[7] = "onEmptyFire";
  172.  
  173. // stateName[8] = "CheckChamber";
  174. // stateTransitionOnTimeOut[8] = "Ready";
  175. // stateTransitionOnNoAmmo[8] = "Cocking";
  176. // stateAllowImageChange[8] = true;
  177.  
  178. // stateName[9] = "Cocking";
  179. // stateTransitionOnTimeOut[9] = "Ready";
  180. // stateTimeoutValue[9] = 0.1;
  181. // stateAllowImageChange[9] = true;
  182. // stateWaitForTimeout[9] = true;
  183. // stateSound[9] = "";
  184. // stateScript[9] = "onCock";
  185.  
  186. // stateName[10] = "Smoke";
  187. // stateEmitter[10] = GenericPistolSmokeEmitter;
  188. // //stateTransitionOnTimeOut[10] = "AmmoCheck";
  189. // stateTransitionOnTimeout[10] = "Reload";
  190. // stateEmitterTime[10] = 0.05;
  191. // stateEmitterNode[10] = "muzzleNode";
  192.  
  193. stateName[0] = "Activate";
  194. //stateScript[0] = "onActivate";
  195. stateSequence[0] = "Activate";
  196. stateTimeoutValue[0] = 0.4;
  197. //stateWaitForTimeout[0] = 0;
  198. //stateTransitionOnNoAmmo[0] = "CheckAmmo";
  199. stateTransitionOnTimeout[0] = "CheckAmmo";
  200.  
  201. stateName[1] = "CheckAmmo";
  202. stateScript[1] = "onCheckAmmo";
  203. stateTransitionOnTimeout[1] = "Ready";
  204.  
  205. stateName[2] = "CheckReload";
  206. stateScript[2] = "onCheckReload";
  207. stateTransitionOnTimeout[2] = "Empty";
  208.  
  209. stateName[3] = "Empty";
  210. stateTimeoutValue[4] = 0.13;
  211. stateTransitionOnTriggerDown[3] = "EmptyFire";
  212. stateTransitionOnAmmo[3] = "Reload";
  213.  
  214. stateName[4] = "EmptyFire";
  215. stateScript[4] = "onEmptyFire";
  216. stateSound[4] = GenericEmptySound;
  217. stateSequence[4] = "emptyFire";
  218. stateAllowImageChange[4] = 0;
  219. //stateTimeoutValue[4] = 0.13;
  220. stateTransitionOnTriggerUp[4] = "Empty";
  221.  
  222. stateName[5] = "Ready";
  223. stateTransitionOnTriggerDown[5] = "Fire";
  224. stateTransitionOnNoAmmo[5] = "CheckReload";
  225.  
  226. stateName[6] = "Fire";
  227. stateFire[6] = 1;
  228. stateScript[6] = "onFire";
  229. stateEmitter[6] = GenericPistolFlashEmitter;
  230. stateEmitterTime[6] = 0.05;
  231. stateEmitterNode[6] = "muzzleNode";
  232. stateEjectShell[6] = 0;
  233. stateSequence[6] = "Fire";
  234. stateTimeoutValue[6] = 0.25;
  235. stateAllowImageChange[6] = 0;
  236. stateTransitionOnTriggerUp[6] = "Smoke";
  237.  
  238. stateName[7] = "Smoke";
  239. stateEmitter[7] = GenericPistolSmokeEmitter;
  240. stateEmitterTime[7] = 0.05;
  241. stateEmitterNode[7] = "muzzleNode";
  242. stateTimeoutValue[7] = 0.2;
  243. stateAllowImageChange[7] = 0;
  244. stateTransitionOnTimeout[7] = "CheckAmmo";
  245.  
  246. stateName[8] = "Reload";
  247. stateScript[8] = "onReload";
  248. stateSound[8] = NerveFlayerReloadSound;
  249. stateSequence[8] = "Reload";
  250. stateEjectShell[8] = 1;
  251. stateAllowImageChange[8] = 1;
  252. stateTimeoutValue[8] = 1.4;
  253. stateTransitionOnTimeout[8] = "ReloadFinish";
  254.  
  255. stateName[9] = "ReloadFinish";
  256. stateScript[9] = "onReloadFinish";
  257. stateAllowImageChange[9] = 0;
  258. // stateTimeoutValue[9] = 0.1;
  259. stateTransitionOnTimeout[9] = "CheckAmmo";
  260. };
  261.  
  262. function GenericSniperLizzyImage::onMount(%this, %obj, %slot)
  263. {
  264. genericDisplayAmmo(%this, %obj, %slot);
  265. }
  266.  
  267. function GenericSniperLizzyImage::onUnMount(%this, %obj, %slot)
  268. {
  269. genericDisplayAmmo(%this, %obj, %slot, -1);
  270. }
  271.  
  272. function GenericSniperLizzyImage::onCheckAmmo(%this, %obj, %slot)
  273. {
  274. %obj.setImageAmmo(%slot, 1);
  275. genericAmmoCheck(%this, %obj, %slot);
  276. genericDisplayAmmo(%this, %obj, %slot);
  277. //talk("::onCheckAmmo -> imageAmmo to " @ %obj.getImageAmmo(%slot));
  278. }
  279.  
  280. function GenericSniperLizzyImage::onCheckReload(%this, %obj, %slot)
  281. {
  282. %obj.setImageAmmo(%slot, %obj.toolAmmo[%this.item.ammoType] > 0);
  283. //talk("::onCheckReload -> imageAmmo to " @ %obj.getImageAmmo(%slot));
  284. }
  285.  
  286. function GenericSniperLizzyImage::onReload(%this, %obj, %slot)
  287. {
  288. %obj.playThread(2, "shiftRight");
  289. genericDisplayAmmo(%this, %obj, %slot);
  290. }
  291.  
  292. function GenericSniperLizzyImage::onReloadFinish(%this, %obj, %slot)
  293. {
  294. %obj.playThread(2, "plant");
  295. genericAmmoOnReload(%this, %obj, %slot);
  296. genericDisplayAmmo(%this, %obj, %slot);
  297. }
  298.  
  299. function GenericSniperLizzyImage::onEmptyFire(%this, %obj, %slot)
  300. {
  301. %obj.playThread(2, "plant");
  302. genericDisplayAmmo(%this, %obj, %slot);
  303. }
  304.  
  305. function GenericSniperLizzyImage::onFire(%this, %obj, %slot)
  306. {
  307. if (%obj.getDamagePercent() > 1.0)
  308. {
  309. return;
  310. }
  311.  
  312. if (isObject(%obj.client))
  313. {
  314. %x = getRandom() * 4 - 2;
  315. %y = 6 + getRandom() * 12;
  316.  
  317. commandToClient(%obj.client, 'AimRecoil', %x, -%y, 20);
  318. }
  319.  
  320. if($GenericWeapons::ammoSystem)
  321. {
  322. %obj.toolMag[%obj.currTool] -= 1;
  323.  
  324. if(%obj.toolMag[%obj.currTool] < 1)
  325. {
  326. %obj.toolMag[%obj.currTool] = 0;
  327. %obj.setImageAmmo(0,0);
  328. }
  329. GenericDisplayAmmo(%this,%obj,%slot);
  330. }
  331.  
  332. parent::onFire( %this, %obj, %slot );
  333.  
  334. %obj.playThread(2, shiftRight);
  335. %obj.playThread(3, shiftLeft);
  336. if(%obj.getMountedImage(0) == nameToID(GenericSniperLizzyImage))
  337. %shake = "0.5 0.5 0.5";
  338. else
  339. %shake = "0.25 0.25 0.25";
  340.  
  341. %obj.spawnExplosion(GenericRecoilSmallProjectile, %shake);
  342. serverPlay3d( "NerveFlayerFire" @ getRandom(1,2) @ "Sound", %obj.getHackPosition() );
  343. }
  344.  
  345. function GenericSniperLizzyImage::onRaycastCollision(%this, %obj, %col, %pos, %normal, %vec)
  346. {
  347. if( !( %col.getType() & $typeMasks::playerObjectType || %col.getType() & $typeMasks::corpseObjectType ) )
  348. {
  349. %rnd = getRandom( 1, 4 );
  350. serverPlay3d( GenericBulletHitSound @ %rnd, %pos );
  351. }
  352. else
  353. {
  354. %rnd = getRandom( 1, 4 );
  355. serverPlay3d( GenericFleshHitSound @ %rnd, %pos );
  356. }
  357.  
  358. if( !(%col.getType() & $typeMasks::playerObjectType) && !(%col.getType & $TypeMasks::vehicleObjectType) )
  359. {
  360. spawnDecal(gunShotShapeData, vectorAdd(%pos, vectorScale(%normal, 0.02)), %normal, 1);
  361. }
  362.  
  363. parent::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  364. }
  365.  
  366. function player::statedebug(%this,%prev)
  367. {
  368. cancel(%this.statedebug);
  369. %state=%this.getimagestate(0);
  370. if(%state!$=%prev)talk("state:" SPC %state);
  371. %this.statedebug=%this.schedule(0,statedebug,%state);
  372. }
  373.  
  374. function GenericSniperLizzyImage::damage(%this, %obj, %col, %pos, %normal, %vec)
  375. {
  376. %damage = 45;
  377. %type = $DamageType::NerveFlayer;
  378.  
  379. %z = getWord(%col.getScale(), 2);
  380.  
  381. if (getWord(%pos, 2) > getword(%col.getWorldBoxCenter(), 2) - 3.3 * %z)
  382. {
  383. %damage = 150;
  384. %type = $DamageType::NerveFlayerCrit;
  385.  
  386. if (isObject(CritProjectile))
  387. {
  388. %col.spawnExplosion(CritProjectile, %z);
  389.  
  390. if (isObject(%col.client))
  391. {
  392. %col.client.play2D(CritRecieveSound);
  393. }
  394.  
  395. if (%obj.getType() & $TypeMasks::PlayerObjectType)
  396. {
  397. serverPlay3D(CritFireSound, %obj.getHackPosition());
  398.  
  399. if (isObject(%obj.client))
  400. {
  401. %obj.client.play2d(CritHitSound);
  402. }
  403. }
  404. }
  405. }
  406.  
  407. %col.damage(%obj, %pos, %damage * %obj.getSize(), %type);
  408.  
  409. if (%this.raycastImpactImpulse)
  410. {
  411. %col.applyImpulse(%pos, vectorScale(%vec, %this.impactImpulse));
  412. }
  413.  
  414. if (%this.raycastVerticalImpulse)
  415. {
  416. %col.applyImpulse(%pos, vectorScale("0 0 1", %this.verticalImpulse));
  417. }
  418. }
  419.  
  420. // Scope
  421.  
  422. datablock ShapeBaseImageData(GenericSniperLizzyScopeImage : GenericSniperLizzyImage)
  423. {
  424. zoom = 0.80;
  425.  
  426. shapeFile = "./res/shapes/SNIPER.dts";
  427. eyeOffset = "0.00536 0.003 -0.99";
  428. raycastSpread = 0;
  429.  
  430. // Bring up scope faster
  431. stateScript[0] = "";
  432. stateTimeoutValue[0] = 0.2;
  433. stateWaitForTimeout[0] = "";
  434. stateTransitionOnNoAmmo[0] = "";
  435.  
  436. // Unscope instead of reloading
  437. stateTransitionOnTimeout[2] = "ExitScope";
  438. stateTransitionOnAmmo[3] = "ExitScope";
  439.  
  440. stateName[11] = "ExitScope";
  441. stateScript[11] = "onExitScope";
  442. stateAllowImageChange[11] = 1;
  443. };
  444.  
  445. function GenericSniperLizzyScopeImage::onMount(%this, %obj, %slot)
  446. {
  447. Parent::onMount(%this, %obj, %slot);
  448.  
  449. GenericDisplayAmmo(%this, %obj, %slot, 0);
  450. %obj.playThread(3, shiftLeft);
  451. }
  452.  
  453. function GenericSniperLizzyScopeImage::onUnMount(%this, %obj, %slot)
  454. {
  455. Parent::onUnMount(%this, %obj, %slot);
  456. GenericDisplayAmmo(%this, %obj, %slot, -1);
  457. }
  458.  
  459. function GenericSniperLizzyScopeImage::onExitScope(%this, %obj, %slot)
  460. {
  461. %obj.mountImage(GenericSniperLizzyImage, %slot);
  462. fixArmReady(%obj);
  463. }
  464.  
  465. function GenericSniperLizzyScopeImage::onFire(%this, %obj, %slot)
  466. {
  467. GenericSniperLizzyImage::onFire(%this, %obj, %slot);
  468. }
  469.  
  470. function GenericSniperLizzyScopeImage::onReloadFinish(%this, %obj, %slot)
  471. {
  472. GenericSniperLizzyImage::onReloadFinish(%this, %obj, %slot);
  473. }
  474.  
  475. function GenericSniperLizzyScopeImage::onCheckAmmo(%this, %obj, %slot)
  476. {
  477. GenericSniperLizzyImage::onCheckAmmo(%this, %obj, %slot);
  478. }
  479.  
  480. function GenericSniperLizzyScopeImage::onCheckReload(%this, %obj, %slot)
  481. {
  482. GenericSniperLizzyImage::onCheckReload(%this, %obj, %slot);
  483. }
  484.  
  485. function GenericSniperLizzyScopeImage::onRaycastCollision(%this, %obj, %col, %pos, %normal, %vec)
  486. {
  487. GenericSniperLizzyImage::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  488. }
  489.  
  490. function GenericSniperLizzyScopeImage::damage(%this, %obj, %col, %pos, %normal, %vec)
  491. {
  492. GenericSniperLizzyImage::damage(%this, %obj, %col, %pos, %normal, %vec);
  493. }
  494.  
  495. function GenericSniperLizzyScopeImage::onEmptyFire(%this, %obj, %slot)
  496. {
  497. GenericSniperLizzyImage::onEmptyFire(%this, %obj, %slot);
  498. }
  499.  
  500. Pack GenericSniperLizzyPack
  501. {
  502. function Armor::onTrigger(%this, %obj, %slot, %state)
  503. {
  504. Parent::onTrigger(%this, %obj, %slot, %state);
  505.  
  506. if (%state && %slot == 4 && !%this.canJet)
  507. {
  508. %image = %obj.getMountedImage(0);
  509.  
  510. if (%image == nameToID("GenericSniperLizzyImage"))
  511. {
  512. %sound = "GenericSightsInSound";
  513. %obj.mountImage(GenericSniperLizzyScopeImage, 0);
  514. }
  515. else if (%image == nameToID("GenericSniperLizzyScopeImage"))
  516. {
  517. %sound = "GenericSightsOutSound";
  518. %obj.mountImage(GenericSniperLizzyImage, 0);
  519. }
  520.  
  521. if (isObject(%sound))
  522. {
  523. serverPlay3D(%sound, %obj.getHackPosition());
  524. }
  525. }
  526. }
  527. };
  528.  
  529. activatePack("GenericSniperLizzyPack");
Advertisement
Add Comment
Please, Sign In to add comment