class ExplosiveBarrel2Spawner : RandomSpawner
{
	Default
	{
		DropItem "PopBarrel2", 256, 10;
		DropItem "Propane", 256, 1;
	}
}

class BarrelGrabbed2 : Inventory { Default { Inventory.MaxAmount 1; } }

class PopBarrel2 : PopBarrel
{
	Default
	{
		Tag "Explosive Barrel";
		DeathSound "";
		Translation "224:234=96:111", "235:239=241:246", "64:79=111:111", "80:95=96:111";
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay A_JumpIf(GetCVar("GC_PickupParticleChoker"), "BlastproofPants");
		BART A 1 {
			If(!A_CheckSight("Null")) {
				A_SpawnItemEx("BarrelParticle",
					frandom(10.0,-10.0),frandom(10.0,-10.0),30+frandom(2.0,-2.0),
					frandom(0.4,-0.4),frandom(0.4,-0.4),frandom(2.2,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,164);
			}
		}
		Loop;
	BlastproofPants:
		BART A 1;
		Goto Spawn;
	Death:
		BART B 2 Bright A_Scream();
		BART C 2 Bright;
		TNT1 A 0 {
			If(!GetCVar("GC_PickupParticleChoker")) {
				for(int Burl = 0; Burl < 15; Burl++) { A_SpawnItemEx("BarrelParts",0,0,0,random(2,3),0,random(6,9),random(0,360),160,0); }
			}
		}
	DeathToBarrelParts:
		BART D 2 Bright {
			A_PlaySound("Barrel/Exp");
			A_NoBlocking();
			A_SpawnItemEx("Gumpop_Impact",0,0,20,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("Gumpop_GLDEF",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		}
		BART E 2 Bright {
			A_SpawnItemEx("Pop_Explosion",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
			A_RadiusGive("GumpopDamageBonus",128,RGF_MONSTERS,1);
		}
		BART FGHIJK 2 Bright;
		BART L -1;
		Stop;
	Death.MidasCloseCombat:
	Death.SuperMidasCloseCombat:
	Death.MidasShoelaces:
	Death.SuperMidasShoelaces:
		TNT1 A 0 {
			A_PlaySound("Midas/Touched");
			A_SpawnItemEx("Midas_Statue_PopBarrel2",0,0,0,0,0,0,0,SXF_TRANSFERPOINTERS);
		}
		Stop;
	}
}

class PopBarrel2Thrown : PopBarrel2
{
	Default
	{
		Radius 12;
		Height 14;
		Speed 50;
		Damage 30;
		DamageType "Acid";
		//DeathSound "";
		Projectile;
		-NOGRAVITY
		+ROLLSPRITE
		+ROLLCENTER
		+MTHRUSPECIES
	}
	
	States
	{
	Spawn:
		TNT1 A 0 NoDelay {
			A_SetRoll(45.0);
			If(CountInv("PowerSuitToken",AAPTR_TARGET) || CountInv("PowerBerserkDamage",AAPTR_TARGET)) { A_ScaleVelocity(2.5); }
			else { A_ChangeVelocity(0,0,3); }
		}
	Looplet:
		BART T 1 {
			A_SetRoll(Roll + 15.0, SPF_INTERPOLATE);
			If(!A_CheckSight("Null")) {
				A_SpawnItemEx("BarrelParticle",
					frandom(20.0,-20.0),frandom(20.0,-20.0),frandom(20.0,-20.0),
					frandom(0.4,-0.4),frandom(0.4,-0.4),frandom(2.2,0.4),
					frandom(0.0,360.0),SXF_CLIENTSIDE,164);
			}
		}
		Loop;
	Death:
		BART B 2 Bright A_Scream();
		BART C 2 Bright A_RadiusGive("GumpopDamageBonus",128,RGF_MONSTERS,1);
		TNT1 A 0 {
			If(!GetCVar("GC_PickupParticleChoker")) {
				for(int Burl = 0; Burl < 15; Burl++) { A_SpawnItemEx("BarrelParts",0,0,0,random(2,3),0,random(6,9),random(0,360),160,0); }
			}
		}
	DeathToBarrelParts:
		BART D 2 Bright {
			A_PlaySound("Barrel/Exp");
			A_NoBlocking();
			A_SpawnItemEx("Gumpop_Impact",0,0,20,0,0,0,SXF_CLIENTSIDE);
			A_SpawnItemEx("Gumpop_GLDEF",0,0,0,0,0,0,0,SXF_CLIENTSIDE);
		}
		BART E 2 Bright {
			A_Explode(100,128,0);
			A_RadiusGive("GumpopDamageBonus",128,RGF_MONSTERS,1);
		}
		BART FGHIJK 2 Bright;
		BART L -1;
		Stop;
	}
}

class Midas_Statue_PopBarrel2 : Midas_Statue
{
	States
	{
	Spawn:
		BART A 0;
		Goto Super::Cycle;
	Death:
	Crash:
		TNT1 A 0 {
			User_GoldRange = 10;
			User_GoldAmount = 6;
			User_GoldCounter1 = 10;
			User_GoldCounter2 = 0;
		}
		Goto Super::DeathInit;
	MidasReward:
		TNT1 A 0 {
			If(GetCVar("GC_MoneyShare")) { ACS_NamedExecuteAlways("MoneySharing",0,50); }
			Else 						 { A_GiveToTarget("Dosh",50); }
		}
		Stop;
	}
}