Actor KyleIMMines : Weapon
{
    +WIMPY_WEAPON
	+NOALERT
	+NOAUTOAIM
	+AMMO_OPTIONAL
	+ALT_AMMO_OPTIONAL
	+UNDROPPABLE
	Weapon.AmmoUse1 1
	Weapon.AmmoType1 "IMMines"
	Weapon.AmmoUse2 1
	Weapon.AmmoType2 "IMMines"
	Weapon.BobStyle InverseSmooth
	Weapon.BobSpeed 0.9	
	States
	{
	Ready:
	    DF06 A 0 A_JumpIfNoAmmo("ReadyOutOfAmmo")//Don't change the sprite name or weapon not worked!)
	    DF06 A 1 A_WeaponReady
	    Loop
	//---------Ready for out ammo--------------//	
	ReadyOutOfAmmo:
	    DF00 A 0 A_JumpIfInventory("IMMines", 1, "PickedAmmo")
	    DF00 A 1 A_WeaponReady
		Loop
	//------------------------------------------//	
	//----If ammo out and player picked up ammo, using it animation---//
	//----And Going to Normal Ready state-----------------------------//
	PickedAmmo:	
		DF06 A 1 offset(27, 68)
		DF06 A 1 offset(21, 60)
		DF06 A 1 offset(15, 52)
		DF06 A 1 offset(9, 44)
		DF06 A 1 offset(3, 36)
	    Goto Ready
	//----------------------------------------------------------------//	
	Select:
	    NULL A 0 A_JumpIfNoAmmo("SelectOutOfAmmo")
		DF06 A 1 offset(27, 68)
		DF06 A 1 offset(21, 60)
		DF06 A 1 offset(15, 52)
		DF06 A 1 offset(9, 44)
		DF06 A 1 offset(3, 36)	
		DF06 AAAAAAAAAAAAAAAAAAAA 0 A_Raise
	    DF06 A 1 A_Raise
	    Goto Select+6
	//-------If ammo out, using it animation------//	
	SelectOutOfAmmo:
		DF00 A 1 offset(27, 68)
		DF00 A 1 offset(21, 60)
		DF00 A 1 offset(15, 52)
		DF00 A 1 offset(9, 44)
		DF00 A 1 offset(3, 36)	
		DF00 AAAAAAAAAAAAAAAAAAAA 0 A_Raise
	    DF00 A 1 A_Raise
	    Goto Select+5
	//---------------------------------------------//	
	Deselect:
	    NULL A 0 A_JumpIfNoAmmo("DeselectOutOfAmmo")
	    DF06 A 1 offset(3, 36)
		DF06 A 1 offset(9, 44)
		DF06 A 1 offset(15, 52)
		DF06 A 1 offset(21, 60)
		DF06 A 1 offset(27, 68)
		DF06 AAAAAAAAAAAAAAAAAAA 0 A_Lower
	    DF06 A 1 A_Lower
		Goto Deselect+6
	//--------If ammo out, using it animation----//	
	DeselectOutOfAmmo:
	    DF00 A 1 offset(3, 36)
		DF00 A 1 offset(9, 44)
		DF00 A 1 offset(15, 52)
		DF00 A 1 offset(21, 60)
		DF00 A 1 offset(27, 68)
		DF00 AAAAAAAAAAAAAAAAAAA 0 A_Lower
	    DF00 A 1 A_Lower
		Goto Deselect+5
	//------------------------------------------------//
	Fire:
	    NULL A 0 A_JumpIfNoAmmo("ReadyOutOfAmmo")
	    DF06 B 1 Bright offset(0, 32)
		DF06 B 2 Bright offset(0, 52)
		DF06 B 2 Bright offset(0, 72)
		NULL A 1 A_SpawnItem("IMMineInstantaneous")
		NULL A 10
		NULL A 0 A_JumpIfNoAmmo("ReadyOutOfAmmo")
		DF06 A 2 offset(0, 72)
		DF06 A 2 offset(0, 52)
		DF06 A 1 offset(0, 32)
	    Goto Ready
	AltFire:
	    NULL A 0 A_JumpIfNoAmmo("ReadyOutOfAmmo")
	    DF06 B 1 Bright offset(0, 32)
		DF06 B 2 Bright offset(0, 52)
		DF06 B 2 Bright offset(0, 72)
		NULL A 1 A_SpawnItemEx("IMMinePermanent", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		NULL A 0 A_TakeInventory("IMMines", 1)
		NULL A 10
		NULL A 0 A_JumpIfNoAmmo("ReadyOutOfAmmo")
		DF06 A 2 offset(0, 72)
		DF06 A 2 offset(0, 52)
		DF06 A 1 offset(0, 32)
	    Goto Ready
	//-------Out of ammo-------//	
	OutOfAmmo:
	    DF00 A 1 A_WeaponReady
		Goto ReadyOutOfAmmo
	//-------------------------//
	//----You crazy?) It weapons never spawn on map)---//
	//----But on map spawn ammo for weapon xd)---------//
	 //Spawn:
	    //Stop
	//-------------------------------------------------//
	}
}

Actor IMMineInstantaneous
{
    +SOLID
    +SHOOTABLE
	+DONTGIB
	+NOICEDEATH
	Mass 9999
	Radius 0
    Height 0
    Health 1
	States
	{
	Spawn:
	   TNT1 A 0 
	   TNT1 A 0 A_PlaySound("MineSpawn")
	   DFP5 AAA 35 Bright
	   DFP5 A 1 Bright A_PlaySound("MineBeep")
	   DFP5 A 15 Bright
	   TNT1 A 0 A_Die
	Death:   
	   TNT1 A 0 A_Explode(90, 250)
	   TNT1 A 0 A_PlaySound("MineExplode")
	   DFP5 CDEFGHIJKLMNO 3 Bright
	   Stop
	   }
}

	   
Actor IMMinePermanent	   
{
  health 1
  radius 10
  height 6
  Damage 1
  speed 0
  mass 999999999
  -SOLID
  +NOGRAVITY
  +MISSILE
  +SHOOTABLE
  +NOBLOOD
  +NODAMAGETHRUST
	States
	{
	Spawn:
	   TNT1 A 0
	   TNT1 A 0 A_PlaySound("MineSpawn")
	   DFP5 A 35
	   Looping:
	   DFP5 A 1 A_JumpIfCloser(50, "Explode")
       Loop 
	Explode:
	   DFP5 A 1 Bright A_PlaySound("MineBeep")
	   DFP5 A 30 Bright
	   TNT1 A 0 A_Explode(90, 250)
	   TNT1 A 0 A_PlaySound("MineExplode")
	   DFP5 CDEFGHIJKLMNO 3 Bright
	   Stop  
	XDeath:
	   DFP5 A 1 Bright A_PlaySound("MineBeep")
	   DFP5 A 30 Bright
	   TNT1 A 0 A_Explode(90, 250)
	   TNT1 A 0 A_PlaySound("MineExplode")
	   DFP5 CDEFGHIJKLMNO 3 Bright
	   Stop  
	   
	   }
} 
	   