actor SSTChaingun : Chaingun //replaces Chaingun
{
  DamageType "NewBullet"
  spawnid 28
  obituary "%o was mowed down by %k's chaingun."
  radius 20
  height 16
  attacksound ""
  //attacksound "weapons/chngun"
  inventory.pickupmessage "You got the chaingun!"
  weapon.selectionorder 699
  weapon.kickback 100
  weapon.ammotype "Clip"
  weapon.ammouse 1
  weapon.ammogive 20
  weapon.ammotype2 "Clip"
  weapon.ammouse2 1
  weapon.ammogive2 0
  Decal "bulletchip"
  Weapon.preferredSkin "ChaingunSkin"
  +NOALERT
	+FORCEXYBILLBOARD
  Weapon.ViewPitchStyle Full
  Weapon.ViewPitchOffset 20
  states
  {
  Ready:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "ActualReady")
    PKCG DDCCBBAABCDABCD 1 A_JumpIfInventory("InstantSwitch",1, "ActualReady")
    PKCG AABBCCDDAAABBBCCCDDD 1 A_WeaponReady
  ActualReady:
    PKCG A 1 A_WeaponReady
    loop
  Deselect: 
    TNT1 A 0 ACS_ExecuteAlways(779,0, 2,0,0)
    TNT1 A 0
    PKCG A 1 A_Lower
    CHGG A 0 A_Lower
    Goto DeSelect+2
  Select:
    TNT1 A 0 A_JumpIfInventory("InstantSwitch",1, "ActualReady")
    TNT1 A 0 ACS_ExecuteAlways(779,0, 10,0,0)
    TNT1 A 0
    CHGG A 0 A_Raise
    PKCG A 1 A_Raise
    Goto Select+3
  Fire:
    CHGG A 0
    CHGG A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(1,2,0,1, 0)
    PKCG A 0 A_PlaySoundEx("weapons/chngun", "SoundSlot5")
    CHGG A 0 A_FireBullets (2, 1, 1, random(5,9), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-2,2)*0.4, 0, 0, 0, 0, random(-1,1)*0.4)
    PKCG AB 2
	
    TNT1 A 0 A_Jumpifinventory("Clip",1, 1)
	Goto DryFire
	TNT1 A 0 Radius_Quake(1,2,0,1, 0)
    PKCG A 0 A_PlaySoundEx("weapons/chngun", "SoundSlot5")
    PKCG B 0 A_FireBullets (1, 2, 1, random(5,9), "SSTBulletpuff1")
	  TNT1 A 0 A_FireCustomMissile ("TracerRound", random(-1,1)*0.4, 0, 0, 0, 0, random(-2,2)*0.4)
    PKCG CD 2
    CHGG B 0 A_ReFire
	//CHGG AA 1 A_SetPitch(pitch+0.5)
    goto ActualReady
  AltFire:
    CHGG A 0
    CHGG A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(1,2,0,1, 0)
    PKCG A 0 A_PlaySoundEx("weapons/chngun", "SoundSlot5")
    CHGG A 0 A_FireBullets (0, 0, 1, random(5,9), "SSTBulletpuff1")
    G36F A 0 A_FireCustomMissile ("TracerRound", 0, 0, 0, 0) 
    PKCG AB 2
    PKCG CD 2
    CHGG B 0 A_ReFire
    goto ActualReady
  /*
    CHGG A 0
    CHGG A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(1,2,0,1, 0)
    PKCG A 0 A_PlaySoundEx("weapons/chngun", "SoundSlot5")
    CHGG A 0 A_FireBullets (0, 0, 1, random(5,9), "SSTBulletpuff1")
    G36F A 0 A_FireCustomMissile ("TracerRound", 0, 0, random(-2,2), random(-2,2)) 
    PKCG AB 4//2
    TNT1 A 0 A_Jumpifinventory("Clip",1, 1)
	Goto DryFire
	TNT1 A 0 Radius_Quake(1,2,0,1, 0)
    PKCG A 0 A_PlaySoundEx("weapons/chngun", "SoundSlot5")
    PKCG B 0 A_FireBullets (0, 0, 1, random(5,9), "SSTBulletpuff1")
    G36F A 0 A_FireCustomMissile ("TracerRound", 0, 0, random(-2,2), random(-2,2)) 
    PKCG CD 4//2
	
    //PKCG AB 1
    //PKCG CD 1
	
    CHGG B 0 A_ReFire
    goto ActualReady
  */
  DryFire:
    PKCG CD 2
    goto ActualReady
  Flash:
    CHGF A 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "Flashfast")
	TNT1 A 0 A_SetPitch(pitch-1)
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF A 1 bright A_Light2
    TNT1 A 0 //ACS_ExecuteAlways(925,0, 100,0,0)
    CHGF A 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
	RLGG E 0 A_AlertMonsters
    TNT1 A 0 A_Light0
    TNT1 A 1 A_SetPitch(pitch+0.5)
    TNT1 A 1 A_SetPitch(pitch+0.5)
    TNT1 A 0 A_Jumpifinventory("Clip",1, 1)
	Stop
	TNT1 A 0 A_SetPitch(pitch-1.5)
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF B 1 bright A_Light2
    TNT1 A 0 //ACS_ExecuteAlways(925,0, 100,0,0)
    CHGF B 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
	RLGG E 0 A_AlertMonsters
    CHGF A 0 bright A_Light0
    TNT1 A 1 A_SetPitch(pitch+0.5)
    TNT1 A 1 A_SetPitch(pitch+1)
    stop
  FlashFast:
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF A 1 bright A_Light2
    TNT1 A 0 ACS_ExecuteAlways(925,0, 100,0,0)
    TNT1 A 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
    CHGF A 0 bright A_Light0
	RLGG E 0 A_AlertMonsters
    TNT1 A 0 A_Jumpifinventory("Clip",1, 1)
	Stop
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF B 1 bright A_Light2
    TNT1 A 0 ACS_ExecuteAlways(925,0, 100,0,0)
    TNT1 A 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
    CHGF A 0 bright A_Light0
	RLGG E 0 A_AlertMonsters
    stop
  AltFlash:
    CHGF A 0 A_JumpIfInventory("RuneDoubleFiringSpeed", 1, "AltFlashfast")
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF A 1 bright A_Light2
    TNT1 A 0 ACS_ExecuteAlways(925,0, 50,0,0)
    CHGF A 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
	RLGG E 0 A_AlertMonsters
    TNT1 A 2 A_Light0
    stop
  AltFlashFast:
    NULL A 0 A_SpawnItemEx ("ChaingunEcho", 0,0,0, 0,0,0, 0, 160)
    CHGF A 1 bright A_Light2
    TNT1 A 0 ACS_ExecuteAlways(925,0, 50,0,0)
    TNT1 A 1 bright A_Light1
	BERT B 0 A_FireCustomMissile("BulletCasingSpawner",0,0,6,-6)
    CHGF A 0 bright A_Light0
	RLGG E 0 A_AlertMonsters
    stop
  Spawn:
    MGON A -1
    stop
  }
}
