Advertisement
KishgalYS

Weapon_R101C.cs

Aug 21st, 2014
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 13.49 KB | None | 0 0
  1. datablock AudioProfile(R101CEquipSound)
  2. {
  3.    filename    = "./sound/R101CEquip.wav";
  4.    description = AudioClose3d;
  5.    preload = true;
  6. };
  7.  
  8. datablock AudioProfile(R101CFire1Sound)
  9. {
  10.    filename    = "./sound/R101CFire1.wav";
  11.    description = AudioClose3d;
  12.    preload = true;
  13. };
  14.  
  15. datablock AudioProfile(R101CFire2Sound)
  16. {
  17.    filename    = "./sound/R101CFire2.wav";
  18.    description = AudioClose3d;
  19.    preload = true;
  20. };
  21.  
  22. datablock AudioProfile(R101CFire3Sound)
  23. {
  24.    filename    = "./sound/R101CFire3.wav";
  25.    description = AudioClose3d;
  26.    preload = true;
  27. };
  28.  
  29. datablock AudioProfile(R101CBoltSound)
  30. {
  31.    filename    = "./sound/R101CBolt.wav";
  32.    description = AudioClose3d;
  33.    preload = true;
  34. };
  35.  
  36. datablock AudioProfile(R101CInSound)
  37. {
  38.    filename    = "./sound/R101CIn.wav";
  39.    description = AudioClose3d;
  40.    preload = true;
  41. };
  42.  
  43. datablock AudioProfile(R101COutSound)
  44. {
  45.    filename    = "./sound/R101COut.wav";
  46.    description = AudioClose3d;
  47.    preload = true;
  48. };
  49.  
  50. // particles
  51.  
  52. datablock ParticleData(R101CFireParticle)
  53. {
  54.     dragCoefficient      = 0;
  55.     gravityCoefficient   = 0;
  56.     inheritedVelFactor   = 0;
  57.     constantAcceleration = 0.0;
  58.     lifetimeMS           = 50;
  59.     lifetimeVarianceMS   = 0;
  60.     textureName          = "./materials/flash0";
  61.     spinSpeed        = 9000.0;
  62.     spinRandomMin        = -5000.0;
  63.     spinRandomMax        = 5000.0;
  64.  
  65.     colors[0]     = "1.0 0.5 0 0.9";
  66.     colors[1]     = "0.9 0.4 0 0.8";
  67.     colors[2]     = "1 0.5 0.2 0.6";
  68.     colors[3]     = "1 0.5 0.2 0.4";
  69.  
  70.     sizes[0]      = 1.75;
  71.    sizes[1]      = 0.4;
  72.     sizes[2]      = 0.10;
  73.     sizes[3]      = 0.0;
  74.  
  75.    times[0] = 0.0;
  76.    times[1] = 0.1;
  77.    times[2] = 0.5;
  78.    times[3] = 1.0;
  79.  
  80.     useInvAlpha = false;
  81. };
  82. datablock ParticleEmitterData(R101CFireEmitter)
  83. {
  84.    ejectionPeriodMS = 1;
  85.    periodVarianceMS = 0;
  86.    ejectionVelocity = 64.0;
  87.    velocityVariance = 0.0;
  88.    ejectionOffset   = 0.0;
  89.    thetaMin         = 0;
  90.    thetaMax         = 1;
  91.    phiReferenceVel  = 0;
  92.    phiVariance      = 360;
  93.    overrideAdvance = false;
  94.  
  95.    particles = "R101CFireParticle";
  96. };
  97.  
  98. datablock ParticleData(R101CSmokeParticle)
  99. {
  100.     dragCoefficient      = 3;
  101.     gravityCoefficient   = 0;
  102.     inheritedVelFactor   = 0;
  103.     constantAcceleration = 0.0;
  104.     lifetimeMS           = 100;
  105.     lifetimeVarianceMS   = 0;
  106.     textureName          = "./materials/smoke1";
  107.     spinSpeed        = 9000.0;
  108.     spinRandomMin        = -5000.0;
  109.     spinRandomMax        = 5000.0;
  110.  
  111.     colors[0]     = "0.6 0.6 0.6 0.0";
  112.     colors[1]     = "0.7 0.7 0.7 0.3";
  113.     colors[2]     = "1 1 1 0.2";
  114.     colors[3]     = "1 1 1 0";
  115.  
  116.     sizes[0]      = 0.0;
  117.    sizes[1]      = 0.4;
  118.     sizes[2]      = 0.10;
  119.     sizes[3]      = 0.05;
  120.  
  121.    times[0] = 0.0;
  122.    times[1] = 0.1;
  123.    times[2] = 0.5;
  124.    times[3] = 1.0;
  125.  
  126.     useInvAlpha = false;
  127. };
  128. datablock ParticleEmitterData(R101CSmokeEmitter)
  129. {
  130.    ejectionPeriodMS = 1;
  131.    periodVarianceMS = 0;
  132.    ejectionVelocity = 32.0;
  133.    velocityVariance = 0.0;
  134.    ejectionOffset   = 0.0;
  135.    thetaMin         = 0;
  136.    thetaMax         = 1;
  137.    phiReferenceVel  = 0;
  138.    phiVariance      = 360;
  139.    overrideAdvance = false;
  140.  
  141.    particles = "R101CSmokeParticle";
  142. };
  143.  
  144. datablock ParticleData(R101CTrailParticle)
  145. {
  146.     dragCoefficient     = 3.0;
  147.     windCoefficient     = 0.0;
  148.     gravityCoefficient  = 0.0;
  149.     inheritedVelFactor  = 0.0;
  150.     constantAcceleration    = 0.0;
  151.     lifetimeMS      = 200;
  152.     lifetimeVarianceMS  = 20;
  153.     spinSpeed       = 10.0;
  154.     spinRandomMin       = -50.0;
  155.     spinRandomMax       = 50.0;
  156.     useInvAlpha     = false;
  157.     animateTexture      = false;
  158.     //framesPerSec      = 1;
  159.  
  160.     textureName     = "./materials/smoke1";
  161.     //animTexName       = "~/data/particles/dot";
  162.  
  163.     // Interpolation variables
  164.     colors[0]   = "1 1 0 0.5";
  165.     colors[1]   = "1 1 0.4 1.0";
  166.     colors[2]   = "0.7 0.7 0.7 0";
  167.     sizes[0]    = 0.3;
  168.     sizes[1]    = 0.15;
  169.     sizes[2]    = 0.0;
  170.     times[0]    = 0.0;
  171.     times[1]    = 0.1;
  172.     times[2]    = 1.0;
  173. };
  174.  
  175. datablock ParticleEmitterData(R101CTrailEmitter)
  176. {
  177.    ejectionPeriodMS = 1;
  178.    periodVarianceMS = 0;
  179.    ejectionVelocity = 0; //0.25;
  180.    velocityVariance = 0; //0.10;
  181.    ejectionOffset = 0;
  182.    thetaMin         = 0.0;
  183.    thetaMax         = 90.0;  
  184.  
  185.    particles = R101CTrailParticle;
  186. };
  187.  
  188. datablock ProjectileData(R101CTrailProjectile)
  189. {
  190.    directDamage        = 0;
  191.    directDamageType    = $DamageType::Gun;
  192.    radiusDamageType    = $DamageType::Gun;
  193.  
  194.    brickExplosionRadius = 0;
  195.    brickExplosionImpact = true;          //destroy a brick if we hit it directly?
  196.    brickExplosionForce  = 10;
  197.    brickExplosionMaxVolume = 1;          //max volume of bricks that we can destroy
  198.    brickExplosionMaxVolumeFloating = 2;  //max volume of bricks that we can destroy if they aren't connected to the ground
  199.  
  200.    impactImpulse         = 100;
  201.    verticalImpulse    = 50;
  202. //explosion           = gunExplosion;
  203.    particleEmitter     = "R101CTrailEmitter";
  204.  
  205.    muzzleVelocity      = 200;
  206.    velInheritFactor    = 0;
  207.  
  208.    armingDelay         = 0;
  209.    lifetime            = 1000;
  210.    fadeDelay           = 700;
  211.    bounceElasticity    = 0.5;
  212.    bounceFriction      = 0.10;
  213.    isBallistic         = true;
  214.    gravityMod = 0.0;
  215.  
  216.    hasLight    = false;
  217.    lightRadius = 3.0;
  218.    lightColor  = "0 0 0.5";
  219. };
  220.  
  221. // Kill Stuff
  222. AddDamageType("R101C",   '<bitmap:add-ons/Weapon_Package_Titanfall/materials/CI_R101C> %1',    '%2 <bitmap:add-ons/Weapon_Package_Titanfall/materials/CI_R101C> %1',0.75,1);
  223.  
  224. // Item Data
  225. datablock ItemData(R101CItem)
  226. {
  227.     category = "Weapon";  // Mission editor category
  228.     className = "Weapon"; // For inventory system
  229.    
  230.     // R101C Item Properties
  231.     shapeFile = "./models/r101c.dts";
  232.     rotate = false;
  233.     mass = 1;
  234.     density = 0.2;
  235.     elasticity = 0.2;
  236.     friction = 0.6;
  237.     emap = true;
  238.    
  239.     //gui stuff
  240.     uiName = "R-101C Carbine";
  241.     iconName = "./materials/Icon_R101C";
  242.     doColorShift = true;
  243.     colorShiftColor = "0.935 0.916 0.846 1";
  244.  
  245.      // Dynamic properties defined by the scripts
  246.     image = R101CImage;
  247.     canDrop = true;
  248.  
  249.     RYG_Reloads = 1;        // This weapon can reload!
  250.     RYG_ClipSize = 24;      // Max clip size for this weapon.
  251.    
  252.     // Weapon description for guis or w/e.
  253.     RYG_Description = "The R-101C is a fully automatic, compact assault weapon commonly used throughout the Frontier. ";
  254. };
  255.  
  256. // Weapon Image
  257. datablock ShapeBaseImageData(R101CImage)
  258. {
  259.     // R101C Image properties
  260.     shapeFile = "./models/r101c.dts";
  261.     emap = true;
  262.  
  263.     // Specify mount point & offset for 3rd person, and eye offset
  264.     // for first person rendering.
  265.     mountPoint = 0;
  266.     offset = "0 0 0";
  267.     eyeOffset = 0; //"0.7 1.2 -0.5";
  268.     rotation = eulerToMatrix( "0 0 0" );
  269.  
  270.     // When firing from a point offset from the eye, muzzle correction
  271.     // will adjust the muzzle vector to point to the eye LOS point.
  272.     // Since this weapon doesn't actually fire from the muzzle point,
  273.     // we need to turn this off.  
  274.     correctMuzzleVector = true;
  275.  
  276.     // Add the WeaponImage namespace as a parent, WeaponImage namespace
  277.     // provides some hooks into the inventory system.
  278.     className = "WeaponImage";
  279.  
  280.     // Projectile && Ammo.
  281.     item = R101CItem;
  282.     ammo = " ";
  283.     projectile = gunProjectile;
  284.     projectileType = Projectile;
  285.  
  286.     casing = GunShellDebris;
  287.     shellExitDir        = "1.0 0.1 1.0";
  288.     shellExitOffset     = "0 0 0";
  289.     shellExitVariance   = 10.0;
  290.     shellVelocity       = 5.0;
  291.  
  292.     //melee particles shoot from eye node for consistancy
  293.     melee = false;
  294.     //raise your arm up or not
  295.     armReady = true;
  296.    
  297.     doColorShift = true;
  298.     colorShiftColor = R101CItem.colorShiftColor;
  299.  
  300.     // Rykuta's stuffings.
  301.     RYG_Support = 1;
  302.    
  303.     RYG_Accuracy = 0.0001;  // First bullet's accuracy.
  304.     RYG_RecoilAdd = 0.0002; // Amount of spread added per shot under time.
  305.     RYG_RecoilSub = 0.0005; // Amount of spread reduced when gun has stopped spam firing.
  306.     RYG_RecoilTick = 300;   // Delay between each shot required for the recoil to be reduced.
  307.     RYG_MovementPer = 150;  // Percent of recoil generated due to movement.
  308.     RYG_MaxRecoil = 0.005;  // Maximum recoil can reach.
  309.     RYG_Oversight = 0.0051; // Animation becomes more aggressive after this recoil is reached.
  310.    
  311.     RYG_MaxDmg = 25;        // Max damage at optimum Range.
  312.     RYG_MinDmg = 20;            // Min damage at worst range.
  313.     RYG_FalloffMax = 140;   // Range when bullet is at lowest damage. (In TorqueUnits)
  314.     RYG_FalloffMin = 90;    // Range before bullet starts to lose damage. (In TorqueUnits)
  315.     RYG_Headshot = 1.4; // Multiplier for head damage.
  316.    
  317.     RYG_Bipod = 0;          // Gives the weapon the ability to utilize a bipod.
  318.    
  319.     RYG_BoltSound = R101CBoltSound;         // Sound name for bolt pull.
  320.     RYG_ClipInSound = R101CInSound;         // Clip In Sound Name.
  321.     RYG_ClipOutSound = R101COutSound;           // Clip Out Sound Name.
  322.    
  323.     // Images have a state system which controls how the animations
  324.     // are run, which sounds are played, script callbacks, etc. This
  325.     // state system is downloaded to the client so that clients can
  326.     // predict state changes and animate accordingly.  The following
  327.     // system supports Gun ready->fire->reload transitions as
  328.     // well as a no-ammo->dryfire idle state.
  329.     raycastWeaponRange = 200; //varies
  330.     raycastWeaponTargets =
  331.         $TypeMasks::PlayerObjectType |    //AI/Players
  332.         $TypeMasks::StaticObjectType |    //Static Shapes
  333.         $TypeMasks::TerrainObjectType |    //Terrain
  334.         $TypeMasks::VehicleObjectType |    //Terrain
  335.         $TypeMasks::FXBrickObjectType;    //Bricks
  336.     raycastExplosionProjectile = GunProjectile;
  337.     raycastExplosionBrickSound = bulletHitSound;
  338.     raycastExplosionPlayerSound = bulletHitSound;
  339.     raycastDirectDamage = 2;
  340.     raycastDirectDamageType = $DamageType::R101C;
  341.     raycastSpreadAmt = 0.001; //varies
  342.     raycastSpreadCount = 1;
  343.     raycastTracerProjectile = R101CTrailProjectile;
  344.     raycastFromMuzzle = true;
  345.     raycastImpactImulse = 10;
  346.    
  347.  
  348.     // Main gun functionality  - - - - - - - - - - - - - - - - - - - - - - - - - - -
  349.     stateName[0]                        = "Activate";
  350.     stateTimeoutValue[0]                = 1.0;
  351.     stateTransitionOnTimeout[0]         = "LoadCheckA";
  352.     StateSequence[0]                    = "use";
  353.     StateSound[0]                       = "R101CEquipSound";
  354.     StateScript[0]                      = "onMount";
  355.    
  356.     stateName[1]                        = "Ready";
  357.     stateTransitionOnNoAmmo[1]          = "Reload";
  358.     stateTransitionOnTriggerDown[1]     = "Fire";
  359.     stateAllowImageChange[1]            = true;
  360.     stateScript[1]                      = "onReady";
  361.  
  362.     stateName[2]                        = "Fire";
  363.     stateTransitionOnTimeout[2]         = "Smoke";
  364.     stateTimeoutValue[2]                = 0.08;
  365.     stateFire[2]                        = true;
  366.     stateAllowImageChange[2]            = false;
  367.     stateSequence[2]                    = "fire";
  368.     stateScript[2]                      = "onFire";
  369.     stateEjectShell[2]                  = true;
  370.     stateEmitter[2]                     = R101CFireEmitter;
  371.     stateEmitterTime[2]                 = 0.05;
  372.     stateEmitterNode[2]                 = "muzzleNode";
  373.     stateWaitForTimeout[2]              = true;
  374.     StateSequence[2]                    = "fire";
  375.  
  376.     stateName[3]                        = "Smoke";
  377.     stateEmitter[3]                     = R101CSmokeEmitter;
  378.     stateEmitterTime[3]                 = 0.3;
  379.     stateEmitterNode[3]                 = "muzzleNode";
  380.     stateTimeoutValue[3]                = 0.01;
  381.     stateTransitionOnTimeout[3]         = "LoadCheckA";
  382.  
  383.     // Reload checks  - - - - - - - - - - - - - - - - - - - - - - - - - - -
  384.    
  385.     stateName[6]                        = "LoadCheckA";
  386.     stateScript[6]                      = "onLoadCheck";
  387.     stateTimeoutValue[6]                = 0.01;
  388.     stateTransitionOnTimeout[6]         = "LoadCheckB";
  389.    
  390.     stateName[7]                        = "LoadCheckB";
  391.     stateTransitionOnAmmo[7]            = "Ready";
  392.     stateTransitionOnNoAmmo[7]          = "NoRoundsLeftA";
  393.    
  394.     // No Rounds Left States - - - - - - - - - - - - - - - - - - - - - - - -
  395.    
  396.     stateName[9]                        = "NoRoundsLeftA";
  397.     stateScript[9]                      = "NoRoundsLeft";
  398.     stateTimeoutValue[9]                = 0.01;
  399.     stateTransitionOnTimeout[9]         = "NoRoundsLeftB";
  400.    
  401.     stateName[10]                       = "NoRoundsLeftB";
  402.     stateTimeoutValue[10]               = 0.01;
  403.     stateTransitionOnNoAmmo[10]         = "ReloadFull";
  404.     stateTransitionOnTriggerDown[10]    = "NoRoundsLeftC";
  405.    
  406.     stateName[11]                       = "NoRoundsLeftC";
  407.     stateScript[11]                     = "BlankFire";
  408.     stateTimeoutValue[11]               = 0.01;
  409.     stateTransitionOnTriggerUp[11]      = "NoRoundsLeftB";
  410.    
  411.     // Reloads - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  412.    
  413.     // Regular Reload
  414.     stateName[12]                       = "Reload";
  415.     stateScript[12]                     = "OnClipRemoved";
  416.     stateTimeoutValue[12]               = 1.1;
  417.     stateTransitionOnTimeout[12]        = "InsertClipA";
  418.     stateWaitForTimeout[12]             = true;
  419.     StateSequence[12]                   = "reload";
  420.    
  421.     stateName[13]                       = "InsertClipA";
  422.     stateScript[13]                     = "OnClipInserted";
  423.     stateTimeoutValue[13]               = 1.1;
  424.     stateTransitionOnTimeout[13]        = "ReloadFinish";
  425.     stateWaitForTimeout[13]             = true;
  426.  
  427.     // Full Reload
  428.     stateName[14]                       = "ReloadFull";
  429.     stateScript[14]                     = "OnClipRemoved";
  430.     stateTimeoutValue[14]               = 1.1;
  431.     stateTransitionOnTimeout[14]        = "InsertClipB";
  432.     stateWaitForTimeout[14]             = true;
  433.  
  434.     stateName[15]                       = "InsertClipB";
  435.     stateScript[15]                     = "OnClipInserted";
  436.     stateTimeoutValue[15]               = 1.1;
  437.     stateTransitionOnTimeout[15]        = "GunBolt";
  438.     stateWaitForTimeout[15]             = true;
  439.  
  440.     stateName[16]                       = "GunBolt";
  441.     stateScript[16]                     = "onGunBolt";
  442.     stateTimeoutValue[16]               = 0.7;
  443.     stateTransitionOnTimeout[16]        = "ReloadFinish";
  444.     stateWaitForTimeout[16]             = true;
  445.  
  446.     // Finish reloading
  447.     stateName[17]                       = "ReloadFinish";
  448.     stateScript[17]                     = "OnGunReloadFinished";
  449.     stateTimeoutValue[17]               = 0.01;
  450.     stateTransitionOnTimeout[17]        = "Ready";
  451.     stateWaitForTimeout[17]             = true;
  452. };
  453.  
  454. function R101CImage::onFire(%this,%obj,%slot)
  455. {
  456.     %num = getRandom(1, 3);
  457.     serverPlay3D( R101CFire @ %num @ Sound, %obj.getHackPosition() SPC "0 0 1 0");
  458. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement