Guest User

Untitled

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