// --------------------------------------------------------------------------
//
// Machinegun
//
// --------------------------------------------------------------------------

ACTOR EriMachinegun : AltPlayerWeapon // replaces Chaingun
{
	Game Doom
	Scale 0.8
	SpawnID 28
	Weapon.SelectionOrder 700
	Weapon.AmmoUse 1
	Weapon.AmmoGive 20
	Weapon.AmmoType "Clip"
	Inventory.PickupMessage "$GOTCHAINGUN"
	Obituary "$OB_MPCHAINGUN"
	Tag "Machinegun"
	Decal "BulletChip"
	States
	{
	Ready:
		DMGG A 0 ACS_NamedExecute("MachinegunCounter",0,0,0,0) // hide ammo counter
		DMGG A 1 A_WeaponReady
		Wait
	Deselect:
		DMGG A 0 ACS_NamedExecute("MachinegunCounter",0,0,0,0) // hide ammo counter
		DMGG A 1 A_Lower
		Wait
	Select:
		DMGG A 1 A_Raise
		Loop
	Fire:
		DMGF A 0 A_WeaponReady(WRF_NOFIRE | WRF_NOBOB | WRF_NOSWITCH | WRF_NOPRIMARY)
		DMGF A 0 A_FireBullets (5.6, 0, 1, 5, "BulletPuff")
		DMGF A 0 A_GunFlash
		DMGF A 0 ACS_NamedExecute("MachinegunCounter",0,1,0,0) // show ammo counter -- 'idle' position
		DMGF A 2 bright A_PlaySound("weapons/machinegun", CHAN_WEAPON)
		DMGF B 2 bright ACS_NamedExecute("MachinegunCounter",0,2,0,0)
		DMGF B 0 A_CheckReload
		DMGF C 0 A_FireBullets (5.6, 0, 1, 5, "BulletPuff")
		DMGF C 0 A_GunFlash
		DMGF C 0 ACS_NamedExecute("MachinegunCounter",0,1,0,0)
		DMGF C 2 bright A_PlaySound("weapons/machinegun", CHAN_WEAPON)
		DMGF D 2 bright ACS_NamedExecute("MachinegunCounter",0,2,0,0)
		DMGG B 0 A_ReFire
		Goto Ready
	Flash:
		TNT1 A 2 Bright A_Light1
		TNT1 A 2 Bright A_Light2
		Goto LightDone
	Spawn:
		DEMG A -1
		Stop
	}
}