ACTOR "DemonTechMachineGun" : Weapon
{
	Weapon.PreferredSkin "LegLMG-Marine"
	Weapon.AmmoType "DTMGMagazine"
	Weapon.AmmoType2 "DemonAmmo"
	Tag "Demon Tech Machine Gun"
	Weapon.SelectionOrder 380
	Weapon.KickBack 200
	Weapon.AmmoGive 76
	Weapon.AmmoGive2 20
	Weapon.AmmoUse 1
	Scale 0.95
	Weapon.SisterWeapon "PoweredDemonTechMachineGun"
	Inventory.PickupSound "weapons/demontechload"
    Inventory.PickupMessage "%o was turned into a raw cheese by %k's Demon Tech Machine Gun."
    Inventory.PickupMessage "You got the Demon Tech Machine Gun!"
	+WEAPON.AMMO_OPTIONAL
    +WEAPON.NOALERT
	+INVENTORY.UNDROPPABLE
	+NOTIMEFREEZE
  States
	{
  Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_TakeInventory("RailgunAction",1)
  DeselectLoop:
    TNT1 A 0 A_Lower
	DTGG A 1 A_Lower
	Loop
  Select:
	TNT1 A 0 A_Raise
	Wait
  Ready:
	TNT1 A 0 A_PlayWeaponSound("weapons/demontechload")
	DTGG BCDEFA 1
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DTGG A 1 A_WeaponReady
	Goto Ready+7
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")
	TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(4,3,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light1
	DTMF A 1 Bright A_FireCustomMissile("DemonTechLMGBallPlayer",frandom(-1,1),1,0,0,0,frandom(-1,1))
	TNT1 A 0 A_Light0
	DTMF B 1
	DTMF C 1
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",1,1)
	Goto ReadyLoop
	TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(4,3,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light2
	DTMF D 1 Bright A_FireCustomMissile("DemonTechLMGBallPlayer",frandom(-1,1),1,0,0,0,frandom(-1,1))
	TNT1 A 0 A_Light0
	DTMF B 1
	DTMF C 1
	DTGG A 1
	TNT1 A 0 A_ReFire
	Goto Ready+7
  Flash:
	TNT1 A 0
	Goto LightDone
  Empty:
    DTGG A 10 A_PlayWeaponSound("weapons/click")
  AltFire:
  	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,2)
    TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,2)
	TNT1 A 0
	Goto Ready+7
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",1,"MaxReload")
	DTMR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	DTMR BCD 1
	DTMR E 1 A_FireCustomMissile("DemonTechEmptyMagSpawner", 0, 0, 0, 1)
	DTMR F 1
	DTMR GG 25
	DTMR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	DTMR L 8	
	DTMR MN 2
	DTMR OP 1
	DTMR QRSTU 1
	DTMR V 2
	DTMR W 3 A_PlayWeaponSound("weapons/LMGReload3")
	DTMR X 4
	DTMR Y 3
	DTMR Z 2
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload")
  Reload:
	TNT1 A 0 A_TakeInventory("DemonAmmo",1)
	TNT1 A 0 A_GiveInventory("DTMGMagazine",1)
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,2)
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload")
    TNT1 A 0
	Goto Ready+7
  MaxReload:
	DTMR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	DTMR BCD 1
	DTMR E 1 A_FireCustomMissile("DemonTechEmptyMagSpawner", 0, 0, 0, 1)
	DTMR F 1
	DTMR GG 25
	DTMR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload2")
  Reload2:
	TNT1 A 0 A_TakeInventory("DemonAmmo",1)
	TNT1 A 0 A_GiveInventory("DTMGMagazine",1)
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,"Full")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload2")
  Full:
	DTMR L 8	
	DTMR MN 2
	DTMR OPQRS 1
	DTGG A 2
	Goto Ready+7
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+7
  GrenadeToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	DTGG ABCDEFG 1
	TNT1 A 4
	HGRN ABC 1
	HGRN D 2
	HGRN EFG 1
	HGRN HI 2
	TNT1 A 15 A_PlayWeaponSound("weapons/hgrenadepin")
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1)
	HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN J 1
	HGRN KLM 2
	HGRN NO 1
	TNT1 A 6
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Hand Grenade",1)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0
	Goto Ready+1
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto Ready+7
  MineToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	DTGG ABCDEFG 1
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1		
	TNT1 A 0 A_TakeInventory("MineAmmo",1)	  
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0)
	MINE HI 1
	MINE JK 2
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Land Mine",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0
	TNT1 A 5
	Goto Ready+1
  Spawn:
	DTGL Z -1
	Stop
	}
}

ACTOR DemonTechLMGBall : ZDemonTechProjectile 
{ 
  PROJECTILE
  Height 8
  Radius 4
  Speed 200
  Damage 10 
  Scale 0.2
  +THRUSPECIES
  +FORCERADIUSDMG
  DeathSound "weapons/demontechex"
  Decal DTRScorch
}

ACTOR DemonTechLMGBallPlayer : DemonTechLMGBall 
{ 
  Species "Player"
  Damage 13
}

ACTOR DTMGMagazine : Ammo
{
	Inventory.Amount 0
	Inventory.MaxAmount 76
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 76
	Inventory.Icon "DTMSZ0"
	+IGNORESKILL
}



ACTOR "PoweredDemonTechMachineGun" : "DemonTechMachineGun"
{
   Weapon.AmmoUse 1
   Weapon.SisterWeapon "DemonTechMachineGun"
   +WEAPON.POWERED_UP
   States
	{
  Deselect:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_TakeInventory("RailgunAction",1)
  DeselectLoop:
    TNT1 A 0 A_Lower
	DTGG A 1 A_Lower
	Loop
  Select:
	TNT1 A 0 A_Raise
	Wait
  Ready:
	TNT1 A 0 A_PlayWeaponSound("weapons/demontechload")
	DTGG BCDEFA 1
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DTGG A 1 A_WeaponReady
	Goto Ready+7
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")
	TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(4,3,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light1
	DTMF A 1 Bright A_FireCustomMissile("DemonTechLMGBallPlayer",frandom(-1,1),1,0,0,0,frandom(-1,1))
	TNT1 A 0 A_Light0
	DTMF B 1
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",1,1)
	Goto ReadyLoop
	TNT1 A 0 A_PlaySound("weapons/LMGFire",5)
	TNT1 A 0 A_AlertMonsters	
	TNT1 A 0 A_GunFlash
	TNT1 A 0 Radius_Quake(4,3,0,1,0)
	TNT1 A 0 A_SpawnItemEx("LegRifleCasing",30,3,25,Random(2,4),Random(3,6),Random(3,6),0)
	TNT1 A 0 A_Light2
	DTMF D 1 Bright A_FireCustomMissile("DemonTechLMGBallPlayer",frandom(-1,1),1,0,0,0,frandom(-1,1))
	TNT1 A 0 A_Light0
	DTMF C 1
	TNT1 A 0 A_ReFire
	Goto Ready+7
  Flash:
	TNT1 A 0
	Goto LightDone
  Empty:
    DTGG A 10 A_PlayWeaponSound("weapons/click")
  AltFire:
  	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,2)
    TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,2)
	TNT1 A 0
	Goto Ready+7
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",1,"MaxReload")
	DTMR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	DTMR BCD 1
	DTMR E 1 A_FireCustomMissile("DemonTechEmptyMagSpawner", 0, 0, 0, 1)
	DTMR F 1
	DTMR GG 25
	DTMR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	DTMR L 8	
	DTMR MN 2
	DTMR OP 1
	DTMR QRSTU 1
	DTMR V 2
	DTMR W 3 A_PlayWeaponSound("weapons/LMGReload3")
	DTMR X 4
	DTMR Y 3
	DTMR Z 2
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload")
  Reload:
	TNT1 A 0 A_TakeInventory("DemonAmmo",1)
	TNT1 A 0 A_GiveInventory("DTMGMagazine",1)
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,2)
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload")
    TNT1 A 0
	Goto Ready+7
  MaxReload:
	DTMR A 1 A_PlayWeaponSound("weapons/LMGReload2")
 	DTMR BCD 1
	DTMR E 1 A_FireCustomMissile("DemonTechEmptyMagSpawner", 0, 0, 0, 1)
	DTMR F 1
	DTMR GG 25
	DTMR HIJK 1 A_PlayWeaponSound("weapons/LMGReload1")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload2")
  Reload2:
	TNT1 A 0 A_TakeInventory("DemonAmmo",1)
	TNT1 A 0 A_GiveInventory("DTMGMagazine",1)
	TNT1 A 0 A_JumpIfInventory("DTMGMagazine",60,"Full")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,"Reload2")
  Full:
	DTMR L 8	
	DTMR MN 2
	DTMR OPQRS 1
	DTGG A 2
	Goto Ready+7
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+7
  GrenadeToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	DTGG ABCDEFG 1
	TNT1 A 4
	HGRN ABC 1
	HGRN D 2
	HGRN EFG 1
	HGRN HI 2
	TNT1 A 15 A_PlayWeaponSound("weapons/hgrenadepin")
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	TNT1 A 0 A_TakeInventory("HandGrenadeAmmo",1)
	HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0)
	HGRN J 1
	HGRN KLM 2
	HGRN NO 1
	TNT1 A 6
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Hand Grenade",1)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0
	Goto Ready+1
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	Goto Ready+7
  MineToss:
  	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown") 
	DTGG ABCDEFG 1
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1		
	TNT1 A 0 A_TakeInventory("MineAmmo",1)	  
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0)
	MINE HI 1
	MINE JK 2
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,2)
	TNT1 A 0 A_TakeInventory("Land Mine",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0
	TNT1 A 5
	Goto Ready+1
  Spawn:
	DTGL Z -1
	Stop
	}
}
