// Nailgun (Quake)

Actor NailGun : IDMWeapon
{
	Weapon.SelectionOrder 700
	Weapon.AmmoUse 1
	//Weapon.PreferredSkin "NailgunMarine"
	Weapon.AmmoGive 40
	Weapon.AmmoType "IDMClip"
	Inventory.PickupMessage "Nailgun! (Slot 4)"
	Obituary "%o was nailed by %k's Nailgun."
	Tag "Nailgun"
	+WEAPON.ALLOW_WITH_RESPAWN_INVUL
	+WEAPON.NOLMS
	States
	{
	Spawn:
      NLMG E -1 Bright
      Loop
	Select:
	  TNT1 A 0 A_PlaySound("weapons/wswitch",CHAN_WEAPON)
	Sloop:
      TNT1 A 0 A_Raise
      TNT1 A 0 A_Raise
      NLMG A 1 A_Raise
      Loop
	Deselect:
      TNT1 A 0 A_Lower
      TNT1 A 0 A_Lower
      NLMG A 1 A_Lower
      Loop
	Ready:
      NLMG A 1 A_WeaponReady
      Loop
	Fire:
      TNT1 A 0 A_PlaySound("Weapons/NailStart",CHAN_WEAPON,1)
	  TNT1 A 0 A_GunFlash("FlashStart")
	  TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2", 1, "Level2Loop")
	  Goto Normal
	Normal:
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage", 1, "Quad")
      TNT1 A 0 A_FireCustomMissile("Nail", 0, 1, -3)
	  NLMG D 2 A_FireCustomMissile("Nail", 0, 1, 3)
	  NLMG A 6
	  TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2", 1, "Level2Loop")
	  TNT1 A 0 A_Refire("FireLoop")
	  Goto Ready
	FireLoop:
	  TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2", 1, "Level2Loop")
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLoop")
	  TNT1 A 0 A_GunFlash
      TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON)
      NLMG B 2 A_FireCustomMissile("Nail", 0, 1, -3)
	  NLMG A 2
	FireLoop2:
	  TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"QuadLoop2")
	  TNT1 A 0 A_GunFlash("Flash2")
      TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON)
	  NLMG C 2 A_FireCustomMissile("Nail", 0, 1, 3)
      NLMG A 2
	  TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
      TNT1 A 0 A_Refire("FireLoop")
      Goto FireEnd
	Level2Loop:
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Level2QuadLoop")
	  TNT1 A 0 A_GunFlash("Level2Flash")
      TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON)
      TNT1 A 0 A_FireCustomMissile("Nail", 0, 1, -3)
	  NLMG D 2 A_FireCustomMissile("Nail", 0, 0, 3)
	  NLMG A 2
	  TNT1 A 0 A_JumpIfInventory("PowerQuadDamage",1,"Level2QuadLoop")
	  TNT1 A 0 A_GunFlash("Level2Flash2")
      TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON)
      TNT1 A 0 A_FireCustomMissile("Nail", 0, 1, -3)
	  NLMG D 2 A_FireCustomMissile("Nail", 0, 0, 3)
	  NLMG A 2
      TNT1 A 0 A_Refire("Fire")
	  Goto FireEnd
	Quad:
	  TNT1 A 0 A_Playsound("misc/qdmg",CHAN_5)
	  TNT1 A 0 A_FireCustomMissile("ExtremeNail", 0, 1, -3)
	  NLMG D 2 A_FireCustomMissile("ExtremeNail", 0, 1, 3)
	  NLMG A 6
	  TNT1 A 0 A_JumpIfInventory("PowerIDMWeaponLevel2", 1, "Level2Loop")
	  TNT1 A 0 A_Refire("QuadLoop")
	  Goto Ready
	QuadLoop:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	  TNT1 A 0 A_GunFlash
	  TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON,1)
      NLMG B 2 A_FireCustomMissile("ExtremeNail", 0, 1, -3)
	  NLMG A 2
	  Goto FireLoop2
	QuadLoop2:
	  TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	  TNT1 A 0 A_GunFlash("Flash2")
	  TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON,1)
	  NLMG C 2 A_FireCustomMissile("ExtremeNail", 0, 1, 3)
      NLMG A 2
	  TNT1 A 0 A_JumpIfNoAmmo("FireEnd")
      TNT1 A 0 A_Refire("QuadLoop")
      Goto FireEnd
	Level2QuadLoop:
	  TNT1 A 0 A_Playsound("misc/qdmg2",CHAN_5)
	  TNT1 A 0 A_GunFlash("Level2Flash")
      TNT1 A 0 A_PlaySound("Weapons/NailFire",CHAN_WEAPON)
      TNT1 A 0 A_FireCustomMissile("ExtremeNail", 0, 1, -3)
      NLMG D 2 A_FireCustomMissile("ExtremeNail", 0, 0, 3)
	  NLMG A 2
      TNT1 A 0 A_Refire
	FireEnd:
	  TNT1 A 0 A_Playsound("Weapons/NailStop",CHAN_WEAPON,1)
	  Goto Ready
	FlashStart:
      NLMG D 2 Bright A_Light1
	  Goto LightDone
	Flash:
	  NLMG B 3 Bright A_Light1
	  NLMG A 2 Bright A_Light1
	Flash2:
	  NLMG C 3 Bright A_Light2
	  NLMG A 2 Bright A_Light2
	  Goto LightDone
	Level2Flash:
      NLMG D 3 Bright A_Light1
	  NLMG A 2 Bright A_Light1
	  Goto LightDone
	Level2Flash2:
      NLMG D 3 Bright A_Light2
	  NLMG A 2 Bright A_Light2
	  Goto LightDone
    }
}

// Nails

ACTOR Nail : FastProjectile
{
	ProjectileKickBack 50
	Radius 1
	Height 1
	Scale 0.6
	MissileHeight 8
	Missiletype "Nailblur"
	Speed 90
	Damage (14 * random(1,4))
	DamageType "Nail"
	+BloodSplatter
	-NOTELEPORT
	+SKYEXPLODE
	SeeSound ""
	DeathSound "weapons/nailimpct"
	Obituary "%o was nailed by %k's Nailgun."
	Decal BulletChip
	States
	{
	Spawn:
      NLPJ A 2 Bright A_Playsound("weapons/nailfly",CHAN_VOICE)
      Loop
	Crash:
	Death:
      PUFF A 3 Bright
      PUFF BCD 2
	  Stop
	XDeath:
      TNT1 A 0 A_PlaySound("Weapons/NailHit")
	  TNT1 A 1 A_SpawnItemEx("BloodSplatter",0,0,0,random(0,2.5),random(0,2.5),random(0,2.5),random(0,360))
      Stop
    }
}

ACTOR Nailblur
{
	Scale 0.6
	+NOBLOCKMAP
	+NOGRAVITY
	+SHADOW
	+NOTELEPORT
	+CANNOTPUSH
	+NODAMAGETHRUST
	+CLIENTSIDEONLY
	RenderStyle Translucent
	Alpha 0.25
	States
	{
	Spawn:
	  NLPJ A 1 Bright A_FadeOut(0.05)
	  Loop
    }
}

ACTOR ExtremeNail : Nail
{
	ProjectileKickback 100
	+EXTREMEDEATH
	States
	{
	XDeath:
	  TNT1 A 0 A_Playsound("misc/crit",CHAN_AUTO)
	  TNT1 A 0 A_PlaySound("Weapons/NailHit")
	  TNT1 A 1 A_SpawnItemEx("BloodSplatter",0,0,0,random(0,2.5),random(0,2.5),random(0,2.5),random(0,360))
	  Stop
	}
}