Actor "Nail-Machine Gun" : AOWWeapon
{
    Weapon.BobSpeed 1.75
    Weapon.BobRangeX 0.2
    Weapon.BobRangeY 0.4
    Weapon.BobStyle Alpha
    +ALT_AMMO_OPTIONAL
    Inventory.PickupMessage "You got the Nail-Machine Gun!"
    Obituary "$OB_NAILMACHINEGUN"
    Weapon.KickBack 40
    Weapon.AmmoType "Nails"
    Weapon.AmmoUse 1
    Weapon.AmmoGive 40
    Weapon.AmmoType2 "NailBombs"
    Weapon.AmmoUse2 1
    Weapon.AmmoGive2 0
    Inventory.PickupSound "Misc/W_PkUp"
    Weapon.SelectionOrder 7
    Weapon.UpSound "weapons/select14"	
	Weapon.PreferredSkin "Nailgun(MG)_Marine"
    States
    {
    Spawn:
        NLMG F -1
        Loop
    Select:
		NLMG A 1 offset (90,100)
		NLMG A 1 offset (80,89)
		NLMG A 1 offset (70,79)
		NLMG A 1 offset (60,70)
		NLMG A 1 offset (50,62)
		NLMG A 1 offset (40,55)
		NLMG A 1 offset (30,49)
		NLMG A 1 offset (20,44)
		NLMG A 1 offset (15,40)
		NLMG A 1 offset (10,37)
		NLMG A 1 offset (5,34)
		NLMG A 1 offset (0,0)
		TNT1 A 0 A_TakeInventory("SelectAnimation",1)
		goto ready
	Deselect:
	    TNT1 A 0 A_TakeInventory("ActionFragGrenade",1)	
        TNT1 A 0 A_TakeInventory("ActionFlashbang",1)
        TNT1 A 0 A_TakeInventory("ActionRemoteC4",1)	
        TNT1 A 0 A_TakeInventory("ActionMeleeAttack",1)
		TNT1 A 0 A_TakeInventory("ActionReload",1)	
		NLMG A 1 offset (4,34)
		NLMG A 1 offset (8,40)
		NLMG A 1 offset (16,49)
		NLMG A 1 offset (24,62)
		NLMG A 1 offset (32,79)
		NLMG A 1 offset (40,100)
		TNT1 A 0 offset (1, 33)
		TNT1 A 0 A_Lower
		wait
    Ready:
	    TNT1 A 0 A_JumpIfInventory("SelectAnimation",1,"Select")
		TNT1 A 0 A_JumpIfInventory("ActionFragGrenade",1,"UseFragGrenade")
		TNT1 A 0 A_JumpIfInventory("ActionFlashbang",1,"UseFlashbang")
		TNT1 A 0 A_JumpIfInventory("ActionRemoteC4",1,"UseRemoteC4")
		TNT1 A 0 A_JumpIfInventory("ActionMeleeAttack",1,"UseMeleeAttack")
		TNT1 A 0 A_TakeInventory("ActionReload",1)
        NLMG A 1 A_WeaponReady
        Loop
    Fire:
 	    TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
	    TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
	    TNT1 A 0 A_JumpIfInventory ("IsNailMachineGunner", 1, "Fire_2")		
        NLMG B 0 A_PlayWeaponSound("Weapons/NailMGFire")
        NLMG B 1 A_FireCustomMissile("MGNail", Random(6, -6), 1, -3, 0, 0, Random(2, -2))
		NLMG B 0 Radius_Quake (2, random (3, 6), 0, 1, 0)
	    NLMG B 0 A_SetPitch(pitch-0.75)	
	    NLMG B 1
        NLMG B 0 Bright A_Light2
        NLMG C 1 A_SetPitch(pitch+0.75)
        NLMG A 1
        NLMG D 0 A_PlayWeaponSound("Weapons/NailMGFire")
        NLMG D 1 A_FireCustomMissile("MGNail", Random(6, -6), 1, 3, 0, 0, Random(2, -2))
		NLMG D 0 Radius_Quake (2, random (3, 6), 0, 1, 0)
	    NLMG D 0 A_SetPitch(pitch-0.75)		
        NLMG D 1	
        NLMG D 0 Bright A_Light2
        NLMG E 1 A_SetPitch(pitch+0.75)
        NLMG A 1
        NLMG E 0 A_Light0
        Goto Ready
    Fire_2:
 	    TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "Ready")
	    TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "Ready")
        NLMG B 0 A_PlayWeaponSound("Weapons/NailMGFire")
        NLMG B 1 A_FireCustomMissile("MGNail", Random(4, -4), 1, -3, 0, 0, Random(2, -2))
		NLMG B 0 Radius_Quake (2, random (3, 6), 0, 1, 0)
	    NLMG B 0 A_SetPitch(pitch-0.75)	
	    NLMG B 1
        NLMG B 0 Bright A_Light2
        NLMG C 1 A_SetPitch(pitch+0.75)
        NLMG A 1
        NLMG D 0 A_PlayWeaponSound("Weapons/NailMGFire")
        NLMG D 1 A_FireCustomMissile("MGNail", Random(4, -4), 1, 3, 0, 0, Random(2, -2))
		NLMG D 0 Radius_Quake (2, random (3, 6), 0, 1, 0)
	    NLMG D 0 A_SetPitch(pitch-0.75)		
        NLMG D 1	
        NLMG D 0 Bright A_Light2
        NLMG E 1 A_SetPitch(pitch+0.75)
        NLMG A 1
        NLMG E 0 A_Light0
        Goto Ready	
    AltFire:
 	    TNT1 A 0 A_JumpIfInventory ("IsInSpawnRoom", 1, "AltRejected")
	    TNT1 A 0 A_JumpIfInventory ("InMenu", 1, "AltRejected")
	    TNT1 A 0 A_JumpIfNoAmmo ("AltRejected")
	    TNT1 A 0 A_JumpIfInventory("IsBlue", 1, "AltFireBlue")
	    TNT1 A 0 A_JumpIfInventory ("IsNailMachineGunner", 1, "AltFire_2")	
	    NLMG A 0 A_PlayWeaponSound ("Weapons/NailSGFire")
	    NLMG A 1 offset (0, 32) A_FireCustomMissile ("NailBomb", 0, 1, 0, 0)
		NLMG A 0 Radius_Quake(7,random(5,6),0,1,0)
	    goto AltReload
    AltFire_2:
	    NLMG A 0 A_PlayWeaponSound ("Weapons/NailSGFire")
	    NLMG A 1 offset (0, 32) A_FireCustomMissile ("NailBombBig", 0, 1, 0, 0)
		NLMG A 0 Radius_Quake(7,random(5,6),0,1,0)
	    goto AltReload	
    AltFireBlue:
	    TNT1 A 0 A_JumpIfInventory ("IsNailMachineGunner", 1, "AltFireBlue_2")	  
	    NLMG A 0 A_PlayWeaponSound ("Weapons/NailSGFire")
	    NLMG A 1 offset (0, 32) A_FireCustomMissile ("NailBombBlue", 0, 1, 0, 0)
	    NLMG A 0 Radius_Quake(7,random(5,6),0,1,0)
	    goto AltReload
    AltFireBlue_2:
	    NLMG A 0 A_PlayWeaponSound ("Weapons/NailSGFire")
	    NLMG A 1 offset (0, 32) A_FireCustomMissile ("NailBombBigBlue", 0, 1, 0, 0)
	    NLMG A 0 Radius_Quake(7,random(5,6),0,1,0)
	    goto AltReload	
    AltReload:
	    NLMG A 1 offset (0, 35)
	    NLMG A 1 offset (0, 38)
	    NLMG A 1 offset (0, 41)
	    NLMG A 1 offset (0, 44)
	    NLMG A 1 offset (0, 47)
	    NLMG A 2 offset (0, 50)
	    NLMG A 1 offset (0, 47)
	    NLMG A 1 offset (0, 44)
	    NLMG A 1 offset (0, 41)
	    NLMG A 1 offset (0, 38)
	    NLMG A 1 offset (0, 35)
	    NLMG A 1 offset (0, 32)
		NLMG A 15
	    NLMG A 0 A_ReFire
	    goto Ready
    AltRejected:
	    NLMG A 35 A_WeaponReady (WRF_NOSECONDARY)
	    goto Ready			
    Flash:
	    TNT1 A 2 A_Light1
	    TNT1 A 2 A_Light2
	    TNT1 A 0 A_Light0
	    stop
	}
}

Actor MGNail
{
  Projectile
  Radius 3
  Height 3
  Speed 44
  Damage (21)
  Scale 0.5
  +BloodSplatter
  SeeSound ""
  DeathSound ""
  DamageType "Bullet"
  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
  Speed 0.2
  RenderStyle Translucent
  Alpha 0.5
  +NoGravity
  +DropOff
  States
  {
  Spawn:
    DART A 1 A_FadeOut(0.1)
    Loop
  }
}

Actor NailBombBig {
	Radius 11
	Height 11
	Speed 25
	Reactiontime 35
	SEESOUND "Weapons/NBBounce"
	DEATHSOUND "Weapons/NailBombExp"
	PROJECTILE
	-SHOOTABLE
	+DOOMBOUNCE
	+RANDOMIZE
	+GRENADETRAIL
	-NOGRAVITY
	+CANBOUNCEWATER
	+BOUNCEONACTORS
	states
	{
	Spawn:
		NBMR A 2 A_Countdown	
		NBMR AB 6
		Loop
	Death:
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 0)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 20)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 40)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 60)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 80)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 100)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 120)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 140)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 160)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 180)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 200)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 220)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 240)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 260)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 280)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 300)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 320)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 340)
		WSMK ABCDE 5
		Stop
	}
}

Actor NailBombBigBlue : NailBombBig {
	states
	{
	Spawn:
		NBMB A 2 A_Countdown
		NBMB AB 6
		Loop
	}
}

Actor NailBomb {
	Radius 11
	Height 11
	Speed 25
	Reactiontime 35
	SEESOUND "Weapons/NBBounce"
	DEATHSOUND "Weapons/NailBombExp"
	PROJECTILE
	-SHOOTABLE
	+DOOMBOUNCE
	+RANDOMIZE
	+GRENADETRAIL
	-NOGRAVITY
	+CANBOUNCEWATER
	+BOUNCEONACTORS
	states
	{
	Spawn:
		NBMR A 2 A_Countdown	
		NBMR AB 6
		Loop
	Death:
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 0)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 40)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 80)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 120)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 160)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 200)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 240)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 280)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 320)
		WSMK E 0 A_CustomMissile("Nail1", 4, 2, 350)
		WSMK ABCDE 5
		Stop
	}
}

Actor NailBombBlue : NailBomb {
	states
	{
	Spawn:
		NBMB A 2 A_Countdown
		NBMB AB 6
		Loop
	}
}

Actor Nail1
{
        Projectile
	    Obituary "$OB_NAILGRENADE"
        Radius 5
        Height 8
        Speed 32
        Damage (65)
        Scale 0.6
        +BLOODSPLATTER
        seeSound ""
        DeathSound ""
        DamageType "Bullet"
        Decal Bulletchip
        States
        {
        Spawn:
            DART A 1 A_CustomMissile("NailBlur", 0, 0, 180)
        	DART A 0 A_PlaySound("weapons/nailflight")
            Loop
        Crash:
        	DART B 0 A_PlaySound("weapons/nailhit")
        	DART BCDEFG 2
        	Stop
        XDeath:
        	DART B 0 A_PlaySound("weapons/nailhitbleed")
        	DART BCDEFG 2
        	Stop
        Death:
        	DART B 0 A_PlaySound("weapons/nailhit")
        	DART BCDEFG 2
        	Stop
        }
}

