Guest User

Untitled

a guest
Jan 11th, 2015
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.66 KB | None | 0 0
  1. addDamageType("GenericRequiem6", '', '%2 <bitmap:base/client/ui/ci/generic> %1', 0.2, 1);
  2. addDamageType("GenericRequiem6", '', '%2 <bitmap:base/client/ui/ci/skull> <bitmap:base/client/ui/ci/generic> %1', 0.2, 1);
  3.  
  4. datablock AudioProfile(GenericRequiem6Fire1Sound)
  5. {
  6. filename = "./res/sounds/revolver/revolver_fire01.wav";
  7. description = AudioClose3d;
  8. preload = true;
  9. };
  10.  
  11. datablock AudioProfile(GenericRequiem6Fire2Sound)
  12. {
  13. filename = "./res/sounds/revolver/revolver_fire02.wav";
  14. description = AudioClose3d;
  15. preload = true;
  16. };
  17.  
  18. datablock AudioProfile(GenericRequiem6Fire3Sound)
  19. {
  20. filename = "./res/sounds/revolver/revolver_fire03.wav";
  21. description = AudioClose3d;
  22. preload = true;
  23. };
  24.  
  25. datablock AudioProfile(GenericRequiem6ReloadSound)
  26. {
  27. filename = "./res/sounds/pistol/pistol_reload.wav";
  28. description = AudioClosest3d;
  29. preload = true;
  30. };
  31.  
  32. datablock AudioProfile(GenericRequiem6ActivateSound)
  33. {
  34. filename = "./res/sounds/pistol/pistol_activate.wav";
  35. description = AudioClosest3d;
  36. preload = true;
  37. };
  38.  
  39. datablock ItemData(GenericRevolverRequiem6Item)
  40. {
  41. category = "Weapon";
  42. className = "Weapon";
  43.  
  44. shapeFile = "./res/shapes/SMAGNUM.dts";
  45. mass = 1;
  46. density = 0.2;
  47. elasticity = 0.2;
  48. friction = 0.6;
  49. emap = true;
  50.  
  51. uiName = "Requiem Six";
  52. image = GenericRevolverRequiem6Image;
  53. canDrop = true;
  54.  
  55. maxmag = 6;
  56. ammotype = "R6 Ammo";
  57. reload = true;
  58. };
  59.  
  60. datablock ShapeBaseImageData(GenericRevolverRequiem6Image)
  61. {
  62. shapeFile = "./res/shapes/SMAGNUM.dts";
  63. emap = true;
  64.  
  65. mountPoint = 0;
  66. offset = "0 0 0";
  67. eyeOffset = "0.9 1.6 -0.8";
  68. rotation = eulerToMatrix( "0 0 0" );
  69.  
  70. correctMuzzleVector = true;
  71. className = "WeaponImage";
  72.  
  73. item = GenericRevolverRequiem6Item;
  74.  
  75. raycastEnabled = 1;
  76. raycastRange = 200;
  77. raycastHitExplosion = GenericProjectile;
  78. raycastHitPlayerExplosion = GenericPlayerImpactProjectile;
  79.  
  80. directDamage = 30;
  81. // directDamageType = ...;
  82.  
  83. raycastSpread = 1.5;
  84. raycastCount = 1;
  85.  
  86. raycastTracer = GenericTracerShapeData;
  87. raycastTracerTime = 64;
  88. raycastTracerSize = 0.5;
  89. raycastTracerColor = "0.9 0.5 0.1 1";
  90.  
  91. casing = GenericPistolShellDebris;
  92. shellExitDir = "0.5 -1.3 0.5";
  93. shellExitOffset = "0 0 0";
  94. shellExitVariance = 15.0;
  95. shellVelocity = 7.0;
  96.  
  97. melee = false;
  98. armReady = true;
  99.  
  100. doColorShift = 0.25;
  101. colorShiftColor = "0.25 0.25 0.25 1.000";
  102. stateName[0] = "Activate";
  103. stateSequence[0] = "Activate";
  104. stateTimeoutValue[0] = 0.35;
  105. stateTransitionOnTimeout[0] = "AmmoCheck";
  106.  
  107. stateName[1] = "Ready";
  108. stateTransitionOnTriggerDown[1] = "Fire";
  109. stateTransitionOnNoAmmo[1] = "Empty";
  110. stateAllowImageChange[1] = true;
  111. stateSequence[1] = "root";
  112.  
  113. stateName[2] = "Fire";
  114. stateTransitionOnTriggerUp[2] = "Delay";
  115. stateTimeoutValue[2] = 0.18;
  116. stateFire[2] = true;
  117. stateAllowImageChange[2] = false;
  118. stateSequence[2] = "Fire";
  119. stateScript[2] = "onFire";
  120. stateWaitForTimeout[2] = true;
  121. stateEmitter[2] = genericPistolFlashEmitter;
  122. stateEmitterTime[2] = 0.05;
  123. stateEmitterNode[2] = "muzzleNode";
  124. stateEjectShell[2] = false;
  125.  
  126. stateName[3] = "AmmoCheck";
  127. stateTransitionOnTimeout[3] = "Ready";
  128. stateAllowImageChange[3] = true;
  129. stateScript[3] = "onAmmoCheck";
  130.  
  131. stateName[4] = "Reload";
  132. stateTransitionOnTimeout[4] = "ejectShell1";
  133. stateTimeoutValue[4] = 0.8;
  134. stateAllowImageChange[4] = true;
  135. stateSequence[4] = "reloadStart";
  136. stateScript[4] = "onReloadStart";
  137.  
  138. stateName[5] = "ReloadMid";
  139. stateTransitionOnTimeout[5] = "ReloadReady";
  140. stateTimeoutValue[5] = 1;
  141. stateAllowImageChange[5] = true;
  142. stateSequence[5] = "reloadEnd";
  143. stateScript[5] = "onReloadMid";
  144.  
  145. stateName[6] = "ReloadReady";
  146. stateTransitionOnTimeout[6] = "CheckChamber";
  147. stateTimeoutValue[6] = 0.5;
  148. stateAllowImageChange[6] = true;
  149. stateSequence[6] = "rollChamber";
  150. stateScript[6] = "onReload";
  151.  
  152. stateName[7] = "Empty";
  153. stateTransitionOnTriggerDown[7] = "EmptyFire";
  154. stateAllowImageChange[7] = true;
  155. stateScript[7] = "onEmpty";
  156. stateTransitionOnAmmo[7] = "Reload";
  157. stateSequence[7] = "noammo";
  158.  
  159. stateName[8] = "EmptyFire";
  160. stateTransitionOnTriggerUp[8] = "Empty";
  161. stateTimeoutValue[8] = 0.13;
  162. stateAllowImageChange[8] = false;
  163. stateWaitForTimeout[8] = true;
  164. stateSound[8] = GenericEmptySound;
  165. stateSequence[8] = "noammo_fire";
  166.  
  167. stateName[9] = "CheckChamber";
  168. stateTransitionOnTimeOut[9] = "Ready";
  169. stateTransitionOnNoAmmo[9] = "Cocking";
  170. stateAllowImageChange[9] = true;
  171.  
  172. stateName[10] = "Cocking";
  173. stateTransitionOnTimeOut[10] = "Ready";
  174. stateTimeoutValue[10] = 0.1;
  175. stateAllowImageChange[10] = true;
  176. stateWaitForTimeout[10] = true;
  177. stateSound[10] = "";
  178. stateScript[10] = "onCock";
  179.  
  180. stateName[11] = "Delay";
  181. stateTimeoutValue[11] = 0.35;
  182. stateTransitionOnTimeout[11] = "AmmoCheck";
  183. stateEmitter[11] = GenericPistolSmokeEmitter;
  184.  
  185. stateName[12] = "ejectShell1";
  186. stateTransitionOnTimeout[12] = "ejectShell2";
  187. stateEjectShell[12] = true;
  188.  
  189. stateName[13] = "ejectShell2";
  190. stateTransitionOnTimeout[13] = "ejectShell3";
  191. stateEjectShell[13] = true;
  192.  
  193. stateName[14] = "ejectShell3";
  194. stateTransitionOnTimeout[14] = "ejectShell4";
  195. stateEjectShell[14] = true;
  196.  
  197. stateName[15] = "ejectShell4";
  198. stateTransitionOnTimeout[15] = "ejectShell5";
  199. stateEjectShell[15] = true;
  200.  
  201. stateName[16] = "ejectShell5";
  202. stateTransitionOnTimeout[16] = "ejectShell6";
  203. stateEjectShell[16] = true;
  204.  
  205. stateName[17] = "ejectShell6";
  206. stateTransitionOnTimeout[17] = "ReloadMid";
  207. stateEjectShell[17] = true;
  208. };
  209.  
  210. function GenericRevolverRequiem6Image::onReloadStart( %this, %obj, %slot )
  211. {
  212. %pos = %obj.getHackPosition();
  213. %obj.playThread(2,shiftLeft);
  214.  
  215. %rnd = getRandom(1,3);
  216. %sound = GenericPistolReloadSound;
  217. serverPlay3d(%sound, %pos);
  218.  
  219. genericDisplayAmmo(%this,%obj,%slot);
  220. }
  221.  
  222. function GenericRevolverRequiem6Image::onReloadMid( %this, %obj, %slot )
  223. {
  224. %pos = %obj.getHackPosition();
  225.  
  226. %rnd = getRandom(1,3);
  227. %sound = GenericPistolReloadSound;
  228. serverPlay3d(%sound, %pos);
  229. %obj.playThread(2, plant);
  230. //genericDisplayAmmo(%this,%obj,%slot);
  231. }
  232.  
  233. function GenericRevolverRequiem6Image::onAmmoCheck( %this, %obj, %slot )
  234. {
  235. genericAmmoCheck(%this,%obj,%slot);
  236. genericDisplayAmmo(%this,%obj,%slot);
  237. }
  238.  
  239. function GenericRevolverRequiem6Image::onReload( %this, %obj, %slot )
  240. {
  241. // %obj.playThread(2,rotCCW);
  242. //serverPlay3d(genericMagnumSpinSound, %obj.getHackPosition());
  243. genericAmmoOnReload(%this,%obj,%slot);
  244. genericDisplayAmmo(%this,%obj,%slot);
  245. }
  246.  
  247. function GenericRevolverRequiem6Image::onCock( %this, %obj, %slot )
  248. {
  249. %obj.setImageAmmo(0,1);
  250. genericDisplayAmmo(%this,%obj,%slot);
  251. }
  252.  
  253. function GenericRevolverRequiem6Image::onMount( %this, %obj, %slot )
  254. {
  255. parent::onMount(%this,%obj,%slot);
  256. genericDisplayAmmo(%this,%obj,%slot,0);
  257. }
  258. function GenericRevolverRequiem6Image::onUnMount( %this, %obj, %slot )
  259. {
  260. parent::onUnMount(%this,%obj,%slot);
  261. genericDisplayAmmo(%this,%obj,%slot,-1);
  262. }
  263.  
  264. function GenericRevolverRequiem6Image::onFire(%this,%obj,%slot)
  265. {
  266. if(%obj.getDamagePercent() > 1.0)
  267. {
  268. return;
  269. }
  270.  
  271. if (isObject(%obj.client))
  272. {
  273. %x = getRandom() * 3 - 1.5;
  274. %y = 4 + getRandom() * 6.5;
  275.  
  276. commandToClient(%obj.client, 'AimRecoil', %x, -%y, 15);
  277. }
  278.  
  279. if($genericWeapons::ammoSystem)
  280. {
  281. %obj.toolMag[%obj.currTool] -= 1;
  282.  
  283. if(%obj.toolMag[%obj.currTool] < 1)
  284. {
  285. %obj.toolMag[%obj.currTool] = 0;
  286. %obj.setImageAmmo(0,0);
  287. }
  288. genericDisplayAmmo(%this,%obj,%slot);
  289. }
  290.  
  291. Parent::onFire(%this,%obj,%slot);
  292. %obj.playThread(2, shiftAway);
  293. %sound = nameToID("GenericRequiem6Fire" @ getRandom(1, 2) @ "Sound");
  294. serverplay3d(%sound, %obj.gethackposition());
  295. }
  296.  
  297. function GenericRevolverRequiem6Image::onEmpty(%this,%obj,%slot)
  298. {
  299. if( $genericWeapons::Ammo && %obj.toolAmmo[%this.item.ammotype] < 1 )
  300. {
  301. return;
  302. }
  303.  
  304. if(%obj.toolMag[%obj.currTool] < 1)
  305. {
  306. serverCmdLight(%obj.client);
  307. }
  308. }
  309.  
  310. function GenericRevolverRequiem6Image::onRaycastCollision(%this, %obj, %col, %pos, %normal, %vec)
  311. {
  312. if( !( %col.getType() & $typeMasks::playerObjectType || %col.getType() & $typeMasks::corpseObjectType ) )
  313. {
  314. %rnd = getRandom( 1, 4 );
  315. serverPlay3d( GenericBulletHitSound @ %rnd, %pos );
  316. }
  317. else
  318. {
  319. %rnd = getRandom( 1, 4 );
  320. serverPlay3d( GenericFleshHitSound @ %rnd, %pos );
  321. }
  322.  
  323. if( !(%col.getType() & $typeMasks::playerObjectType) && !(%col.getType & $TypeMasks::vehicleObjectType) )
  324. {
  325. spawnDecal(gunShotShapeData, vectorAdd(%pos, vectorScale(%normal, 0.02)), %normal, 1);
  326. }
  327.  
  328. parent::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  329. }
  330.  
  331. function GenericRevolverRequiem6Image::damage(%this, %obj, %col, %pos, %normal, %vec)
  332. {
  333. %damage = 45;
  334. %type = $DamageType::GenericRequiem6;
  335.  
  336. %z = getWord(%col.getScale(), 2);
  337.  
  338. if (getWord(%pos, 2) > getword(%col.getWorldBoxCenter(), 2) - 3.3 * %z)
  339. {
  340. %damage = 75;
  341. %type = $DamageType::GenericRequiem6Crit;
  342.  
  343. if (isObject(CritProjectile))
  344. {
  345. %col.spawnExplosion(CritProjectile, %z);
  346.  
  347. if (isObject(%col.client))
  348. {
  349. %col.client.play2D(CritRecieveSound);
  350. }
  351.  
  352. if (%obj.getType() & $TypeMasks::PlayerObjectType)
  353. {
  354. serverPlay3D(CritFireSound, %obj.getHackPosition());
  355.  
  356. if (isObject(%obj.client))
  357. {
  358. %obj.client.play2d(CritHitSound);
  359. }
  360. }
  361. }
  362. }
  363.  
  364. %col.damage(%obj, %pos, %damage * %obj.getSize(), %type);
  365.  
  366. if (%this.raycastImpactImpulse)
  367. {
  368. %col.applyImpulse(%pos, vectorScale(%vec, %this.impactImpulse));
  369. }
  370.  
  371. if (%this.raycastVerticalImpulse)
  372. {
  373. %col.applyImpulse(%pos, vectorScale("0 0 1", %this.verticalImpulse));
  374. }
  375. }
  376.  
  377. datablock ShapeBaseImageData(GenericRevolverRequiem6SightsImage : GenericRevolverRequiem6Image)
  378. {
  379. zoom = 0.6;
  380.  
  381. eyeOffset = "0.00536 0.003 -0.7";
  382. raycastSpread = 0.3;
  383.  
  384. stateSound[0] = genericSightsInSound;
  385. stateSequence[0] = "Sights";
  386. };
  387.  
  388. function GenericRevolverRequiem6SightsImage::onReloadStart( %this, %obj, %slot )
  389. {
  390. GenericRevolverRequiem6Image::onReloadStart( %this, %obj, %slot );
  391. }
  392. function GenericRevolverRequiem6SightsImage::onAmmoCheck( %this, %obj, %slot )
  393. {
  394. GenericRevolverRequiem6Image::onAmmoCheck( %this, %obj, %slot );
  395. }
  396. function GenericRevolverRequiem6SightsImage::onReload( %this, %obj, %slot )
  397. {
  398. GenericRevolverRequiem6Image::onReload( %this, %obj, %slot );
  399. }
  400. function GenericRevolverRequiem6SightsImage::onCock( %this, %obj, %slot )
  401. {
  402. GenericRevolverRequiem6Image::onCock( %this, %obj, %slot );
  403. }
  404. function GenericRevolverRequiem6SightsImage::onMount( %this, %obj, %slot )
  405. {
  406. parent::onMount(%this,%obj,%slot);
  407. GenericDisplayAmmo(%this,%obj,%slot,0);
  408. // serverPlay3D(%sound, %obj.getHackPosition());
  409. }
  410. function GenericRevolverRequiem6SightsImage::onUnMount( %this, %obj, %slot )
  411. {
  412. parent::onUnMount(%this,%obj,%slot);
  413. GenericDisplayAmmo(%this,%obj,%slot,-1);
  414. }
  415. function GenericRevolverRequiem6SightsImage::onEmpty(%this,%obj,%slot)
  416. {
  417. GenericRevolverRequiem6Image::onEmpty(%this,%obj,%slot);
  418. }
  419. function GenericRevolverRequiem6SightsImage::onFire( %this, %obj, %slot )
  420. {
  421. GenericRevolverRequiem6Image::onFire( %this, %obj, %slot );
  422. }
  423. function GenericRevolverRequiem6SightsImage::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec)
  424. {
  425. GenericRevolverRequiem6Image::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  426. }
  427. function GenericRevolverRequiem6SightsImage::onRaycastDamage(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit)
  428. {
  429. GenericRevolverRequiem6Image::onRaycastDamage(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit);
  430. }
  431. function GenericRevolverRequiem6SightsImage::onEmptyFire(%this,%obj,%slot)
  432. {
  433. GenericRevolverRequiem6Image::onEmptyFire(%this,%obj,%slot);
  434. }
  435.  
  436. function GenericRevolverRequiem6SightsImage::damage(%this, %obj, %col, %pos, %normal, %vec)
  437. {
  438. GenericRevolverRequiem6Image::damage(%this, %obj, %col, %pos, %normal, %vec);
  439. }
  440.  
  441. Pack GenericRevolverRequiem6Pack
  442. {
  443. function Armor::onTrigger(%this, %obj, %slot, %state)
  444. {
  445. Parent::onTrigger(%this, %obj, %slot, %state);
  446. if(%obj.getMountedImage(0) != nameToID(GenericRevolverRequiem6Image) && %obj.getMountedImage(0) != nameToID(GenericRevolverRequiem6SightsImage))
  447. {
  448. return;
  449. }
  450. if(%this.canJet)
  451. {
  452. return;
  453. }
  454. if(%slot == 4)
  455. {
  456. if(%state) {
  457. %obj.playThread(3, shiftLeft);
  458. %obj.mountImage(GenericRevolverRequiem6SightsImage, 0);
  459. }
  460. else {
  461. // %obj.playThread(3, shiftRight);
  462. %obj.mountImage(GenericRevolverRequiem6Image, 0);
  463. }
  464. }
  465. }
  466. function serverCmdUnuseTool(%this)
  467. {
  468. if(isObject(%this.player) && %this.player.getMountedImage(0) == nameToID(GenericRevolverRequiem6SightsImage)) {
  469. return;
  470. }
  471. parent::serverCmdUnuseTool(%this);
  472. }
  473. };
  474. activatePack(GenericRevolverRequiem6Pack);
Advertisement
Add Comment
Please, Sign In to add comment