context: //audio
  datablock AudioProfile(gunReload2Sound)
  {
     filename    = "./sounds/gunReload2.wav";
     description = AudioClose3d;
     preload = true;
  };
  
  //shell
  datablock DebrisData(ShotgunShellDebris)
  {
  	shapeFile = "./models/shotgun_shell.dts";
  	lifetime = 2.0;
  	minSpinSpeed = -400.0;
  	maxSpinSpeed = 200.0;
  	elasticity = 0.5;
  	friction = 0.2;
  	numBounces = 3;
  	staticOnMaxBounce = true;
  	snapOnMaxBounce = false;
  	fade = true;
  
  	gravModifier = 4;
  };
  
  AddDamageType("redShotgun",   '<bitmap:add-ons/GameMode_DeathMatch/addons/oldschool/icons/ci_Shotgun> %1',    '%2 <bitmap:add-ons/GameMode_DeathMatch/addons/oldschool/icons/ci_Shotgun> %1',0.75,1);
  datablock ProjectileData(redShotgunProjectile)
  {
     projectileShapeName = "add-ons/Weapon_Gun/bullet.dts";
     directDamage        = 18;
     directDamageType    = $DamageType::redShotgun;
     radiusDamageType    = $DamageType::redShotgun;
  
     brickExplosionRadius = 0.2;
     brickExplosionImpact = true;          //destroy a brick if we hit it directly?
     brickExplosionForce  = 15;
     brickExplosionMaxVolume = 20;          //max volume of bricks that we can destroy
     brickExplosionMaxVolumeFloating = 30;  //max volume of bricks that we can destroy if they aren't connected to the ground
  
     impactImpulse	     = 50;
     verticalImpulse     = 350;
     explosion           = gunExplosion;
     particleEmitter     = ""; //bulletTrailEmitter;
  
     muzzleVelocity      = 100;
     velInheritFactor    = 0.5;
  
     armingDelay         = 0;
     lifetime            = 4000;
     fadeDelay           = 3500;
     bounceElasticity    = 0.5;
     bounceFriction      = 0.20;
     isBallistic         = false;
     gravityMod = 0.0;
  
     hasLight    = false;
     lightRadius = 3.0;
     lightColor  = "0 0 0.5";
     
     uiName = "Shotgun Bullet ";
  };
  
  datablock ProjectileData(pointblankProjectile : redShotgunProjectile)
  {
     projectileShapeName = "base/data/shapes/empty.dts";
     directDamage        = 75;
     directDamageType    = $DamageType::redShotgun;
     radiusDamageType    = $DamageType::redShotgun;
  
     brickExplosionRadius = 0.4;
     brickExplosionImpact = true;          //destroy a brick if we hit it directly?
     brickExplosionForce  = 30;
     brickExplosionMaxVolume = 25;          //max volume of bricks that we can destroy
     brickExplosionMaxVolumeFloating = 35;  //max volume of bricks that we can destroy if they aren't connected to the ground
  
     impactImpulse	     = 350;
     verticalImpulse     = 50;
  
     muzzleVelocity      = 100;
     velInheritFactor    = 1;
  
     armingDelay         = 0;
     lifetime            = 75;
     fadeDelay           = 75;
     isBallistic         = false;
     gravityMod = 0.0;
  };
  
  
  //////////
  // item //
  //////////
  if($Pref::Server::DeathMatch::ColorfulOldSchoolWeapons)
  	%color = "0.9 0.1 0.1 1.000";
  else
  	%color = "0.400 0.196 0 1.000";
  
  datablock ItemData(redShotgunItem)
  {
  	category = "Weapon";  // Mission editor category
  	className = "Weapon"; // For inventory system
  
  	 // Basic Item Properties
  	shapeFile = "./models/Shotgun.dts";
  	rotate = false;
  	mass = 1;
  	density = 0.2;
  	elasticity = 0.2;
  	friction = 0.6;
  	emap = true;
  
  	//gui stuff
  	uiName = "Shotgun";
  	iconName = "./icons/icon_Shotgun";
  	doColorShift = true;
  	colorShiftColor = %color;
  
  	 // Dynamic properties defined by the scripts
  	image = redShotgunImage;
  	canDrop = true;
  	
  	maxAmmo = 1;
  	canReload = 0;
  };
  
  ////////////////
  //weapon image//
  ////////////////
  datablock ShapeBaseImageData(redShotgunImage)
  {
     // Basic Item properties
     shapeFile = "./models/Shotgun.dts";
     emap = true;
  
     // Specify mount point & offset for 3rd person, and eye offset
     // for first person rendering.
     mountPoint = 0;
     offset = "0 0 0";
     eyeOffset = 0; //"0.7 1.2 -0.5";
     rotation = eulerToMatrix( "0 0 0" );
  
     // When firing from a point offset from the eye, muzzle correction
     // will adjust the muzzle vector to point to the eye LOS point.
     // Since this weapon doesn't actually fire from the muzzle point,
     // we need to turn this off.  
     correctMuzzleVector = true;
  
     // Add the WeaponImage namespace as a parent, WeaponImage namespace
     // provides some hooks into the inventory system.
     className = "WeaponImage";
  
     // Projectile && Ammo.
     item = redShotgunItem;
     ammo = " ";
     projectile = redShotgunProjectile;
     projectileType = Projectile;
  
     casing = ShotgunShellDebris;
     shellExitDir        = "1.0 0.1 1.0";
     shellExitOffset     = "0 0 0";
     shellExitVariance   = 10.0;	
     shellVelocity       = 5.0;
  
     //melee particles shoot from eye node for consistancy
     melee = false;
     //raise your arm up or not
     armReady = true;
     minShotTime = 1000;
  
     doColorShift = true;
     colorShiftColor = redShotgunItem.colorShiftColor;
  
     // Images have a state system which controls how the animations
     // are run, which sounds are played, script callbacks, etc. This
     // state system is downloaded to the client so that clients can
     // predict state changes and animate accordingly.  The following
     // system supports basic ready->fire->reload transitions as
     // well as a no-ammo->dryfire idle state.
  
     // Initial start up state
  	stateName[0]                    = "Activate";
  	stateTimeoutValue[0]            = 0.15;
  	stateSequence[0]		= "Activate";
  	stateTransitionOnTimeout[0]     = "LoadCheckA";
  	stateSound[0]			= weaponSwitchSound;
  
  	stateName[1]                    = "Ready";
  	stateTransitionOnNoAmmo[1]      = "Reload";
  	stateTransitionOnTriggerDown[1] = "Fire";
  	stateAllowImageChange[1]        = true;
  	stateSequence[1]	        = "ready";
  
  	stateName[2]                    = "Fire";
  	stateTransitionOnTimeout[2]   = "Smoke";
  	stateTimeoutValue[2]            = 0.28;
  	stateFire[2]                    = true;
  	stateAllowImageChange[2]        = false;
  	stateScript[2]                  = "onFire";
  	stateWaitForTimeout[2]		  = true;
  	stateEmitter[2]			  = gunFlashEmitter;
  	stateEmitterTime[2]		  = 0.05;
  	stateEmitterNode[2]		  = "muzzleNode";
  	stateSound[2]			  = gunShot1Sound;
  
  	stateName[3] 			  = "Smoke";
  	stateEmitter[3]			  = gunSmokeEmitter;
  	stateEmitterTime[3]		  = 0.42;
  	stateEmitterNode[3]		  = "muzzleNode";
  	stateTimeoutValue[3]            = 0.07;
  	stateTransitionOnTimeout[3]     = "LoadCheckA";
  
  	stateName[4]				= "LoadCheckA";
  	stateScript[4]				= "onLoadCheck";
  	stateTimeoutValue[4]			= 0.01;
  	stateTransitionOnTimeout[4]		= "LoadCheckB";
  	
  	stateName[5]				= "LoadCheckB";
  	stateTransitionOnAmmo[5]		= "Ready";
  	stateTransitionOnNoAmmo[5]		= "Reload";
  
  	stateName[6]				= "Reload";
  	stateTimeoutValue[6]			= 0.42;
  	stateScript[6]				= "onReloadStart";
  	stateTransitionOnTimeout[6]		= "Reloaded";
  	stateEjectShell[6]                      = true;
  	stateWaitForTimeout[6]			= true;
  
gt: 	stateSequence[6]	                = "reload";