Actor BasicWeaponPickup : Health
{
	scale 0.8
	radius 24
	height 24
	+FORCEXYBILLBOARD
	-COUNTITEM
	+INVENTORY.ALWAYSPICKUP
	Inventory.Amount 0
	Inventory.MaxAmount 99999
	Inventory.PickupMessage ""
	Inventory.PickupSound "none"
}

Actor PistolSpawner: CustomInventory
{
	scale 0.8
	radius 24
	height 24
	+THRUActorS
	+FORCEXYBILLBOARD
	Inventory.PickupMessage "$GOTPISTOL"
	Inventory.PickupSound "CLIPIN"
	Mass 1
	States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 1
			TNT1 A 0 
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			TNT1 A 0
		Stay:
			PIST G 1
			PIST G -1
			Stop
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("Clip1", 10)
			TNT1 A 0 A_JumpIfInventory("DualPistols", 1, "PickupNormal") //to avoid giving excessive ammo if you already have duals
			TNT1 A 0 A_JumpIfInventory("Schism_Pistol", 1, "DualPistol")
			TNT1 A 0 A_GiveInventory("Schism_Pistol", 1)
			Stop
		PickupNormal:	
			TNT1 A 0 A_GiveInventory("Schism_Pistol", 1)
			TNT1 A 0 A_GiveInventory("Clip1", 10)
			Stop
		DualPistol:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("LeftPistolAmmo", 16)
			TNT1 A 0 A_GiveInventory("DualPistols", 1)
			Stop
    }
}

Actor SMGSpawner : CustomInventory
{
	Mass 1
	Scale 1.0
	Radius 24
	Height 24
	Inventory.PickupSound "SMGDRAW"
	Inventory.PickupMessage "You got the Sub-machinegun! (Slot 2)"
	+THRUActorS
	+FORCEXYBILLBOARD
    States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 1
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			TNT1 A 0
			Stay:
			SMGZ A 1
			SMGZ A -1
			Stop
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("Clip1", 20)
			//TNT1 A 0 A_JumpIfInventory("DualSMG", 1, 2)
			TNT1 A 0 A_JumpIfInventory("Schism_SMG", 1, "Dual")
			TNT1 A 0 A_GiveInventory("Schism_SMG", 1)
			TNT1 A 0 A_JumpIfInventory("IsPaladin",1,"Paladin")
			Stop
		
		Paladin:
			TNT1 A 0 A_JumpIfInventory("Shield_SMG", 1, "Dual")
			TNT1 A 0 A_GiveInventory("Shield_SMG")
			Stop
			
		Dual:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("LeftSMGAmmo", 41)
			TNT1 A 0 A_GiveInventory("DualSMG", 1)
			Stop	
    }
}

Actor MP40Spawner: CustomInventory
{
	scale 0.8
	radius 24
	height 24
	+THRUActorS +FORCEXYBILLBOARD
	Inventory.PickupMessage "You got the Mp-40"
	Inventory.PickupSound "CLIPIN"
	Mass 1
	States
	{
		Spawn:
			TNT1 A 0
			TNT1 A 1
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			TNT1 A 0
			Stay:
			MP40 I 1
			MP40 I -1
			Stop
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("MP40", 1, "Dual")
		PickupNormal:	
			TNT1 A 0 A_GiveInventory("MP40", 1)
			TNT1 A 0 A_GiveInventory("Mauser9mm", 30)
			Stop
		Dual:
			TNT1 A 0 A_GiveInventory("DualMP40", 1)
			TNT1 A 0 A_GiveInventory("Mauser9mm", 10)
			Stop
    }
}

Actor ShotgunSpawner: CustomInventory
{
	scale 0.8
	radius 24
	height 24
	+THRUActorS 
	+FORCEXYBILLBOARD
	Inventory.PickupMessage "$GOTSHOTGUN"
	Inventory.PickupSound "weapons/sgpump"
	Mass 1
    States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 2
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			Stay:
			SHTC A 1
			SHTC A -1
			Stop
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("SSG",1,"HaveSSG")
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"HaveAssaultShotgun")
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"HaveQuadShotgun")
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)
			Goto GiveAmmo
					
			HaveSSG:
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"GiveAmmo") 
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"GiveAmmo")
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)
			Goto GiveAmmo
		
			HaveAssaultShotgun:
			TNT1 A 0 A_JumpIfInventory("SSG",1,"GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"GiveAmmo")
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)
			Goto GiveAmmo	
		
			HaveQuadShotgun:
			TNT1 A 0 A_JumpIfInventory("SSG",1,"GiveAmmo") 
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"GiveAmmo")
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)
			Goto GiveAmmo		

		GiveAmmo:
			TNT1 A 0 A_GiveInventory("AmmoShell", 8)
			Stop
    }
}

Actor ShotgunSpawnerReplacer : BasicWeaponPickup Replaces Shotgun
	{
		States
		{
			Spawn:
				TNT1 A 0
				TNT1 A 2
				TNT1 A 0 A_Jump(64, "Revolver", "SniperRifle")
				TNT1 A 0 A_Jump(32, "BoltRifle")
				TNT1 A 0 A_Jump(15, "SMG")
				Shotgun:
				TNT1 A 0
				TNT1 A 0 A_SpawnItemEx ("ShotgunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
				TNT1 A 1
				TNT1 A -1
				Stop
				Revolver:
				TNT1 A 0
				TNT1 A 0 A_SpawnItemEx ("Revolver",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
				TNT1 A 1
				TNT1 A -1
				Stop
				BoltRifle:
				TNT1 A 0
				TNT1 A 0 A_SpawnItemEx ("BoltRifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
				TNT1 A 1
				TNT1 A -1
				Stop
				SniperRifle:
				TNT1 A 0
				TNT1 A 0 A_SpawnItemEx ("SniperRifle",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
				TNT1 A 1
				TNT1 A -1
				Stop
				SMG:
				TNT1 A 0
				TNT1 A 0 A_SpawnItemEx ("SMGSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
				TNT1 A 1
				TNT1 A -1
				Stop
		}
	}

Actor SSGSpawner: CustomInventory
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupMessage "$GOTSHOTGUN2"
 Inventory.PickupSound "CLIPINSS"
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		Stay:
		SGN2 A 1
		SGN2 A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("SSG",1,"DontGiveSecondSSG") //player already have SSG - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"HaveShotGun")
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"HaveAssaultShotgun")
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"HaveQuadShotgun") 		//Case 3
		TNT1 A 0 A_GiveInventory("SSG",1)
		Goto GiveAmmo
				
		HaveShotGun: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("SSG",1)	//If player have only regular Shotgun, but not AS or QSSG, then give weapon and ammo
		Goto GiveAmmo
	
		HaveAssaultShotgun: //player have AssaultShotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("SSG",1)	//If player have only Assault Shotugn, but not regular shotgun or QSSG, then give weapon and ammo
		Goto GiveAmmo	
	
		HaveQuadShotgun:
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"DontGive") 		//if player have another second weapon then give only ammo
		TNT1 A 0 A_GiveInventory("SSG",1)	//If player have only Quad Shotugn, but not SSG or Assault Shotgun, then give weapon and ammo
		Goto GiveAmmo		

	GiveAmmo:
		TNT1 A 0 A_GiveInventory("SSGAmmo", 2)
		TNT1 A 0 A_GiveInventory("AmmoShell", 8)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many shotguns",1)
		SGN2 A 30 
		Stop
		Fail
		
		DontGiveSecondSSG:
		TNT1 A 0 A_Print("You don't need one more SSG...",1)
		SGN2 A 30 
		Stop
		Fail
    }
}

Actor AssaultShotgunSpawner: CustomInventory
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupMessage "You got the Assault Shotgun! (Slot 3)"
 Inventory.PickupSound "CBOXPKUP"
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
	Stay:
		A12P A 1
		A12P A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("IsSorcerer",1,"ItsNotForSorcerer")
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"DontGiveSecondWeapon") //player already have SSG - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"HaveShotGun")
		TNT1 A 0 A_JumpIfInventory("SSG",1,"HaveSSG")
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"HaveQuadShotgun") 		//Case 3
		TNT1 A 0 A_GiveInventory("AssaultShotgun",1)
		Goto GiveAmmo
				
		HaveShotGun: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("SSG",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("AssaultShotgun",1)	//If player have only regular Shotgun, but not SSG or QSGG, then give weapon and ammo
		Goto GiveAmmo
	
		HaveSSG:
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("AssaultShotgun",1)	//If player have only SSG, but not regular shotgun or QSSG, then give weapon and ammo
		Goto GiveAmmo	
	
		HaveQuadShotgun:
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
		TNT1 A 0 A_JumpIfInventory("SSG",1,"DontGive") 		//if player have another second weapon then give only ammo
		TNT1 A 0 A_GiveInventory("AssaultShotgun",1)	//If player have only Quad Shotugn, but not SSG or Assault Shotgun, then give weapon and ammo
		Goto GiveAmmo		

	ItsNotForSorcerer:
		TNT1 A 0 A_Print("Sorcerers don't use such primitive kind of firepower",1)
		Stop
		Fail
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("AmmoShell", 8)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many shotguns",1)
		A12P A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("You don't need one more AssaultShotgun...",1)
		A12P A 30 
		Stop
		Fail
    }
}

Actor QuadShotgunSpawner: CustomInventory
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupMessage "You got THE QUAD SHOTGUN!!!! (Slot 3)"
 Inventory.PickupSound "CLIPINSS"
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
	Stay:
		QSGS A 1
		QSGS A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("IsSorcerer",1,"ItsNotForSorcerer")
		TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"DontGiveSecondWeapon") //player already have SSG - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"HaveShotGun")
		TNT1 A 0 A_JumpIfInventory("SSG",1,"HaveSSG")
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"HaveAssaultShotgun") 		//Case 3
		TNT1 A 0 A_GiveInventory("QuadShotgun",1)
		Goto GiveAmmo
				
		HaveShotGun: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("SSG",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("QuadShotgun",1)	//If player have only regular Shotgun, but not SSG or QSGG, then give weapon and ammo
		Goto GiveAmmo
	
		HaveSSG:
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("QuadShotgun",1)	//If player have only SSG, but not regular shotgun or QSSG, then give weapon and ammo
		Goto GiveAmmo	
	
		HaveAssaultShotgun:
		TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
		TNT1 A 0 A_JumpIfInventory("SSG",1,"DontGive") 		//if player have another second weapon then give only ammo
		TNT1 A 0 A_GiveInventory("QuadShotgun",1)	//If player have only Assault Shotgun, then give weapon and ammo
		Goto GiveAmmo		

	ItsNotForSorcerer:
		TNT1 A 0 A_Print("Sorcerers don't use such primitive kind of firepower",1)
		QSGS A 30 
		Stop
		Fail
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("QSSGAmmo", 4)
		TNT1 A 0 A_GiveInventory("AmmoShell", 8)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many shotguns",1)
		QSGS A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("You don't need four more barrels...",1)
		QSGS A 30 
		Stop
		Fail
    }
}

actor SSGSpawnerReplacer: BasicWeaponPickup Replaces  SuperShotgun
{
    States
    {
		Spawn:
			TNT1 A 2
			TNT1 A 0 A_Jump(96, "QSG")
			SSG:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("SSGSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop
		QSG:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("QuadShotgunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop	
	}
}

Actor RifleSpawner : CustomInventory Replaces Pistol
{
	scale 0.8
	radius 24
	height 24
	+THRUActorS
	+FORCEXYBILLBOARD
	Inventory.PickupMessage "$GOTRIFLE"
	Inventory.PickupSound "CLIPIN"
	Mass 1
    States
    {
		Spawn:
			RIFL A 0
			TNT1 A 1
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			TNT1 A 0
			Stay:
			RIFL A 1
			RIFL A -1
			Stop
	
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("DualRifles", 1, "GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("Rifle", 1, "DualRifle")
			TNT1 A 0 A_JumpIfInventory("Minigun", 1, "HaveMinigun")
			TNT1 A 0 A_JumpIfInventory("HeavyRifle", 1, "HaveHeavyRifle")
			TNT1 A 0 A_JumpIfInventory("Machinegun", 1, "HaveMachinegun")
			TNT1 A 0 A_GiveInventory("Rifle", 1)
			Goto GiveAmmo
		
		HaveMinigun:
			TNT1 A 0 A_JumpIfInventory("HeavyRifle", 1, "GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("Machinegun", 1, "GiveAmmo")
			TNT1 A 0 A_GiveInventory("Rifle", 1)
			Goto GiveAmmo
	
		HaveHeavyRifle:
			TNT1 A 0 A_JumpIfInventory("Minigun", 1, "GiveAmmo") 
			TNT1 A 0 A_JumpIfInventory("Machinegun", 1, "GiveAmmo")
			TNT1 A 0 A_GiveInventory("Rifle", 1)
			Goto GiveAmmo	
	
		HaveMachinegun:
			TNT1 A 0 A_JumpIfInventory("Machinegun", 1, "GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("HeavyRifle", 1, "GiveAmmo")
			TNT1 A 0 A_GiveInventory("Rifle", 1)
			Goto GiveAmmo

		DualRifle:
			TNT1 A 0 A_GiveInventory("LeftRifleAmmo", 31)
			TNT1 A 0 A_GiveInventory("DualRifles", 1)
			TNT1 A 0 A_GiveInventory("Clip2", 10)
			Stop
			
		GiveAmmo:
			TNT1 A 0 A_GiveInventory("Clip2", 10)
			TNT1 A 0 A_JumpIfInventory("IsPaladin", 1, "Paladin")
			Stop
			Paladin:
			TNT1 A 0 A_JumpIfInventory("ShieldRifle", 1, "DualRifle")
			TNT1 A 0 A_GiveInventory("ShieldRifle")
			Stop

    }
}

Actor ChaingunSpawner: CustomInventory
{
	scale 0.8
	radius 24
	height 24
	+THRUActorS +FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "$GOTCHAINGUN"
	Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		MGUN A 1
		MGUN A -1
		Stop
		
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGiveSecondWeapon") //player already have t - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"HaveRifle")
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"HaveHeavyRifle")
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"HaveMachinegun")
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo
				
		HaveRifle: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo
	
		HaveHeavyRifle:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo	
	
		HaveMachinegun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"DontGive") 		//if player have another second weapon ask him drop one of them o
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo		
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("Clip2", 20)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many machineguns and rifles",1)
		MGUN A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("You don't need second minigun unless you have two more hands...",2)
		MGUN A 30 
		Stop
		Fail

    }
}

Actor MachinegunSpawner: CustomInventory
{
	scale 1.0
	radius 24
	height 24
	+THRUActorS +FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "You got the Machine Gun! (Slot 4)"
	Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		MGN1 Z 1
		MGN1 Z -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("IsSorcerer",1,"ItsNotForSorcerer")
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"DontGiveSecondWeapon") //player already have machinegun - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"HaveRifle")
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"HaveHeavyRifle")
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"HaveMinigun") 			//Case 3
		TNT1 A 0 A_GiveInventory("Machinegun",1)
		Goto GiveAmmo
				
		HaveRifle: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("Machinegun",1)
		Goto GiveAmmo
	
		HaveHeavyRifle:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("Machinegun",1)
		Goto GiveAmmo	
	
		HaveMinigun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"DontGive") 		//if player have another second weapon ask him drop one of them 
		TNT1 A 0 A_GiveInventory("Machinegun",1)
		Goto GiveAmmo		
		
	ItsNotForSorcerer:
		TNT1 A 0 A_Print("Your wisdom don't allow you to carry such a heavy weights",1)
		QSGS A 30 
		Stop
		Fail
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("Clip3", 100)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many machineguns and rifles",1)
		MGN1 Z 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("No one can handle TWO of this machineguns!",2)
		MGN1 Z 30 
		Stop
		Fail

    }
}

Actor HeavyRifleSpawner: CustomInventory
{
	scale 1.0
	radius 24
	height 24
	+THRUActorS +FORCEXYBILLBOARD
	Inventory.PickupSound "SRBOLT"
	Inventory.PickupMessage "You got the anti-material Heavy Assault Rifle ''Alpha''! (Slot 4)"
	Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		HAR1 A 1
		HAR1 A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"GiveAmmo") //player already have heavy rifle - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"HaveRifle")
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"HaveHeavyRifle")
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"HaveMinigun") 			//Case 3
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo
				
		HaveRifle: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo
	
		HaveMachinegun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) then ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGive") 		//if player have another second weapon then ask him drop one of them
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo	
	
		HaveMinigun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player have 2 of 4 weapons (full slot) ask him drop one of them 
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"DontGive") 		//if player have another second weapon ask him drop one of them 
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo		
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("Clip3", 10)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many machineguns and rifles",1)
		HAR1 A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("Even one heavy rifle is more than enough...",2)
		HAR1 A 30 
		Stop
		Fail

    }
}

actor ChaingunSpawnerReplacer : BasicWeaponPickup Replaces Chaingun
{
    States
    {
	 Spawn:
		TNT1 A 2
		TNT1 A 0 A_Jump(64, "ASG")
		TNT1 A 0 A_Jump(96, "Machinegun")		
		Chaingun:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("ChaingunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	Machinegun:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("MachinegunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	ASG:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("AssaultShotgunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	}
}

Actor RocketLauncherSpawner : CustomInventory
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupSound "ROCKPKUP"
 Inventory.PickupMessage "$GOTLAUNCHER" 
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		RLAU A 1
		RLAU A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("AmmoRocket", 2)
		TNT1 A 0 A_GiveInventory("Rocket_Launcher", 1)
		Stop
    }
}

Actor GrenadeLauncherSpawner: CustomInventory 2551
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 //$category Weapons
 Inventory.PickupSound "ROCKPKUP"
 Inventory.PickupMessage "You got the Grenade Launcher!"
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		GLAP A 1
		GLAP A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("GrenadeLauncher", 1)
		TNT1 A 0 A_GiveInventory("AmmoRocket", 2)
		Stop
    }
}

actor RLSpawnerReplacer  : BasicWeaponPickup Replaces RocketLauncher
{
    States
    {
	 Spawn:
		TNT1 A 2
		TNT1 A 0 A_Jump(9, "Crossbow")
		TNT1 A 0 A_Jump(128, "AML")
		TNT1 A 0 A_Jump(128, "GrenadeLauncher")	
		RocketLauncher:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("RocketLauncherSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	 GrenadeLauncher:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("GrenadeLauncherSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	Crossbow:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("DV_Crossbow",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	AML: 
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("AdvancedMissileLauncher",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	}
}

Actor PlasmaGunSpawner : CustomInventory
{
	scale 0.8
	radius 24
	height 24
	+FORCEXYBILLBOARD
	Inventory.PickupSound "PLSDRAW"
	Inventory.PickupMessage "$GOTPLASMA"
	Mass 1
	States
	{
		Spawn:
			PLAS A -1
			Stop
		Pickup:
			TNT1 A 0 
			TNT1 A 0 A_JumpIfInventory("DualPlasmaRifles", 1, "GiveOnlyAmmo")
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "GiveDual")
			TNT1 A 0 A_JumpIfInventory("RailGun", 1, "HaveRailgun")
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "HaveTesla")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "HaveCat")
			Normal:
			TNT1 A 0 A_GiveInventory("Plasma_gun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveRailgun:
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Plasma_gun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveTesla:
			TNT1 A 0 A_JumpIfInventory("RailGun", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Plasma_gun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveCat:
			TNT1 A 0 A_JumpIfInventory("RailGun", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Plasma_gun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		GiveDual:
			TNT1 A 0
			TNT1 A 0 A_GiveInventory("LeftPlasmaGunAmmo", 50)
			TNT1 A 0 A_GiveInventory("DualPlasmaRifles", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		GiveOnlyAmmo:
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		NoMore:
			TNT1 A 0 A_Print("You can't carry more than 2 energy weapons", -30)
			PLAS A 30
			Stop
			Fail
	}
}

Actor RailgunSpawner : PlasmaGunSpawner
{
	//$category "Weapons"
	Inventory.PickupMessage "You got the Railgun!"
	States
	{
		Spawn:
			SRCG A -1
			Stop
		Pickup:
			TNT1 A 0 
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "HavePlasmaGun")
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "HaveTesla")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "HaveCat")
			Normal:
			TNT1 A 0 A_GiveInventory("Railgun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HavePlasmaGun:
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Railgun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveTesla:
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Railgun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveCat:
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Railgun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
	}
}

Actor FreezerSpawner : PlasmaGunSpawner 
{
	//$category "Weapons"
	Inventory.PickupMessage "You got the Freezer!"
    States
    {
		Spawn:
			FRZR ABCB 5
			Loop
		Pickup:
			TNT1 A 0 
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "HavePlasmaGun")
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "HaveTesla")
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "HaveRailgun")
			Normal:
			TNT1 A 0 A_GiveInventory("CatsFreezer", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HavePlasmaGun:
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("Railgun", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveTesla:
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("CatsFreezer", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveRailgun:
			TNT1 A 0 A_JumpIfInventory("Tesla", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("CatsFreezer", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
    }
}

Actor TeslaSpawner : PlasmaGunSpawner
{
	//$category "Weapons"
	Inventory.PickupMessage "You got the Tesla Cannon!"
	States
	{
		Spawn:
			ETRO A -1
			Stop
		Pickup:
			TNT1 A 0 
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "HavePlasmaGun")
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "HaveCat")
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "HaveRailgun")
			Normal:
			TNT1 A 0 A_GiveInventory("Tesla", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HavePlasmaGun:
			TNT1 A 0 A_JumpIfInventory("CatsFreezer", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("tesla", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveCat:
			TNT1 A 0 A_JumpIfInventory("Railgun", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("tesla", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		HaveRailgun:
			TNT1 A 0 A_JumpIfInventory("catsfreezer", 1, "NoMore")
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "NoMore")
			TNT1 A 0 A_GiveInventory("tesla", 1)
			TNT1 A 0 A_GiveInventory("AmmoCell", 50)
			Stop
		
	}
}

actor PlasmagunReplacer : BasicWeaponPickup Replaces PlasmaRifle
{
    States
    {
		Spawn:
			TNT1 A 2
			TNT1 A 0 A_Jump(48, "Spawn2")
			TNT1 A 0 A_Jump(64, "Tesla")
			TNT1 A 0 A_Jump(64, "Freezer")
			Spawn1:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("PLasmagunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop
		Spawn2:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("RailgunSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop
		Freezer:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("FreezerSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop
		Tesla:
			TNT1 A 0
			TNT1 A 0 A_SpawnItemEx ("TeslaSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
			TNT1 A 1
			TNT1 A -1
			Stop
	}
}

actor BFGReplacer : BasicWeaponPickup Replaces BFG9000
{
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 2
		TNT1 A 0 A_JumpIfInventory("NaziVerificate1", 1, "MG42")
		TNT1 A 0 A_Jump(4, "Unmaker")
		TNT1 A 0 A_Jump(48, "BFG10K")
			
	Spawn1:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("BFG9000Spawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
	
	 BFG10K:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("BFG10KSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
		
	Unmaker:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("UnmakerSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop
		
	Flamethrower:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx ("Flamethrower2",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION | SXF_TRANSFERAMBUSHFLAG ,0)
		TNT1 A 1
		TNT1 A -1
		Stop	

	MG42:
		TNT1 A 0
		TNT1 A 0 A_ChangeFlag("COUNTKILL", 0)
		TNT1 A 0 A_ChangeFlag("THRUActorS", 1)
		TNT1 A 0 A_ChangeFlag("NOTARGET", 1)
		TNT1 A 0 A_ChangeFlag("NOBLOCKMAP", 1)
		TNT1 A 0 A_SpawnItemEx("HitlersBuzzsaw", 0, 0, 0, 0, 0, 0, 0, SXF_TRANSFERPOINTERS | SXF_TRANSFERAMBUSHFLAG)
		TNT1 A 1
		TTN1 A -1
		Stop
	}
}

Actor BFG9000Spawner: CustomInventory
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupSound "BFGREADY"
 Inventory.PickupMessage "$GOTBFG9000"
 Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 2
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
	Stay:
		BFUG A 1
		BFUG A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("BIG_FUCKING_GUN", 1)
		TNT1 A 0 A_GiveInventory("AmmoCell", 100)
		Stop
    }
}

Actor BFG10KSpawner: CustomInventory 2553
{
 scale 0.8
 radius 24
 height 24
 //$category "Weapons"
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupSound "BFGREADY"
 Inventory.PickupMessage "You got the BFG 10K! Holy Shit!"
 Mass 1
    States
    {

	 Spawn:
		TNT1 A 0
		TNT1 A 2
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
	Stay:
		BFG2 A 1
		BFG2 A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("BFG10K", 1)
		TNT1 A 0 A_GiveInventory("AmmoCell", 100)
		Stop
    }
}

Actor UnmakerSpawner: CustomInventory 8845
{
 //$category "Weapons"
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 Inventory.PickupSound "BFGREADY"
 Inventory.PickupMessage "You got the sinister Unmaker, the power of hell itself. (Slot 8)"
 Mass 1

    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 2
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
	Stay:
		UNHW A 1
		UNHW A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("Unmaker", 1)
		TNT1 A 0 A_GiveInventory("SoulAmmo", 100)
		Stop
    }
}

Actor ChainsawSpawner: CustomInventory Replaces Chainsaw
{
 scale 0.8
 radius 24
 height 24
 +THRUActorS +FORCEXYBILLBOARD
 inventory.pickupsound "weapons/chainsaw/draw"
 Inventory.PickupMessage "$GOTCHAINSAW"
 Mass 1
    States
    {

	 Spawn:
		TNT1 A 0
		TNT1 A 0 A_SpawnItemEx("EvidenceCheckerChainsaw", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		CSAW A 10
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		CSAW A -1
		Stop
	Pickup:
	    TNT1 A 0
		TNT1 A 0 A_GiveInventory("Chain_Saw", 1)
		Stop
    }
}


Actor HeavyRifleSpawnerDroped: CustomInventory
{
	scale 1.0
	radius 24
	height 24
	+THRUActorS +FORCEXYBILLBOARD
	Inventory.PickupSound "CBOXPKUP"
	Inventory.PickupMessage "You got the anti-material Heavy Assault Rifle ''Alpha''! (Slot 4)"
	Mass 1
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		HAR1 A 1
		HAR1 A -1
		Stop
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"GiveAmmo") //player already have heavy rifle - he don't need one more
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"HaveRifle")
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"HaveMachinegun")
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"HaveMinigun") 			//Case 3
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo
				
		HaveRifle: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"GiveAmmo") 	//if player has a heavy ammo weapon give ammo
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"DontGive") 		//if player has full slot with no heavy ammo weapons don't give weapon
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo
	
		HaveMachinegun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"GiveAmmo")
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"GiveAmmo")
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo	
	
		HaveMinigun:
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"GiveAmmo") 		//if player has a heavy ammo weapon give ammo
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"DontGive") 	//if player has full slot with no heavy ammo weapons don't give weapon
		TNT1 A 0 A_GiveInventory("HeavyRifle",1)
		Goto GiveAmmo		
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("Clip3", 10)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many machineguns and rifles",1)
		HAR1 A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("Even one heavy rifle is more than enough...",2)
		HAR1 A 30 
		Stop
		Fail

    }
}

Actor DropedChaingunSpawner: ChaingunSpawner
{
    States
    {
	 Spawn:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
		TNT1 A 0
	Stay:
		MGUN A 1
		MGUN A -1
		Stop
		
	Pickup:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("Minigun",1,"GiveAmmo") //player already have this weapon, give only ammo
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"HaveRifle")
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"HaveHeavyRifle")
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"HaveMachinegun")
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo
				
		HaveRifle: //player have Shotgun (1 of 4 weapons in slot)
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"GiveAmmo") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"GiveAmmo") 		//if player have another second weapon then then give only ammo
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo
	
		HaveHeavyRifle:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"GiveAmmo") 	//if player have 2 of 4 weapons (full slot) then give only ammo  
		TNT1 A 0 A_JumpIfInventory("Machinegun",1,"GiveAmmo") 		//if player have another second weapon then then give only ammo
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo	
	
		HaveMachinegun:
		TNT1 A 0 A_JumpIfInventory("Rifle",1,"GiveAmmo") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
		TNT1 A 0 A_JumpIfInventory("HeavyRifle",1,"GiveAmmo") 		//if player have another second weapon then give only ammo
		TNT1 A 0 A_GiveInventory("Minigun",1)
		Goto GiveAmmo		
		
	GiveAmmo:
		TNT1 A 0 A_GiveInventory("Clip2", 20)
		Stop
		
		DontGive:
		TNT1 A 0 A_Print("You can't carry too many machineguns and rifles",1)
		MGUN A 30 
		Stop
		Fail
		
		DontGiveSecondWeapon:
		TNT1 A 0 A_Print("You don't need second minigun unless you have two more hands...",2)
		MGUN A 30 
		Stop
		Fail

    }
}

Actor ShotgunSpawnerDroped : ShotgunSpawner
{
    States
    {
		Spawn:
			TNT1 A 0
			TNT1 A 2
			TNT1 A 0 A_ChangeFlag("THRUActorS", 0)
			Stay:
			SHTC A 1
			SHTC A -1
			Stop
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Shot_Gun",1,"GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("SSG",1,"HaveSSG")
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"HaveAssaultShotgun")
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"HaveQuadShotgun")
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)
			Goto GiveAmmo
					
			HaveSSG:
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"GiveAmmo")
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"GiveAmmo") 		//if player have another second weapon then give only ammo
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)	//If player have only SSG, but not AS or QSSG, then give shotgun and ammo
			Goto GiveAmmo
		
			HaveAssaultShotgun: //player have AssaultShotgun (1 of 4 weapons in slot)
			TNT1 A 0 A_JumpIfInventory("SSG",1,"GiveAmmo") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
			TNT1 A 0 A_JumpIfInventory("QuadShotgun",1,"GiveAmmo") 		//if player have another second weapon then give only ammo
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)	//If player have only Assault Shotugn, but not SSG or QSSG, then give shotgun and ammo
			Goto GiveAmmo	
		
			HaveQuadShotgun:
			TNT1 A 0 A_JumpIfInventory("SSG",1,"GiveAmmo") 	//if player have 2 of 4 weapons (full slot) then give only ammo 
			TNT1 A 0 A_JumpIfInventory("AssaultShotgun",1,"GiveAmmo") 		//if player have another second weapon then give only ammo
			TNT1 A 0 A_GiveInventory("Shot_Gun",1)	//If player have only Quad Shotugn, but not SSG or Assault Shotgun, then give shotgun and ammo
			Goto GiveAmmo		
		GiveAmmo:
			TNT1 A 0 A_GiveInventory("AmmoShell", 8)
			Stop
    }
}

Actor DropedPlasmaGun: PlasmagunSpawner
{
    States
    {
		Pickup:
			TNT1 A 0
			TNT1 A 0 A_JumpIfInventory("Plasma_Gun", 1, "DualPlasma")
			TNT1 A 0 A_GiveInventory("Plasma_Gun", 1)
			Stop
		DualPlasma:
			TNT1 A 0 A_GiveInventory("DUalPlasmaRifles", 1)
			Stop
    }
}