ACTOR "Demon Tech Railgun  " : Weapon replaces "Demon Tech Railgun "
{
//$Category Weapons/LCA
//$Sprite DRGIA0
//$Title "Demon Tech Railgun"
Scale 0.8
Decal "GreenRocketScorch"
+WEAPON.NOALERT  
+WEAPON.NOAUTOAIM
+WEAPON.AMMO_OPTIONAL
-INVENTORY.UNDROPPABLE
Weapon.PreferredSkin "DTechRailgun-Marine"
Weapon.Selectionorder 4000
Weapon.KickBack 200
Weapon.AmmoUse 10
Weapon.AmmoGive 60
Weapon.AmmoGive2 60
Weapon.AmmoType "DemonAmmoCharge"
Weapon.AmmoType2 "DemonAmmo"
DamageType "PlayerDTRG"
AttackSound "weapons/dtrailf"
Inventory.PickupSound "weapons/pickupdtrg"
Inventory.Pickupmessage "Demon Tech Railgun"
Obituary "%o sucked on %k's Demon Tech Railgun slug."
Weapon.SisterWeapon "PoweredDemonTechRailgun"
Tag "Demon Tech Railgun"
States
	{
  Spawn:
	DRGI A -1
	Loop
  Ready:
	TNT1 A 0 A_PlaySound("weapons/dtrgselect")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ChargeUp")
	Goto EmptyUp
  EmptyUp:
	TNT1 AAA 0 A_StopSound(6)
	DRGS FGHIJ 1
	Goto ReadyEmpty
  ChargeUp:
	DRGS ABCDE 1
	Goto ReadyCharge
  ReadyEmptyStart:
	TNT1 AAA 0 A_StopSound(6)
	DRGG D 1 A_WeaponReady(WRF_NOFIRE)
  ReadyEmpty:
	DRGG D 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ReadyCharge")
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	Loop
  ReadyChargeStart:
	DRGG AABBCC 1 A_WeaponReady(WRF_NOFIRE)
  ReadyCharge:
	TNT1 A 0 A_PlaySound("weapons/dtrailgunhum",6,1.0,1)
	DRGG A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG A 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG B 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG B 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG B 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG C 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG C 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	DRGG C 1 A_WeaponReady
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAction",1,"GrenadeCheck")
	TNT1 A 0 A_JumpIfInventory("MineAction",1,"MineCheck")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ReadyCharge")
	Goto ReadyEmptyStart
  Select:
	TNT1 A 0 A_Raise
	Wait
  Deselect:
	TNT1 A 0
	TNT1 AAA 0 A_StopSound(6)
	TNT1 A 0 A_PlaySound("weapons/weapondown",CHAN_WEAPON)
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_TakeInventory("RailgunAction",1)
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"Deselect2")
	DRGS JIHGF 1 A_Lower
	Wait
  Deselect2:
	DRGS EDCBA 1 A_Lower
	Wait
  Fire:
	TNT1 A 0 A_JumpIfNoAmmo("Empty")
	TNT1 A 0 A_AlertMonsters  
	TNT1 A 0 Radius_Quake(12,4,0,1,0)
	TNT1 A 0 A_GunFlash
	TNT1 A 0 A_Light1
	TNT1 A 0 A_FireCustomMissile("DTRail",0,0,0,5)
	DRGF A 2 Bright A_RailAttack(450,0,1,"00 FF 85",None,0,0,"PlayerRailPuffGreen",0,0,8192,35,0.5,0.5,"DTRailCoreTrail")
	DRGF B 2 Bright A_Light2
	TNT1 A 0 A_Light0
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ChargedRecoil")
	Goto EmptyRecoil 
  EmptyRecoil:
	TNT1 AAA 0 A_StopSound(6)
	DRGF KLMN 2
	DRGF OPQ 1
	DRGG D 1
	DRGG DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD 1 A_WeaponReady(WRF_NOPRIMARY|WRF_NOBOB)
	Goto ReadyEmptyStart
  ChargedRecoil:
	DRGF CDEF 2
	DRGF GHI 1
	DRGF J 1
	DRGF JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ 1 A_WeaponReady(WRF_NOPRIMARY|WRF_NOBOB)
	Goto ReadyChargeStart
  Empty:
	TNT1 A 0 A_PlaySound("weapons/click2")
	DRGG DDDDDDDDDDDDDDD 1 A_WeaponReady(WRF_NOFIRE)
  AltFire:
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",60,"ReadyChargeStart")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ChargeReload")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",10,"EmptyReload")	
	Goto ReadyEmptyStart
  EmptyReload:
	DG96 WXYZ 2
	Goto ChargeReload2
  ChargeReload:
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",1,1)
	Goto ReadyChargeStart
	DG96 ABCD 2
  ChargeReload2:
	DG96 EF 2
	DG96 G 4 A_PlaySound("weapons/demontecheject",6)
	TNT1 A 0 A_PlaySound("weapons/demontechsteam",1)
	DG96 HIJ 2
	DG96 K 3
	DG96 L 20 A_FireCustomMissile("DemonTechEmptyMagSpawner",random(-13,-15),0,2,1)
	DG96 MNO 1
	DG96 PQ 2
	DG96 R 4
	DG96 R 6 A_PlayWeaponSound("weapons/demontechload")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",10,"Reload")
  Low:
	DG96 S 4
	DG96 "Y" 3 A_PlayWeaponSound("weapons/demontechclick")
	DG96 "X" 2
	DG96 W 4
	Goto ReadyEmptyStart
  Full:
	DG96 S 4
	DG96 T 3 A_PlayWeaponSound("weapons/demontechclick")
	DG96 U 2
	DG96 V 4
	Goto ReadyChargeStart
  Reload:
	TNT1 A 0 A_TakeInventory("DemonAmmo",10,TIF_NOTAKEINFINITE)
	TNT1 A 0 A_GiveInventory("DemonAmmoCharge",10)
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",60,"Full")
	TNT1 A 0 A_JumpIfInventory("DemonAmmo",10,"Reload")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"Full")
	Goto Low
  GrenadeCheck:
	TNT1 A 0 A_JumpIfInventory("HandGrenadeAmmo",1,"GrenadeToss")
	TNT1 A 0 A_TakeInventory("HandGrenadeAction",1)
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ReadyChargeStart")
	Goto ReadyEmptyStart
  GrenadeToss:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"GrenadeToss1")
	DRGS JIHGF 1
	Goto GrenadeToss2
  GrenadeToss1:	
	DRGS EDCBA 1
  GrenadeToss2:
	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,TIF_NOTAKEINFINITE)
	HGNE A 1 A_FireCustomMissile("ThrownGrenade",0,0,0,0,false)
	HGRN J 1
	HGRN KLM 2
	HGRN "NO" 1
	TNT1 A 6 A_TakeInventory("HandGrenadeAction",1)
	Goto Ready+1
  MineCheck:
	TNT1 A 0 A_JumpIfInventory("MineAmmo",1,"MineToss")
	TNT1 A 0 A_TakeInventory("MineAction",1)
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"ReadyChargeStart")
	Goto ReadyEmptyStart
  MineToss:
	TNT1 A 0 A_PlayWeaponSound("weapons/weapondown")
	TNT1 A 0 A_JumpIfInventory("DemonAmmoCharge",10,"MineToss1")
	DRGS JIHGF 1
	Goto MineToss2
  MineToss1:
	DRGS EDCBA 1
  MineToss2:
	TNT1 A 8
	TNT1 A 0 A_PlayWeaponSound("weapons/hgrenadethrow")
	MINE ABCDEF 1
	TNT1 A 0 A_TakeInventory("MineAmmo",1,TIF_NOTAKEINFINITE)	
	MINE G 1 A_FireCustomMissile("ThrownMine",0,0,0,0,false)
	MINE HI 1
	MINE JK 2
	TNT1 A 5 A_TakeInventory("MineAction",1)
	Goto Ready+1
	}
}