Guest User

Weapon_M134.cs

a guest
Sep 9th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 9.58 KB | None | 0 0
  1. // Kill Stuff
  2. AddDamageType("M134",   '<bitmap:add-ons/Weapon_Package_HKextend/M134/CI_M134> %1',    '%2 <bitmap:add-ons/Weapon_Package_HKextend/M134/CI_M134> %1',0.75,1);
  3.  
  4. //stolen from bushi's nailgun, get rekt
  5. datablock ParticleData(M134FireParticle)
  6. {
  7.     dragCoefficient      = 0;
  8.     gravityCoefficient   = -0.5;
  9.     inheritedVelFactor   = 0.2;
  10.     constantAcceleration = 0.0;
  11.     lifetimeMS           = 40;
  12.     lifetimeVarianceMS   = 0;
  13.     textureName          = "base/data/particles/star1";
  14.     spinSpeed       = 10.0;
  15.     spinRandomMin       = -500.0;
  16.     spinRandomMax       = 500.0;
  17.  
  18.     colors[0]     = "0.9 0.9 0 0.3";
  19.     colors[1]     = "1 0.5 0.2 0.5";
  20.     colors[2]     = "1 0.5 0.2 0.0";
  21.  
  22.     sizes[0]      = 1.3;
  23.    sizes[1]      = 0.68;
  24.     sizes[2]      = 0.34;
  25.  
  26.    times[0] = 0.0;
  27.    times[1] = 0.1;
  28.    times[2] = 1.0;
  29.  
  30.     useInvAlpha = false;
  31. };
  32. datablock ParticleEmitterData(M134FireEmitter)
  33. {
  34.    ejectionPeriodMS = 1;
  35.    periodVarianceMS = 0;
  36.    ejectionVelocity = 48.0;
  37.    velocityVariance = 0.0;
  38.    ejectionOffset   = 0.0;
  39.    thetaMin         = 0;
  40.    thetaMax         = 1;
  41.    phiReferenceVel  = 0;
  42.    phiVariance      = 360;
  43.    overrideAdvance = false;
  44.    particles = "M134FireParticle";
  45. };
  46.  
  47. // Item Data
  48. datablock ItemData(M134Item)
  49. {
  50.     category = "Weapon";  // Mission editor category
  51.     className = "Weapon"; // For inventory system
  52.    
  53.     // M134 Item Properties
  54.     shapeFile = "./M134.dts";
  55.     rotate = false;
  56.     mass = 1;
  57.     density = 0.2;
  58.     elasticity = 0.2;
  59.     friction = 0.6;
  60.     emap = true;
  61.    
  62.     //gui stuff
  63.     uiName = "HK: M134 Minigun";
  64.     iconName = "add-ons/Weapon_Package_HKextend/M134/Icon_M134";
  65.     doColorShift = true;
  66.     colorShiftColor = "0.6 0.6 0.6 1";
  67.  
  68.      // Dynamic properties defined by the scripts
  69.     image = M134Image;
  70.     canDrop = true;
  71.  
  72.     RYG_Reloads = 0;        // This weapon can't reload! What, do you just cram hundreds of bullets into your pockets or something? You goof.
  73.     RYG_ClipSize = 225;     // Max clip size for this weapon.
  74.    
  75.     // Weapon description for guis or w/e.
  76.     RYG_Description = "BUDDA BUDDA BUDDA BUDDA BUDDA BUDDA BUDDA";
  77. };
  78.  
  79. // Weapon Image
  80. datablock ShapeBaseImageData(M134Image)
  81. {
  82.     // M134 Image properties
  83.     shapeFile = "./M134.dts";
  84.     emap = true;
  85.  
  86.     // Specify mount point & offset for 3rd person, and eye offset
  87.     // for first person rendering.
  88.     mountPoint = 0;
  89.     offset = "0 0 0";
  90.     eyeOffset = 0; //"0.7 1.2 -0.5";
  91.     rotation = eulerToMatrix( "0 0 0" );
  92.  
  93.     // When firing from a point offset from the eye, muzzle correction
  94.     // will adjust the muzzle vector to point to the eye LOS point.
  95.     // Since this weapon doesn't actually fire from the muzzle point,
  96.     // we need to turn this off.  
  97.     correctMuzzleVector = true;
  98.  
  99.     // Add the WeaponImage namespace as a parent, WeaponImage namespace
  100.     // provides some hooks into the inventory system.
  101.     className = "WeaponImage";
  102.  
  103.     // Projectile && Ammo.
  104.     item = M134Item;
  105.     ammo = " ";
  106.     projectile = gunProjectile;
  107.     projectileType = Projectile;
  108.  
  109.     casing = GunShellDebris;
  110.     shellExitDir        = "1.0 0.1 1.0";
  111.     shellExitOffset     = "0 0 0";
  112.     shellExitVariance   = 10.0;
  113.     shellVelocity       = 5.0;
  114.  
  115.     //melee particles shoot from eye node for consistancy
  116.     melee = false;
  117.     //raise your arm up or not
  118.     armReady = true;
  119.    
  120.     doColorShift = true;
  121.     colorShiftColor = M134Item.colorShiftColor;
  122.  
  123.     // Rykuta's stuffings.
  124.     RYG_Support = 1;
  125.    
  126.     RYG_Accuracy = 0.0001;  // First bullet's accuracy.
  127.     RYG_RecoilAdd = 0.0002; // Amount of spread added per shot under time.
  128.     RYG_RecoilSub = 0.0005; // Amount of spread reduced when gun has stopped spam firing.
  129.     RYG_RecoilTick = 300;   // Delay between each shot required for the recoil to be reduced.
  130.     RYG_MovementPer = 125;  // Percent of recoil generated due to movement.
  131.     RYG_MaxRecoil = 0.005;  // Maximum recoil can reach.
  132.     RYG_Oversight = 0.0051; // Animation becomes more aggressive after this recoil is reached.
  133.    
  134.     RYG_MaxDmg = 7;     // Max damage at optimum Range.
  135.     RYG_MinDmg = 4;         // Min damage at worst range.
  136.     RYG_FalloffMax = 50;    // Range when bullet is at lowest damage. (In TorqueUnits)
  137.     RYG_FalloffMin = 20;    // Range before bullet starts to lose damage. (In TorqueUnits)
  138.     RYG_Headshot = 1.1;     // Multiplier for head damage.
  139.    
  140.     RYG_Bipod = 0;          // Gives the weapon the ability to utilize a bipod.
  141.    
  142.     RYG_BoltSound = ARBoltSound;            // Sound name for bolt pull.
  143.     RYG_ClipInSound = ARInSound;            // Clip In Sound Name.
  144.     RYG_ClipOutSound = AROutSound;          // Clip Out Sound Name.
  145.    
  146.     // Images have a state system which controls how the animations
  147.     // are run, which sounds are played, script callbacks, etc. This
  148.     // state system is downloaded to the client so that clients can
  149.     // predict state changes and animate accordingly.  The following
  150.     // system supports Gun ready->fire->reload transitions as
  151.     // well as a no-ammo->dryfire idle state.
  152.     raycastWeaponRange = 60; //varies
  153.     raycastWeaponTargets =
  154.         $TypeMasks::PlayerObjectType |    //AI/Players
  155.         $TypeMasks::StaticObjectType |    //Static Shapes
  156.         $TypeMasks::TerrainObjectType |    //Terrain
  157.         $TypeMasks::VehicleObjectType |    //Terrain
  158.         $TypeMasks::FXBrickObjectType;    //Bricks
  159.     raycastExplosionProjectile = GunProjectile;
  160.     raycastExplosionBrickSound = bulletHitSound;
  161.     raycastExplosionPlayerSound = bulletHitSound;
  162.     raycastDirectDamage = 2;
  163.     raycastDirectDamageType = $DamageType::M134;
  164.     raycastSpreadAmt = 0.001; //varies
  165.     raycastSpreadCount = 1;
  166.     raycastTracerProjectile = TacticalSTracerProjectile;
  167.     raycastFromMuzzle = true;
  168.     raycastImpactImpulse = 10;
  169.    
  170.  
  171.     // Main gun functionality  - - - - - - - - - - - - - - - - - - - - - - - - - - -
  172.     stateName[0]                        = "Activate";
  173.     stateTimeoutValue[0]                = 0.15;
  174.     stateTransitionOnTimeout[0]         = "LoadCheckA";
  175.     StateSequence[0]                    = "WindDown";
  176.     StateSound[0]                       = "SmallDrawSound";
  177.     StateScript[0]                      = "onMount";
  178.    
  179.     stateName[1]                        = "Ready";
  180.     stateTransitionOnNoAmmo[1]          = "Reload";
  181.     stateTransitionOnTriggerDown[1]     = "WindUp";
  182.     stateAllowImageChange[1]            = true;
  183.     stateScript[1]                      = "onReady";
  184.    
  185.     stateName[2]                        = "WindUp";
  186.     stateAllowImageChange[2]            = false;
  187.     stateTransitionOnTimeout[2]         = "Fire";
  188.     stateTimeoutValue[2]                = 1.00;
  189.     stateWaitForTimeout[2]              = true;
  190.     stateSequence[2]                    = "WindUp";
  191.     stateSound[2]                       = M134WindUpSound;
  192.     stateTransitionOnTriggerUp[2]       = "Ready";
  193.  
  194.     stateName[3]                        = "Fire";
  195.     stateTransitionOnTimeout[3]         = "Smoke";
  196.     stateTimeoutValue[3]                = 0.002;
  197.     stateFire[3]                        = true;
  198.     stateAllowImageChange[3]            = false;
  199.     stateSequence[3]                    = "FireSpin";
  200.     stateScript[3]                      = "onFire";
  201.     stateEjectShell[3]                  = true;
  202.     stateEmitter[3]                     = M134FireEmitter;
  203.     stateEmitterTime[3]                 = 0.05;
  204.     stateEmitterNode[3]                 = "muzzleNode";
  205.     stateWaitForTimeout[3]              = true;
  206.     StateSequence[3]                    = "FireSpin";
  207.     stateSound[3]                       = M134FireSound;
  208.  
  209.     stateName[4]                        = "Smoke";
  210.     stateEmitter[4]                     = gunSmokeEmitter;
  211.     stateEmitterTime[4]                 = 0.3;
  212.     stateEmitterNode[4]                 = "muzzleNode";
  213.     stateTimeoutValue[4]                = 0.01;
  214.     stateTransitionOnTimeout[4]         = "LoadCheckA";
  215.     StateSequence[4]                    = "WindDown";
  216.     stateSound[4]                       = M134WindDownSound;
  217.  
  218.     // Reload checks  - - - - - - - - - - - - - - - - - - - - - - - - - - -
  219.    
  220.     stateName[6]                        = "LoadCheckA";
  221.     stateScript[6]                      = "onLoadCheck";
  222.     stateTimeoutValue[6]                = 0.01;
  223.     stateTransitionOnTimeout[6]         = "LoadCheckB";
  224.    
  225.     stateName[7]                        = "LoadCheckB";
  226.     stateTransitionOnAmmo[7]            = "Ready";
  227.     stateTransitionOnNoAmmo[7]          = "NoRoundsLeftA";
  228.    
  229.     // No Rounds Left States - - - - - - - - - - - - - - - - - - - - - - - -
  230.    
  231.     stateName[9]                        = "NoRoundsLeftA";
  232.     stateScript[9]                      = "NoRoundsLeft";
  233.     stateTimeoutValue[9]                = 0.01;
  234.     stateTransitionOnTimeout[9]         = "NoRoundsLeftB";
  235.    
  236.     stateName[10]                       = "NoRoundsLeftB";
  237.     stateTimeoutValue[10]               = 0.01;
  238.     stateTransitionOnNoAmmo[10]         = "ReloadFull";
  239.     stateTransitionOnTriggerDown[10]    = "NoRoundsLeftC";
  240.    
  241.     stateName[11]                       = "NoRoundsLeftC";
  242.     stateScript[11]                     = "BlankFire";
  243.     stateTimeoutValue[11]               = 0.01;
  244.     stateTransitionOnTriggerUp[11]      = "NoRoundsLeftB";
  245.    
  246.     // Reloads - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  247.    
  248.     // Regular Reload
  249.     stateName[12]                       = "Reload";
  250.     stateScript[12]                     = "OnClipRemoved";
  251.     stateTimeoutValue[12]               = 1.7;
  252.     stateTransitionOnTimeout[12]        = "InsertClipA";
  253.     stateWaitForTimeout[12]             = true;
  254.     StateSequence[12]                   = "reload";
  255.    
  256.     stateName[13]                       = "InsertClipA";
  257.     stateScript[13]                     = "OnClipInserted";
  258.     stateTimeoutValue[13]               = 1.5;
  259.     stateTransitionOnTimeout[13]        = "ReloadFinish";
  260.     stateWaitForTimeout[13]             = true;
  261.  
  262.     // Full Reload
  263.     stateName[14]                       = "ReloadFull";
  264.     stateScript[14]                     = "OnClipRemoved";
  265.     stateTimeoutValue[14]               = 1.75;
  266.     stateTransitionOnTimeout[14]        = "InsertClipB";
  267.     stateWaitForTimeout[14]             = true;
  268.  
  269.     stateName[15]                       = "InsertClipB";
  270.     stateScript[15]                     = "OnClipInserted";
  271.     stateTimeoutValue[15]               = 1.6;
  272.     stateTransitionOnTimeout[15]        = "GunBolt";
  273.     stateWaitForTimeout[15]             = true;
  274.  
  275.     stateName[16]                       = "GunBolt";
  276.     stateScript[16]                     = "onGunBolt";
  277.     stateTimeoutValue[16]               = 1.5;
  278.     stateTransitionOnTimeout[16]        = "ReloadFinish";
  279.     stateWaitForTimeout[16]             = true;
  280.  
  281.     // Finish reloading
  282.     stateName[17]                       = "ReloadFinish";
  283.     stateScript[17]                     = "OnGunReloadFinished";
  284.     stateTimeoutValue[17]               = 0.01;
  285.     stateTransitionOnTimeout[17]        = "Ready";
  286.     stateWaitForTimeout[17]             = true;
  287. };
Advertisement
Add Comment
Please, Sign In to add comment