Actor BDNailgun: BrutalWeapon
{
Game Doom
	SpawnID 28
	Weapon.SelectionOrder 58904
	Weapon.AmmoType1 "Nails"
	Weapon.AmmoType2 "Nails"
	Weapon.AmmoGive 0
	Weapon.AmmoUse1 1
	Weapon.AmmoUse2 2
	Weapon.AmmoGive1 50
	Weapon.AmmoGive2 50
	+WEAPON.NOAUTOAIM
	+WEAPON.NOAUTOFIRE
	+FORCEXYBILLBOARD
	+weapon.NOALERT
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "You got the UAC Heavy NailGun!  (Slot 4)"
	Obituary "%o was Peirced by %k's NailGun."
	AttackSound "none"
	Tag "Heavy NailGun"
	Scale 0.9
	States
	{
	Spawn:
		NLMG F -1
		Stop
		
		 Ready: 
		 Ready3:
		  NLMG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		
		  CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		  CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		  CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  NLMG A 1 A_WeaponReady
		  NLMG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
			
		  CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
		  CHAG A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  Goto IdleNoAmmo
		  
		  IdleNoAmmo:
		  NLME A 1 A_WeaponReady
		  CHAG A 0 A_TakeInventory ("Spin",1)
		  CHAG A 0 A_JumpIfInventory("Clip2",1,"Ready")
		  CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		  CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  Loop

		Ready2:
		  CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		  CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		  CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		  NLMG A 1 A_WeaponReady 
		  CHAG A 0 A_AlertMonsters
		  CHAG A 0 A_PlaySound("CHAINSPI", 5)
		  Loop
		  
	CheckSprint:
		NLMG A 1 A_WeaponReady(WRF_NOFIRE)
		CHAG A 0 A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, "StartSprint")
		Goto Ready
		
	StartSprint:
		NLMG A 1 A_WeaponReady(WRF_NOFIRE)
		CHAG A 0 A_Takeinventory("Zoomed",1)
		CHAG A 0 A_Takeinventory("ADSmode",1)
		CHAG A 0 A_ZoomFactor(1.0)
		CHAG A 0 A_JumpIfInventory("UsedStamina", 40, "StopSprintTired")
		
	Sprinting:	
		NLMG A 0 offset(-9,32) 
		NLMG A 0 offset(-9,32) A_JumpIfInventory("IsStandingStill", 1, "Ready3")
		NLMG A 0 offset(-9,32) A_JumpIfInventory("UsedStamina", 100, "StopSprintTired")
		PLAY A 0 offset(-9,32) ACS_ExecuteAlways(852, 0, 0, 0, 0)//Makes player faster.
		NLMG A 0 offset(-9,32) A_JumpIfInventory("PowerStrength", 1, 2)
		NLMG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		NLMG A 0 offset(-9,32)
		NLMG A 1 offset(-9,34) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(-6,36) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(-3,38) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(0,38) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(3,36) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(6,34) A_SetPitch(pitch -0.5)
		NLMG A 1 offset(9,32) A_SetPitch(pitch -0.5)
		NLMG A 0 offset(9,32) A_WeaponReady(WRF_NOBOB)
		CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
        CHAG A 0 A_JumpIfInventory("Taunting",1,"Taunt")
		CHAG A 0 offset(-9,32) A_GiveInventory("UsedStamina", 9)
		CHAG A 0 offset(9,33) A_SpawnItemEx("FootStep", 0, 0, 2, 0, 0, -4)
		NLMG A 1 offset(9,34) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(6,36) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(3,38) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(0,38) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(-3,36) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(-6,34) A_SetPitch(pitch +0.5)
		NLMG A 1 offset(-9,32) A_SetPitch(pitch +0.5)
		NLMG A 0 offset(-9,32) A_WeaponReady(WRF_NOBOB)
		CHAG A 0 offset(-9,32) A_JumpIfInventory("IsRunning", 1, "Sprinting")
		Goto StopSprint
		
	StopSprintTired:
		NLMG A 1
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		CHAG A 0 A_PlaySound("Tired", 2)
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		NLMG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		NLMG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		NLMG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		NLMG A 5 A_WeaponReady
		CHAG A 0 A_TakeInventory("UsedStamina", 2)
		NLMG A 5 A_WeaponReady
		Goto Ready
	StopSprint:
		NLMG A 1
		CHAG A 0 A_JumpIfInventory("UsedStamina", 60, "StopSprintTired")
		PLAY A 0 ACS_ExecuteAlways(853, 0, 0, 0, 0)//Makes player slower.
		Goto Ready 

		Deselect:
			CHAG A 0 A_TakeInventory ("Spin",1)
			CHAG A 0 A_TakeInventory("TossGrenade", 1)
			CHAG A 0 A_Takeinventory("HeavyAutomaticWeapon",1)
			CHAG A 0 A_TakeInventory("RandomHeadExploder", 1)
			CHAG A 0 SetPlayerProperty(0,0,0)
			NLMS EDCBA 1
			TNT1 AAAAAAAAAAAAAAAAAA 0 A_Lower
			TNT1 A 1 A_Lower
			Wait

		Select:
			CHAG A 0
			CHAG A 0 A_Giveinventory("GoSpecial",1)
			CHAG A 0 A_Giveinventory("HeavyAutomaticWeapon",1)
			CHAG A 0 A_Takeinventory("FistsSelected",1)
			CHAG A 0 A_Takeinventory("SawSelected",1)
			CHAG A 0 A_Takeinventory("ShotgunSelected",1)
			CHAG A 0 A_Takeinventory("SSGSelected",1)
			CHAG A 0 A_Giveinventory("MinigunSelected",1)
			CHAG A 0 A_Takeinventory("PlasmaGunSelected",1)
			CHAG A 0 A_Takeinventory("RocketLauncherSelected",1)
			CHAG A 0 A_Takeinventory("GrenadeLauncherSelected",1)
			CHAG A 0 A_Takeinventory("BFGSelected",1)
			CHAG A 0 A_Takeinventory("BFG10kSelected",1)
			CHAG A 0 A_Takeinventory("RailGunSelected",1)
			CHAG A 0 A_Takeinventory("SubMachineGunSelected",1)
			CHAG A 0 A_Takeinventory("RevenantLauncherSelected",1)
			CHAG A 0 A_Takeinventory("LostSoulSelected",1)
			CHAG A 0 A_Takeinventory("FlameCannonSelected",1)
			CHAG A 0 A_Takeinventory("HasBarrel",1)
			CHAG A 0 A_TakeInventory("TossGrenade", 1)
			CHAG A 0 A_GiveInventory("RandomHeadExploder", 1)
			CHAG A 0 A_JumpIfInventory("IsPlayingAsPurist", 1, "PuristGun")
			CHAG A 0 A_PlaySound("CHGNPKUP")
			TNT1 AAAAAA 0 A_Raise
			TNT1 AAAAAA 0 A_Raise
		
		SelectAnimation:
			CHAG A 0
			CHAG A 0 A_GunFlash
			NLMG A 1  A_JumpIfInventory("GoFatality", 1, "Steady")
			NLMG B 1  A_JumpIfInventory("GoFatality", 1, "Steady")
			NLMG C 1  A_JumpIfInventory("GoFatality", 1, "Steady")
			NLMG D 1  A_JumpIfInventory("GoFatality", 1, "Steady")
			NLMG E 1 A_JumpIfInventory("GoFatality", 1, "Steady")
			Goto Ready

		NoAmmo:
			NLME A 10 A_PlaySound("weapons/empty")
			Goto IdleNoAmmo
			
			
		Fire:
		CHAG A 0
		CHAG A 0 BRIGHT A_FireCustomMissile("Alerter", 0, 0, 0, 0)
		NLMG A 1 
		NLMG A 1
		NLMG A 1
		CHAG A 0 A_StopSound(5)
		CHAG A 0
		Hold:
			CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
			CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
			
			CHAG A 0 A_PlaySound("NAILFIRE", 1)
			CHAG A 0 A_PlaySound("FARMGN", 5)
			CHAG A 0 A_ZoomFactor(0.98)
			CHAG A 0 A_AlertMonsters 
			NLMF A 1 BRIGHT  A_FireCustomMissile("MGNail", Random(0, -2), 1, 0, 0, 0, Random(2, -2))
            NLMF B 1 BRIGHT
			 
			CHAG A 0 A_JumpIfInventory("IsTacticalClass", 1, 2)//Tactical mode skips a frame, fires faster
			NLMF C 1 BRIGHT  A_FireCustomMissile("MGNail", Random(0, -2), 1, 0, 0, 0, Random(2, -2))
			NLMF D 1 BRIGHT
			CHAG A 0 A_Firecustommissile("50CaseSpawn",0,0,-12,-18)
			CHAG A 0 A_SpawnItemEx("PlayerMuzzle3",30,5,27)
			CHAF A 0 BRIGHT A_FireCustomMissile("DecorativeTracer", random(-2,2), 0, 0, -12, 0, random(-2,2))
			CHAG A 0 A_ZoomFactor(1.0)
			
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-1.0)
			RIFG A 0
			
			CHAG A 0 A_PlaySound("NAILFIRE", 1)
			CHAG A 0 A_PlaySound("FARMGN", 5)
			CHAG A 0 A_ZoomFactor(0.98)
			//TNT1 AA 0 A_FireCustomMissile("YellowFlareSpawn",0,0,0,0)
			RIFF A 0 A_FireCustomMissile("GunFireSmoke", 0, 0, 0, -5, 0, 0)
		    NLMF EF 1 A_Refire
			
			RIFG A 0 A_JumpIfInventory("IsNOTTacticalClass", 1, 2)//tactical mode has muzzle climb
			RIFG A 0 A_SetPitch(pitch-1.0)
			RIFG A 0
			TNT1 A 0 A_ZoomFactor (1.0)
			CHAG A 0 A_PlaySound("MINIGEN", 5)
			CHAG A 0 A_JumpIfInventory("Spin",1,"Ready2")
			
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		 CHAG A 0 A_PlaySound("CHAINSTO", 5)
		 NLMG A 1 A_WeaponReady
		
		 NLMG A 1 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 CHAG A 0 A_Refire
		
		 NLMG A 1 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 NLMG A 1 A_WeaponReady
				

		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 
		 CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		 NLMG A 1 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		
		 NLMG A 1 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 NLMG A 2 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 
		 NLMG A 2 A_WeaponReady
		
		 NLMG A 2 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 NLMG A 2 A_WeaponReady
		
		 NLMG A 2 A_WeaponReady
		 CHAG A 0 A_FireCustomMissile("SmokeSpawner11",0,0,0,0)
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 NLMG AAAA 2 A_WeaponReady
		 CHAG A 0 A_JumpIfInventory("TossGrenade",1,"TossGrenade")
		 CHAG A 0 A_JumpIfInventory("Kicking",1,"DoKick")
		 CHAG A 0 A_JumpIfInventory("IsRunning",1,"CheckSprint")
		 NLMG AAAA 3 A_WeaponReady
		 
		 goto Ready
		 
	AltFire:
	CHAG A 0
		CHAG A 0 BRIGHT A_FireCustomMissile("Alerter", 0, 0, 0, 0)
		NLMG A 1 
		NLMG A 1
		NLMG A 1
		CHAG A 0 A_StopSound(5)
		CHAG A 0			
		CHAG A 0 A_JumpIfInventory("Salute1", 1, "Salute")
		CHAG A 0 A_JumpIfInventory("Salute2", 1, "Salute")
		
		CHAG A 0 A_PlaySound("NAILFIRE", 1)
		CHAG A 0 A_PlaySound("FARMGN", 5)
		CHAG A 0 A_ZoomFactor(0.98)
		NLMF G 2 Bright
		NLMF H 1 A_FireCustomMissile("MGNail",-5,1)
		TNT1 A 0 A_FireCustomMissile("MGNail",-3,0)
		TNT1 A 0 A_FireCustomMissile("MGNail",-1,0)
		TNT1 A 0 A_FireCustomMissile("MGNail",0,0)
		TNT1 A 0 A_FireCustomMissile("MGNail",2,0)
		TNT1 A 0 A_FireCustomMissile("MGNail",4,1)
		NLMF I 2 A_Recoil (0.9)
		CHAG A 0 A_ZoomFactor(1)
		NLMF I 7
		NLMF JKL 1
		NLMG A 4
		NLMG A 1 A_Refire
		GoTo Ready
		 
 }
}

Actor MGNail
{
  Projectile
  Radius 3
  Height 3
  Speed 44
  Damage 12
  Scale 0.5
  +BloodSplatter
  SeeSound ""
  DeathSound ""
  Decal BulletChip
  States
  {
  Spawn:
    NLPJ A 1 A_SpawnItemEx("NailBlur", 0, 0, 0, 1, 0, 0, 180, 128)
    NLPJ A 0 A_PlaySound("Weapons/NailFlight")
    Loop
  Crash:
  Death:
    NLPJ B 0 A_PlaySound("Weapons/NailHit")
    NLPJ BCDEFG 2
    Stop
  XDeath:
    NLPJ B 0 A_PlaySound("Weapons/NailHitBleed")
    NLPJ BCDEFG 2
    Stop
  }
}

Actor NailBlur       
{
  Height 8
  Radius 1
  Damage 0
  Scale 0.6
  Speed 0.2
  RenderStyle Translucent
  Alpha 0.5
  +NoGravity
  +DropOff
  +NoTeleport
  States
  {
  Spawn:
    NLPJ A 1 A_FadeOut(0.4)
    Loop
  }
}


Actor Nails: Ammo
{
Inventory.Amount 20
Inventory.Maxamount 600
Ammo.BackpackAmount 10
Ammo.BackpackMaxamount 800
Inventory.Icon "NBOXA0"
Inventory.PickupMessage "Picked up a Box of Nails!"

States

{

Spawn:
NBOX A -1
Stop
}

}