Guest User

Untitled

a guest
Jan 11th, 2015
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.33 KB | None | 0 0
  1. ////sounds
  2. datablock AudioProfile(UltrapiercerFire1Sound)
  3. {
  4. filename = "./res/sounds/smg/shipka_fire01.wav";
  5. description = AudioClose3d;
  6. preload = true;
  7. };
  8. datablock AudioProfile(UltrapiercerFire2Sound)
  9. {
  10. filename = "./res/sounds/smg/shipka_fire02.wav";
  11. description = AudioClose3d;
  12. preload = true;
  13. };
  14. datablock AudioProfile(UltrapiercerFire3Sound)
  15. {
  16. filename = "./res/sounds/smg/shipka_fire03.wav";
  17. description = AudioClose3d;
  18. preload = true;
  19. };
  20. datablock AudioProfile(UltrapiercerFire4Sound)
  21. {
  22. filename = "./res/sounds/smg/shipka_fire04.wav";
  23. description = AudioClose3d;
  24. preload = true;
  25. };
  26. datablock AudioProfile(UltrapiercerEchoSound)
  27. {
  28. filename = "./res/sounds/smg/shipka_echo_prt2.wav";
  29. description = AudioClose3d;
  30. preload = true;
  31. };
  32.  
  33.  
  34. datablock AudioProfile(UltrapiercerReloadSound)
  35. {
  36. filename = "./res/sounds/smg/shipka_reload.wav";
  37. description = AudioClosest3d;
  38. preload = true;
  39. };
  40.  
  41. AddDamageType("Ultrapiercer", '<bitmap:add-ons/Weapon_Pack_Generic/res/shapes/icons/CI_SMG> %1', '%2 <bitmap:add-ons/Weapon_Pack_Generic/res/shapes/icons/CI_SMG> %1',0.2,1);
  42. datablock ProjectileData(UltrapiercerProjectile : GenericProjectile)
  43. {
  44. {
  45. directDamageType = $DamageType::Ultrapiercer;
  46. radiusDamageType = $DamageType::Ultrapiercer;
  47. };
  48.  
  49. //////////
  50. // item //
  51. //////////
  52. datablock ItemData(UltrapiercerItem)
  53. {
  54. category = "Weapon"; // Mission editor category
  55. className = "Weapon"; // For inventory system
  56.  
  57. // Basic Item Properties
  58. shapeFile = "./res/shapes/CR.dts";
  59. rotate = false;
  60. mass = 1;
  61. density = 0.2;
  62. elasticity = 0.2;
  63. friction = 0.6;
  64. emap = true;
  65.  
  66. //gui stuff
  67. uiName = "Ultrapiercer";
  68. //iconName = "./icons/icon_Pistol";
  69. doColorShift = false;
  70. colorShiftColor = "0.25 0.25 0.25 1.000";
  71.  
  72. maxmag = 32;
  73. ammotype = "UP Ammo";
  74. reload = true;
  75.  
  76. // Dynamic properties defined by the scripts
  77. image = UltrapiercerImage;
  78. canDrop = true;
  79. };
  80.  
  81. ////////////////
  82. //weapon image//
  83. ////////////////
  84. datablock ShapeBaseImageData(UltrapiercerImage)
  85. {
  86. // Basic Item properties
  87. shapeFile = "./res/shapes/CR.dts";
  88. emap = true;
  89.  
  90. // Specify mount point & offset for 3rd person, and eye offset
  91. // for first person rendering.
  92. mountPoint = 0;
  93. offset = "0 0 0";
  94. eyeOffset = "0.9 1.6 -1.1";
  95. rotation = eulerToMatrix( "0 0 0" );
  96.  
  97. // When firing from a point offset from the eye, muzzle correction
  98. // will adjust the muzzle vector to point to the eye LOS point.
  99. // Since this weapon doesn't actually fire from the muzzle point,
  100. // we need to turn this off.
  101. correctMuzzleVector = true;
  102.  
  103. // Add the WeaponImage namespace as a parent, WeaponImage namespace
  104. // provides some hooks into the inventory system.
  105. className = "WeaponImage";
  106.  
  107. // Projectile && Ammo.
  108. item = UltrapiercerItem;
  109. ammo = " ";
  110. projectile = UltrapiercerProjectile;
  111. projectileType = Projectile;
  112.  
  113.  
  114. raycastEnabled = 1;
  115. raycastRange = 200;
  116. raycastHitExplosion = UltrapiercerProjectile;
  117. raycastHitPlayerExplosion = GenericPlayerImpactProjectile;
  118.  
  119. directDamage = 20; //10
  120. directDamageType = $DamageType::Ultrapiercer;
  121.  
  122. raycastSpread = 3.2;
  123. raycastCount = 1;
  124.  
  125. raycastTracer = GenericTracerShapeData;
  126. raycastTracerTime = 64;
  127. raycastTracerSize = 0.5;
  128. raycastTracerColor = "0.9 0.5 0.1 1";
  129.  
  130.  
  131. casing = GenericPistolShellDebris;
  132. shellExitDir = "0.5 -1.3 0.5";
  133. shellExitOffset = "0 0 0";
  134. shellExitVariance = 15.0;
  135. shellVelocity = 7.0;
  136.  
  137. //melee particles shoot from eye node for consistancy
  138. melee = false;
  139. //raise your arm up or not
  140. armReady = true;
  141.  
  142. doColorShift = 0.75;
  143. colorShiftColor = "0.342 0.196 0 1.000";
  144.  
  145. doColorShift = false;
  146. colorShiftColor = GenericPistolItem.colorShiftColor;//"0.400 0.196 0 1.000";
  147.  
  148. //casing = " ";
  149.  
  150. // Images have a state system which controls how the animations
  151. // are run, which sounds are played, script callbacks, etc. This
  152. // state system is downloaded to the client so that clients can
  153. // predict state changes and animate accordingly. The following
  154. // system supports basic ready->fire->reload transitions as
  155. // well as a no-ammo->dryfire idle state.
  156.  
  157. // Initial start up state
  158. stateName[0] = "Activate";
  159. stateTimeoutValue[0] = 0.25;
  160. stateTransitionOnTimeout[0] = "AmmoCheck";
  161. stateSound[0] = "";
  162. stateSequence[0] = "Activate";
  163.  
  164. stateName[1] = "Ready";
  165. stateTransitionOnNoAmmo[1] = "Empty";
  166. stateTransitionOnTriggerDown[1] = "Fire";
  167. stateAllowImageChange[1] = true;
  168.  
  169. stateName[2] = "Fire";
  170. stateTransitionOnTimeout[2] = "AmmoCheck";
  171. stateTransitionOnTriggerup[2] = "Smoke";
  172. stateTimeoutValue[2] = 0.095;
  173. stateFire[2] = true;
  174. stateAllowImageChange[2] = false;
  175. stateSequence[2] = "Fire";
  176. stateScript[2] = "onFire";
  177. stateWaitForTimeout[2] = true;
  178. stateEmitter[2] = GenericPistolFlashEmitter;
  179. stateEmitterTime[2] = 0.05;
  180. stateEmitterNode[2] = "muzzleNode";
  181. stateEjectShell[2] = true;
  182.  
  183. stateName[3] = "AmmoCheck";
  184. stateTransitionOnTimeout[3] = "Ready";
  185. stateAllowImageChange[3] = true;
  186. stateScript[3] = "onAmmoCheck";
  187.  
  188. stateName[4] = "Reload";
  189. stateTransitionOnTimeout[4] = "ReloadReady";
  190. stateTimeoutValue[4] = 0.85;
  191. stateAllowImageChange[4] = false;
  192. stateScript[4] = "onReloadStart";
  193. stateSequence[4] = "Reload";
  194. stateSound[4] = UltrapiercerReloadSound;
  195.  
  196. stateName[5] = "ReloadReady";
  197. stateTransitionOnTimeout[5] = "CheckChamber";
  198. stateTimeoutValue[5] = 0.1;
  199. stateAllowImageChange[5] = false;
  200. stateScript[5] = "onReload";
  201. stateSequence[5] = "";
  202.  
  203. stateName[6] = "Empty";
  204. stateTransitionOnTriggerDown[6] = "EmptyFire";
  205. stateAllowImageChange[6] = true;
  206. stateScript[6] = "onEmpty";
  207. stateTransitionOnAmmo[6] = "Reload";
  208. //stateSequence[6] = "empty";
  209.  
  210. stateName[7] = "EmptyFire";
  211. stateTransitionOnTriggerUp[7] = "Empty";
  212. stateTransitionOnAmmo[7] = "Reload";
  213. stateTimeoutValue[7] = 0.13;
  214. stateAllowImageChange[7] = false;
  215. stateWaitForTimeout[7] = true;
  216. stateSound[7] = GenericEmptySound;
  217. stateSequence[7] = "emptyFire";
  218. stateScript[7] = "onEmptyFire";
  219.  
  220. stateName[8] = "CheckChamber";
  221. stateTransitionOnTimeOut[8] = "Ready";
  222. stateTransitionOnNoAmmo[8] = "Cocking";
  223. stateAllowImageChange[8] = true;
  224.  
  225. stateName[9] = "Cocking";
  226. stateTransitionOnTimeOut[9] = "Ready";
  227. stateTimeoutValue[9] = 0.1;
  228. stateAllowImageChange[9] = true;
  229. stateWaitForTimeout[9] = true;
  230. stateSound[9] = "";
  231. stateScript[9] = "onCock";
  232.  
  233. stateName[10] = "Smoke";
  234. stateEmitter[10] = GenericPistolSmokeEmitter;
  235. stateTransitionOnTimeOut[10] = "AmmoCheck";
  236. stateWaitForTimeout[10] = true;
  237. stateTimeoutValue[10] = 0.001;
  238. stateEmitterTime[10] = 0.75;
  239. stateEmitterNode[10] = "muzzleNode";
  240. stateScript[10] = "onSmoke";
  241. };
  242.  
  243. function UltrapiercerImage::onReloadStart( %this, %obj, %slot )
  244. {
  245. %obj.playThread(2,shiftRight);
  246. GenericDisplayAmmo(%this,%obj,%slot);
  247. }
  248.  
  249. function UltrapiercerImage::onAmmoCheck( %this, %obj, %slot )
  250. {
  251. GenericAmmoCheck(%this,%obj,%slot);
  252. GenericDisplayAmmo(%this,%obj,%slot);
  253. }
  254.  
  255. function UltrapiercerImage::onReload( %this, %obj, %slot )
  256. {
  257. %obj.playThread(2,plant);
  258. GenericAmmoOnReload(%this,%obj,%slot);
  259. GenericDisplayAmmo(%this,%obj,%slot);
  260. }
  261.  
  262. function UltrapiercerImage::onCock( %this, %obj, %slot )
  263. {
  264. %obj.playThread(2,shiftLeft);
  265. %obj.setImageAmmo(0,1);
  266. GenericDisplayAmmo(%this,%obj,%slot);
  267. }
  268.  
  269. function UltrapiercerImage::onMount( %this, %obj, %slot )
  270. {
  271. if(%obj.lastMntImage == nameToID(UltrapiercerSightsImage)) {
  272. %sound = GenericSightsOutSound;
  273. }
  274. else {
  275. %sound = GenericActivate2Sound;
  276. %obj.playThread(1, armReadyRight);
  277. }
  278. if($Sim::Time - %obj.lastMntTime <= 0.1) {
  279. %sound = "";
  280. }
  281. parent::onMount(%this,%obj,%slot);
  282. GenericDisplayAmmo(%this,%obj,%slot,0);
  283. serverPlay3D(%sound, %obj.getHackPosition());
  284. }
  285. function UltrapiercerImage::onUnMount( %this, %obj, %slot )
  286. {
  287. parent::onUnMount(%this,%obj,%slot);
  288. GenericDisplayAmmo(%this,%obj,%slot,-1);
  289. }
  290.  
  291. function UltrapiercerImage::onEmpty(%this,%obj,%slot)
  292. {
  293. if( $GenericWeapons::Ammo && %obj.toolAmmo[%this.item.ammotype] < 1 )
  294. {
  295. return;
  296. }
  297.  
  298. if(%obj.toolMag[%obj.currTool] < 1)
  299. {
  300. serverCmdLight(%obj.client);
  301. }
  302. }
  303.  
  304. function UltrapiercerImage::onEmptyFire(%this,%obj,%slot)
  305. {
  306. %obj.playThread(2,plant);
  307. // %this.onEmpty(%obj,%slot);
  308. }
  309.  
  310. function UltrapiercerImage::onFire( %this, %obj, %slot )
  311. {
  312. if(%obj.getDamagePercent() > 1.0)
  313. {
  314. return;
  315. }
  316.  
  317. %x = getRandom() * 6 - 3;
  318. %y = 4 + getRandom() * 2;
  319.  
  320. commandToClient(%obj.client, 'AimRecoil', %x, -%y, 16);
  321.  
  322. if($GenericWeapons::ammoSystem)
  323. {
  324. %obj.toolMag[%obj.currTool] -= 1;
  325.  
  326. if(%obj.toolMag[%obj.currTool] < 1)
  327. {
  328. %obj.toolMag[%obj.currTool] = 0;
  329. %obj.setImageAmmo(0,0);
  330. }
  331. GenericDisplayAmmo(%this,%obj,%slot);
  332. }
  333.  
  334. parent::onFire( %this, %obj, %slot );
  335.  
  336. %obj.playThread(2, shiftRight);
  337. %obj.playThread(3, shiftLeft);
  338. if(%obj.getMountedImage(0) == nameToID(UltrapiercerImage))
  339. %shake = "0.5 0.5 0.5";
  340. else
  341. %shake = "0.25 0.25 0.25";
  342.  
  343. %obj.spawnExplosion(GenericRecoilSmallProjectile, %shake);
  344. serverPlay3D("UltrapiercerFire" @ getRandom(1,2) @ "Sound", %obj.getHackPosition());
  345. }
  346.  
  347. function UltrapiercerImage::onSmoke( %this, %obj, %slot )
  348. {
  349. serverPlay3D("UltrapiercerEchoSound", %obj.getHackPosition());
  350. }
  351.  
  352. function UltrapiercerImage::onRaycastCollision(%this, %obj, %col, %pos, %normal, %vec)
  353. {
  354. if( !( %col.getType() & $typeMasks::playerObjectType || %col.getType() & $typeMasks::corpseObjectType ) )
  355. {
  356. %rnd = getRandom( 1, 4 );
  357. serverPlay3d( GenericBulletHitSound @ %rnd, %pos );
  358. }
  359. else
  360. {
  361. %rnd = getRandom( 1, 4 );
  362. serverPlay3d( GenericFleshHitSound @ %rnd, %pos );
  363. }
  364.  
  365. if( !(%col.getType() & $typeMasks::playerObjectType) && !(%col.getType & $TypeMasks::vehicleObjectType) )
  366. {
  367. spawnDecal(gunShotShapeData, vectorAdd(%pos, vectorScale(%normal, 0.02)), %normal, 1);
  368. }
  369.  
  370. parent::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  371. }
  372.  
  373. datablock ShapeBaseImageData(UltrapiercerSightsImage : UltrapiercerImage)
  374. {
  375. zoom = 0.85;
  376. eyeOffset = "0.00536 0.6 -1.24";
  377. raycastSpread = 2.25;
  378. stateSound[0] = genericSightsInSound;
  379. stateSequence[0] = "ZoomIn";
  380. };
  381.  
  382. function UltrapiercerSightsImage::onReloadStart( %this, %obj, %slot )
  383. {
  384. UltrapiercerImage::onReloadStart( %this, %obj, %slot );
  385. }
  386. function UltrapiercerSightsImage::onAmmoCheck( %this, %obj, %slot )
  387. {
  388. UltrapiercerImage::onAmmoCheck( %this, %obj, %slot );
  389. }
  390. function UltrapiercerSightsImage::onReload( %this, %obj, %slot )
  391. {
  392. UltrapiercerImage::onReload( %this, %obj, %slot );
  393. }
  394. function UltrapiercerSightsImage::onCock( %this, %obj, %slot )
  395. {
  396. UltrapiercerImage::onCock( %this, %obj, %slot );
  397. }
  398. function UltrapiercerSightsImage::onMount( %this, %obj, %slot )
  399. {
  400. parent::onMount(%this,%obj,%slot);
  401. GenericDisplayAmmo(%this,%obj,%slot,0);
  402. // serverPlay3D(%sound, %obj.getHackPosition());
  403. }
  404. function UltrapiercerSightsImage::onUnMount( %this, %obj, %slot )
  405. {
  406. parent::onUnMount(%this,%obj,%slot);
  407. GenericDisplayAmmo(%this,%obj,%slot,-1);
  408. }
  409. function UltrapiercerSightsImage::onEmpty(%this,%obj,%slot)
  410. {
  411. UltrapiercerImage::onEmpty(%this,%obj,%slot);
  412. }
  413. function UltrapiercerSightsImage::onFire( %this, %obj, %slot )
  414. {
  415. UltrapiercerImage::onFire( %this, %obj, %slot );
  416. }
  417. function UltrapiercerSightsImage::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec )
  418. {
  419. UltrapiercerImage::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec);
  420. }
  421. function UltrapiercerSightsImage::onRaycastDamage(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit)
  422. {
  423. UltrapiercerImage::onRaycastDamage(%this,%obj,%slot,%col,%pos,%normal,%shotVec,%crit);
  424. }
  425. function UltrapiercerSightsImage::onSmoke( %this, %obj, %slot )
  426. {
  427. UltrapiercerImage::onSmoke( %this, %obj, %slot );
  428. }
  429. function UltrapiercerSightsImage::onEmptyFire(%this,%obj,%slot)
  430. {
  431. UltrapiercerImage::onEmptyFire(%this,%obj,%slot);
  432. }
  433.  
  434. Pack UltrapiercerPack
  435. {
  436. function Armor::onTrigger(%this, %obj, %slot, %state)
  437. {
  438. Parent::onTrigger(%this, %obj, %slot, %state);
  439. if(%obj.getMountedImage(0) != nameToID(UltrapiercerImage) && %obj.getMountedImage(0) != nameToID(UltrapiercerSightsImage))
  440. {
  441. return;
  442. }
  443. if(%this.canJet)
  444. {
  445. return;
  446. }
  447. if(%slot == 4)
  448. {
  449. if(%state) {
  450. %obj.playThread(3, shiftLeft);
  451. %obj.mountImage(UltrapiercerSightsImage, 0);
  452. }
  453. else {
  454. // %obj.playThread(3, shiftRight);
  455. %obj.mountImage(UltrapiercerImage, 0);
  456. }
  457. }
  458. }
  459. function serverCmdUnuseTool(%this)
  460. {
  461. if(isObject(%this.player) && %this.player.getMountedImage(0) == nameToID(UltrapiercerSightsImage)) {
  462. return;
  463. }
  464. parent::serverCmdUnuseTool(%this);
  465. }
  466. };
  467. activatePack(UltrapiercerPack);
Advertisement
Add Comment
Please, Sign In to add comment