Guest User

Untitled

a guest
Jan 11th, 2015
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.09 KB | None | 0 0
  1. //sounds
  2. datablock AudioProfile(KiloexecutionerShotgunFireSound)
  3. {
  4. filename = "./res/sounds/shotgun/shotgun_fire.wav";
  5. description = AudioClose3d;
  6. preload = true;
  7. };
  8.  
  9. datablock AudioProfile(KiloexecutionerShotgunPumpSound)
  10. {
  11. filename = "./res/sounds/shotgun/shotgun_pump.wav";
  12. description = AudioClosest3d;
  13. preload = true;
  14. };
  15.  
  16. datablock AudioProfile(KiloexecutionerShotgunShellSound1)
  17. {
  18. filename = "./res/sounds/shotgun/shotgun_reload01.wav";
  19. description = AudioClosest3d;
  20. preload = true;
  21. };
  22.  
  23. datablock AudioProfile(KiloexecutionerShotgunShellSound2)
  24. {
  25. filename = "./res/sounds/shotgun/shotgun_reload02.wav";
  26. description = AudioClosest3d;
  27. preload = true;
  28. };
  29.  
  30. datablock AudioProfile(KiloexecutionerShotgunShellSound3)
  31. {
  32. filename = "./res/sounds/shotgun/shotgun_reload03.wav";
  33. description = AudioClosest3d;
  34. preload = true;
  35. };
  36.  
  37. AddDamageType("KiloexecutionerShotgun", '<bitmap:add-ons/Weapon_Pack_Generic/res/shapes/icons/CI_Shotgun> %1', '%2 <bitmap:add-ons/Weapon_Pack_Generic/res/shapes/icons/CI_Shotgunl> %1',0.2,1);
  38. datablock ProjectileData(KiloexecutionerShotgunProjectile : GenericProjectile)
  39. {
  40. directDamageType = $DamageType::KiloexecutionerShotgun;
  41. radiusDamageType = $DamageType::KiloexecutionerShotgun;
  42. };
  43.  
  44. //////////
  45. // item //
  46. //////////
  47. datablock ItemData(KiloexecutionerShotgunItem)
  48. {
  49. category = "Weapon"; // Mission editor category
  50. className = "Weapon"; // For inventory system
  51.  
  52. // Basic Item Properties
  53. shapeFile = "./res/shapes/SHOTGUN.dts";
  54. rotate = false;
  55. mass = 1;
  56. density = 0.2;
  57. elasticity = 0.2;
  58. friction = 0.6;
  59. emap = true;
  60.  
  61. //gui stuff
  62. uiName = "Kiloexecutioner";
  63. //iconName = "./icons/icon_Pistol";
  64. doColorShift = false;
  65. colorShiftColor = "0.25 0.25 0.25 1.000";
  66.  
  67. maxmag = 6;
  68. ammotype = "KE Ammo";
  69. reload = true;
  70.  
  71. // Dynamic properties defined by the scripts
  72. image = KiloexecutionerShotgunImage;
  73. canDrop = true;
  74. };
  75.  
  76. ////////////////
  77. //weapon image//
  78. ////////////////
  79. datablock ShapeBaseImageData(KiloexecutionerShotgunImage)
  80. {
  81. // Basic Item properties
  82. shapeFile = "./res/shapes/SHOTGUN.dts";
  83. emap = true;
  84.  
  85. // Specify mount point & offset for 3rd person, and eye offset
  86. // for first person rendering.
  87. mountPoint = 0;
  88. offset = "0 0 0";
  89. eyeOffset = "0.9 1.6 -0.8";
  90. rotation = eulerToMatrix( "0 0 0" );
  91.  
  92. // When firing from a point offset from the eye, muzzle correction
  93. // will adjust the muzzle vector to point to the eye LOS point.
  94. // Since this weapon doesn't actually fire from the muzzle point,
  95. // we need to turn this off.
  96. correctMuzzleVector = true;
  97.  
  98. // Add the WeaponImage namespace as a parent, WeaponImage namespace
  99. // provides some hooks into the inventory system.
  100. className = "WeaponImage";
  101.  
  102. // Projectile && Ammo.
  103. item = KiloexecutionerShotgunItem;
  104. ammo = " ";
  105. projectile = KiloexecutionerShotgunProjectile;
  106. projectileType = Projectile;
  107.  
  108.  
  109. raycastEnabled = 1;
  110. raycastRange = 100;
  111. raycastHitExplosion = KiloexecutionerShotgunProjectile;
  112. raycastHitPlayerExplosion = GenericPlayerImpactProjectile;
  113.  
  114. directDamage = 15; //10
  115. directDamageType = $DamageType::KiloexecutionerShotgun;
  116.  
  117. raycastSpread = 15; // 12
  118. raycastCount = 12;
  119.  
  120. raycastTracer = GenericTracerShapeData;
  121. raycastTracerTime = 64;
  122. raycastTracerSize = 0.25;
  123. raycastTracerColor = "0.9 0.5 0.1 1";
  124.  
  125.  
  126. casing = GenericShotgunShellDebris;
  127. shellExitDir = "0.5 -1.3 0.5";
  128. shellExitOffset = "0 0 0";
  129. shellExitVariance = 15.0;
  130. shellVelocity = 7.0;
  131.  
  132. //melee particles shoot from eye node for consistancy
  133. melee = false;
  134. //raise your arm up or not
  135. armReady = true;
  136.  
  137. doColorShift = 0.25;
  138. colorShiftColor = "0.342 0.196 0 1.000";
  139.  
  140. //casing = " ";
  141.  
  142. // Images have a state system which controls how the animations
  143. // are run, which sounds are played, script callbacks, etc. This
  144. // state system is downloaded to the client so that clients can
  145. // predict state changes and animate accordingly. The following
  146. // system supports basic ready->fire->reload transitions as
  147. // well as a no-ammo->dryfire idle state.
  148.  
  149. // Initial start up state
  150. stateName[0] = "Activate";
  151. stateTimeoutValue[0] = 0.4;
  152. stateTransitionOnTimeout[0] = "AmmoCheck";
  153. stateSequence[0] = "activate";
  154. stateSound[0] = GenericActivate3Sound;
  155.  
  156. stateName[1] = "Ready";
  157. stateTransitionOnTriggerDown[1] = "Fire";
  158. stateTransitionOnNoAmmo[1] = "Empty";
  159. stateAllowImageChange[1] = true;
  160. stateTimeoutValue[1] = 0.01;
  161.  
  162. stateName[2] = "Fire";
  163. stateTransitionOnTriggerUp[2] = "CockAmmo";
  164. stateTimeoutValue[2] = 0.4;
  165. stateFire[2] = true;
  166. stateAllowImageChange[2] = false;
  167. stateSequence[2] = "fire";
  168. stateScript[2] = "onFire";
  169. stateWaitForTimeout[2] = true;
  170. stateEmitter[2] = GenericShotgunFlashEmitter;
  171. stateEmitterTime[2] = 0.05;
  172. stateEmitterNode[2] = "muzzleNode";
  173. stateSound[2] = KiloexecutionerShotgunFireSound;
  174.  
  175. stateName[3] = "AmmoCheck";
  176. stateTransitionOnTimeout[3] = "Ready";
  177. stateAllowImageChange[3] = true;
  178. stateScript[3] = "onAmmoCheck";
  179.  
  180. stateName[4] = "Cocking";
  181. stateTimeoutValue[4] = 0.6;
  182. stateSequence[4] = "cock";
  183. stateTransitionOnTimeout[4] = "Wait";
  184. stateScript[4] = "onCock";
  185. stateSequence[4] = "pump";
  186. stateWaitForTimeout[4] = true;
  187. stateEjectShell[4] = true;
  188. stateSound[4] = KiloexecutionerShotgunPumpSound;
  189.  
  190. stateName[5] = "CockAmmo";
  191. stateTimeoutValue[5] = 0.6;
  192. stateSequence[5] = "cock";
  193. stateTransitionOnTimeout[5] = "Wait";
  194. statescript[5] = "onCockAmmo";
  195. stateWaitForTimeout[5] = true;
  196. stateEjectShell[5] = true;
  197. stateSequence[5] = "pump";
  198. stateSound[5] = KiloexecutionerShotgunPumpSound;
  199.  
  200. stateName[6] = "Reload";
  201. stateTimeoutValue[6] = 0.3;
  202. stateTransitionOnTriggerDown[6] = "Cocking";
  203. stateWaitForTimeout[6] = true;
  204. stateScript[6] = "onReloadSingle";
  205. stateSequence[6] = "insertBullet";
  206. stateTransitionOnTimeout[6] = "Wait2";
  207.  
  208. stateName[7] = "CheckChamber";
  209. stateTransitionOnTriggerDown[7] = "ReloadEnd";
  210. stateTransitionOnTimeout[7] = "Reload";
  211. stateTransitionOnAmmo[7] = "ReloadEnd";
  212. stateScript[7] = "onCheckChamber";
  213. stateAllowImageChange[7] = false;
  214. stateWaitForTimeout[7] = true;
  215.  
  216. stateName[8] = "Empty";
  217. stateAllowImageChange[8] = true;
  218. stateScript[8] = "onEmpty";
  219. stateTransitionOnAmmo[8] = "ReloadStart";
  220.  
  221. stateName[10] = "Wait";
  222. stateTimeoutValue[10] = 0.3;
  223. stateTransitionOnTimeout[10] = "AmmoCheck";
  224. stateWaitForTimeout[10] = true;
  225.  
  226. stateName[11] = "Wait2";
  227. stateTimeoutValue[11] = 0.01;
  228. stateTransitionOnTimeout[11] = "CheckChamber";
  229. stateWaitForTimeout[11] = true;
  230.  
  231. stateName[12] = "ReloadStart";
  232. stateSequence[12] = "reloadStart";
  233. stateTimeoutValue[12] = 0.2;
  234. stateTransitionOnTimeout[12] = "Reload";
  235.  
  236. stateName[13] = "ReloadEnd";
  237. stateSequence[13] = "reloadEnd";
  238. stateTransitionOnTimeout[13] = "Cocking";
  239. stateTimeoutValue[13] = 0.1;
  240. };
  241.  
  242.  
  243. function KiloexecutionerShotgunImage::onReloadSingle( %this, %obj, %slot )
  244. {
  245. %obj.playThread(2,shiftRight);
  246. %rnd = getRandom(1, 3);
  247. serverPlay3d( KiloexecutionerShotgunShellSound @ %rnd, %obj.getHackPosition() );
  248. GenericDisplayAmmo(%this,%obj,%slot);
  249. GenericAmmoOnReloadSingle(%this,%obj,%slot);
  250. }
  251.  
  252. function KiloexecutionerShotgunImage::onAmmoCheck( %this, %obj, %slot )
  253. {
  254. GenericAmmoCheck(%this,%obj,%slot);
  255. GenericDisplayAmmo(%this,%obj,%slot);
  256. }
  257.  
  258. function KiloexecutionerShotgunImage::onCheckChamber( %this, %obj, %slot )
  259. {
  260. if(%obj.toolMag[%obj.currTool] > %this.item.maxmag)
  261. {
  262. %obj.toolMag[%obj.currTool] = %this.item.maxmag;
  263. %obj.setImageAmmo(0,1);
  264. }
  265. GenericDisplayAmmo(%this,%obj,%slot);
  266. }
  267.  
  268. function KiloexecutionerShotgunImage::onCock( %this, %obj, %slot )
  269. {
  270. %obj.playThread(2,plant);
  271. %obj.setImageAmmo(0,1);
  272. GenericDisplayAmmo(%this,%obj,%slot);
  273. }
  274.  
  275. function KiloexecutionerShotgunImage::onCockAmmo( %this, %obj, %slot )
  276. {
  277. %obj.playThread(2,plant);
  278. GenericDisplayAmmo(%this,%obj,%slot);
  279. }
  280.  
  281. function KiloexecutionerShotgunImage::onMount( %this, %obj, %slot )
  282. {
  283. parent::onMount(%this,%obj,%slot);
  284. GenericDisplayAmmo(%this,%obj,%slot,0);
  285. }
  286. function KiloexecutionerShotgunImage::onUnMount( %this, %obj, %slot )
  287. {
  288. parent::onUnMount(%this,%obj,%slot);
  289. GenericDisplayAmmo(%this,%obj,%slot,-1);
  290. }
  291.  
  292. function KiloexecutionerShotgunImage::onEmpty(%this,%obj,%slot)
  293. {
  294. if( $GenericWeapons::Ammo && %obj.toolAmmo[%this.item.ammotype] < 1 )
  295. {
  296. return;
  297. }
  298.  
  299. if(%obj.toolMag[%obj.currTool] < 1)
  300. {
  301. serverCmdLight(%obj.client);
  302. }
  303. }
  304.  
  305. function KiloexecutionerShotgunImage::onEmptyFire(%this,%obj,%slot)
  306. {
  307. %obj.playThread(2,plant);
  308. // %this.onEmpty(%obj,%slot);
  309. }
  310.  
  311. function KiloexecutionerShotgunImage::onFire( %this, %obj, %slot )
  312. {
  313. if(%obj.getDamagePercent() > 1.0)
  314. {
  315. return;
  316. }
  317.  
  318. if($GenericWeapons::ammoSystem)
  319. {
  320. %obj.toolMag[%obj.currTool] -= 1;
  321.  
  322. if(%obj.toolMag[%obj.currTool] < 1)
  323. {
  324. %obj.toolMag[%obj.currTool] = 0;
  325. %obj.setImageAmmo(0,0);
  326. }
  327. GenericDisplayAmmo(%this,%obj,%slot);
  328. }
  329.  
  330. parent::onFire( %this, %obj, %slot );
  331.  
  332. %obj.playThread(2, shiftRight);
  333. %obj.playThread(3, shiftLeft);
  334.  
  335. %obj.spawnExplosion(GenericRecoilMediumProjectile, "1 1 1");
  336. serverPlay3d( "KiloexecutionerShotgunFire" @ getRandom(1,2) @ "Sound", %obj.getHackPosition() );
  337. }
  338.  
  339. function KiloexecutionerShotgunImage::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec )
  340. {
  341. if( !( %col.getType() & $typeMasks::playerObjectType || %col.getType() & $typeMasks::corpseObjectType ) )
  342. {
  343. %rnd = getRandom( 1, 4 );
  344. serverPlay3d( GenericBulletHitSound @ %rnd, %pos );
  345. }
  346. else
  347. {
  348. %rnd = getRandom( 1, 4 );
  349. serverPlay3d( GenericFleshHitSound @ %rnd, %pos );
  350. }
  351.  
  352. if( !(%col.getType() & $typeMasks::playerObjectType) && !(%col.getType & $TypeMasks::vehicleObjectType) )
  353. {
  354. spawnDecal(gunShotShapeData, vectorAdd(%pos, vectorScale(%normal, 0.02)), %normal, 1);
  355. }
  356.  
  357. parent::onRaycastCollision( %this, %obj, %col, %pos, %normal, %vec );
  358. }
Advertisement
Add Comment
Please, Sign In to add comment