//Copy of v6b 'tanks.txt'
//
//Adds a check for NoAmmoPickup on WTank to prevent pickup

actor ETank : BaseMM8BDMUseItem 10091
{
//$Category MM8BDM-Assists/Tanks
//$Title E-Tank
//$Sprite EBALF0
inventory.amount 1
//Inventory.RespawnTics 350
inventory.maxamount 1
inventory.pickupmessage "$PU_ETANK"
Tag "$TAG_ETANK"
inventory.icon "ETANK"
Inventory.PickupSound "item/1up"
+INVBAR
+COUNTITEM
scale 2.0
States
{
SpawnLoop:
EBAL F 0 
EBAL F 0 A_JumpIf(tid!=0, 2)
EBAL F 0 Thing_ChangeTID(0,999)
EBAL FE 6
Goto SpawnLoop+3
Use:
//EBAL E 0 A_JumpIfHealthLower(100,"Success")
EBAL E 0 A_JumpIf(CallACS("core_CanGainHealth"),"Success")
fail
Success:
EBAL E 0 A_PlaySound("item/energyup")
EBAL E 0 A_PlaySoundEx("item/refill","Voice")
EBAL E 0 A_SpawnItemEx("ETankUse",  0, 0, 0, momx, momy, 20, 0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_SpawnItemEx("ETankUse2", 0, 0, 0, momx, momy,  0, 0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_GiveInventory("ETankHeal",1)
EBAL E 0 A_TakeInventory("ETank",1)
fail
Death:
TNT1 A 0
stop
}
}

actor ETankHeal : CustomInventory
{
states
{
Pickup:
//TNT1 A 0 HealThing(100)
TNT1 A 0 ACS_NamedExecuteWithResult("core_HealScript",100)
stop
}
}

actor ETank_Respawn : 8BDMColoredItemRespawn { mass 1050 }
actor ETank_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL F 0
		goto Super::Spawn
	}
}

actor LTank : ETank
{
inventory.pickupmessage "$PU_LTANK"
+INVENTORY.AUTOACTIVATE
-INVBAR
States
{
SpawnLoop:
EBAL K 0 
EBAL K 0 A_JumpIf(tid!=0, 2)
EBAL K 0 Thing_ChangeTID(0,999)
EBAL KE 6
Goto SpawnLoop+3
Use:
Success:
EBAL E 0 A_PlaySound("item/energyup")
EBAL E 0 A_PlaySoundEx("item/refill","Voice")
EBAL E 0 A_SpawnItemEx("ETankUse",  0, 0, 0, momx, momy, 20, 0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_SpawnItemEx("ETankUse2", 0, 0, 0, momx, momy,  0, 0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_GiveInventory("ETankHeal",1)
EBAL E 0 A_TakeInventory("LTank",1)
fail
Death:
TNT1 A 0
stop
}
}

actor ETankUse : BasicWatcher
{
-CLIENTSIDEONLY
reactiontime 4
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("ETankParticle2", random( 48,  64), random( 48,  64), random(32, 64), momx, momy, 0, random(0, 360), SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle2", random( 48,  64), random(-64, -48), random(16, 32), momx, momy, 0, random(0, 360), SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle2", random(-64, -48), random( 48,  64), random(32, 64), momx, momy, 0, random(0, 360), SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle2", random(-64, -48), random(-64, -48), random(16, 32), momx, momy, 0, random(0, 360), SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
SpawnLoop:
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,0,   SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,1*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,2*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,3*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,4*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,5*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,6*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 0 A_SpawnItemEx("ETankParticle1",50,0,0,momx,momy,0,7*45,SXF_ABSOLUTEMOMENTUM|SXF_WEPFXCOLOR)
TNT1 A 1
TNT1 A 0 A_SetAngle(angle+10)
TNT1 A 0 A_CountDown
loop
Death:
TNT1 A 0
stop
}
}

actor ETankUse2 : ETankUse
{
	States
	{
	Spawn:
		goto Super::SpawnLoop
	}
}

actor ETankParticle1 : BasicGraphicEffect
{
States
{
SpawnFrame:
LTFX ABCD 2
stop
}
}

actor ETankParticle2 : BasicGraphicEffect
{
States
{
SpawnFrame:
LTFX EFGHI 2
stop
}
}

actor CustWepCanHoldWTank : Once {}

actor WTank : BaseMM8BDMUseItem 10151
{
//$Category MM8BDM-Assists/Tanks
//$Title W-Tank
//$Sprite EBALH0
inventory.amount 1
inventory.maxamount 5
//Inventory.RespawnTics 350
inventory.pickupmessage "$PU_WTANK"
Tag "$TAG_WTANK"
inventory.icon "WTANK"
Inventory.PickupSound "item/1up"
translation "192:192=170:170", "198:198=41:41"
+INVBAR
+COUNTITEM
scale 2.0
States
{
SpawnLoop:
EBAL H 0
EBAL H 0 A_JumpIf(tid!=0, 2)
EBAL H 0 Thing_ChangeTID(0,999)
EBAL HE 6
Goto SpawnLoop+3
Use:
//TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_ammocheck",0),"Success")
TNT1 A 0 A_JumpIf(CallACS("core_CanGainAmmo"),"Success")
fail
Success:
EBAL E 0 A_PlaySound("item/energyup")
EBAL E 0 A_PlaySoundEx("item/refill","Voice")
EBAL E 0 A_SpawnItemEx("WTankUse", 0, 0, 0, momx, momy, 0, 0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_GiveInventory("WTankAmmo",1)
EBAL E 0 A_TakeInventory("WTank",1)
fail

PickupFail://$CBM
TNT1 A 0
fail
Pickup:
TNT1 A 0 A_JumpIfInventory("NoAmmoPickup",1,"PickupFail")//$CBM
TNT1 A 0 A_JumpIf(!CheckClass("CustWepClassBase",AAPTR_DEFAULT,true),"PickupHold")
TNT1 A 0 A_JumpIfInventory("CustWepCanHoldWTank",1,"PickupHold")
PickupUse:
//TNT1 A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_ammocheck",0),"PickupUseSuccess")
TNT1 A 0 A_JumpIf(CallACS("core_CanGainAmmo"),"PickupUseSuccess")
stop
PickupHold:
TNT1 A 0 A_RailWait
stop
PickupUseSuccess:
EBAL E 0 A_GiveInventory("WTankAmmo",1)
TNT1 A 0 A_SpawnItemEx("TakeWTank")
stop
}
}

actor WTankAmmo : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_NamedExecuteWithResult("core_AmmoScript",100)
stop
}
}

actor TakeWTank
{
-SOLID
+NOINTERACTION
+NOGRAVITY
Scale 2.5
+MISSILE
+DONTBLAST
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_TakeFromTarget("WTank",1)
Death:
TNT1 A 0
stop
}
}

actor WTankUse : ETankUse
{
reactiontime 8
States
{
Spawn:
TNT1 A 0
Spawn2:
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,0*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,1*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,2*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,3*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,4*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,5*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,6*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
TNT1 A 0 A_SetScale(2.5, random(2.5, 3.5))
TNT1 A 0 A_SpawnItemEx("WTankParticle",48,0,0,momx,momy,0,7*45,SXF_ABSOLUTEMOMENTUM|SXF_TRANSFERSCALE|SXF_WEPFXCOLOR)
stop
}
}

actor WTankParticle : BasicGraphicEffect
{
+FORCEYBILLBOARD
States
{
Spawn:
LTFX JKLM 2
stop
}
}

actor WTank_Respawn : 8BDMColoredItemRespawn { 
	translation "192:192=170:170", "198:198=41:41"
	mass 1050 
}
actor WTank_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL H 0
		goto Super::Spawn
	}
}

actor MTank : BaseMM8BDMUseItem 10154
{
//$Category MM8BDM-Assists/Tanks
//$Title M-Tank
//$Sprite EBALG0
inventory.amount 1
inventory.maxamount 1
//Inventory.RespawnTics 450
inventory.pickupmessage "$PU_MTANK"
Tag "$TAG_MTANK"
inventory.icon "MTANK"
Inventory.PickupSound "item/1up"
translation "192:192=214:214", "198:198=229:229"
+INVBAR
+COUNTITEM
scale 2.0
States
{
SpawnLoop:
EBAL G 0 
EBAL G 0 A_JumpIf(tid!=0, 2)
EBAL G 0 Thing_ChangeTID(0,999)
EBAL GE 6
Goto SpawnLoop+3
Use:
TNT1 A 0 A_JumpIf(CallACS("core_CanGainAmmo",1) || CallACS("core_CanGainHealth"),"Success")
fail
Success:
EBAL E 0 A_PlaySound("item/energyup")
EBAL E 0 A_PlaySoundEx("item/refill","Voice")
EBAL E 0 A_SpawnItemEx("ETankUse",  0, 0, 0, momx, momy, 20,    0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_SpawnItemEx("ETankUse2", 0, 0, 0, momx, momy,  0,    0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_SpawnItemEx("WTankUse",  0, 0, 0, momx, momy,  0,    0, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_SpawnItemEx("WTankUse",  0, 0, 0, momx, momy,  0, 22.5, SXF_WEPFXCOLOR|SXF_ABSOLUTEMOMENTUM)
EBAL E 0 A_GiveInventory("MTankHealAndAmmo",1)
Death:
TNT1 A 0
stop
}
}

actor MTankHealAndAmmo : CustomInventory
{
states
{
Pickup:
TNT1 A 0 A_GiveInventory("ETankHeal",1)
TNT1 A 0 A_GiveInventory("MTankAmmo",1)
stop
}
}

actor MTankAmmo : CustomInventory
{
states
{
Pickup:
TNT1 A 0 ACS_NamedExecuteAlways("core_AmmoScript_MTank",0)
stop
}
}

actor MTank_Respawn : 8BDMColoredItemRespawn { 
	translation "192:192=214:214", "198:198=229:229"
	mass 1050 
}
actor MTank_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 1050
	States
	{
	Spawn:
		EBAL G 0
		goto Super::Spawn
	}
}

actor PartyBall 11104
{
//$Category MM8BDM-Energy
+NOGRAVITY
+SHOOTABLE
+NOTAUTOAIMED
+NOBLOOD
//+FLOATBOB
//+ACTIVATEPCROSS
health 1
mass 999999
height 64
radius 32
scale 2.5

States
{
Spawn:
PRTB A 0
PRTB A 0 A_JumpIf(ACS_NamedExecuteWithResult("core_checkmode",0)==2 || ACS_NamedExecuteWithResult("core_checkmode",2)>0, "End")
PRTB A 0 A_ChangeFlag("FLOATBOB", true)
PRTB A 0 A_GiveInventory("PartyBallSpawnFunc",1)
goto Spawn2
Spawn2:
PRTB AB 1
loop
Death:
PRTB C 0 A_PlaySoundEx("misc/partyball", "Auto")
PRTB C 0 A_ChangeFlag("NOGRAVITY", 1)
PRTB C 0 A_ChangeFlag("FLOATBOB", false)
PRTB C 0 A_SpawnItemEx("PartyBallRespawner",0,0,0,0,0,0)
PRTB C 1 ThrustThingZ(0, 20, 0, 0)
PRTB C 0 A_SpawnItemEx("ConfettiSpawner",0,0,48,random(-3,3),random(-3,3))
PRTB C 1 A_SpawnItemEx("RandomItem",0,0,48,random(-3,3),random(-3,3))
PRTB CDCD 2
Explode:
PRTB C 0 A_Stop
PRTB CDCDCDCD 2
PRTB C 0 A_ChangeFlag("FLOATBOB", false)
PRTB C 0 A_PlaySoundEx("misc/mm3explosion", "Weapon")
TNT1 A 35 A_SpawnItemEx("ExplosionEffect2")
stop
End:
TNT1 A 0 
stop
}
}

actor PartyBallRespawner
{
-SOLID
+NOINTERACTION
+NOGRAVITY
Scale 2.5
States
{
Spawn:
TNT1 A 0
TNT1 AA 500
TNT1 A 0 A_SpawnItemEx("ItemFog")
TNT1 A 6
TNT1 A 0 A_SpawnItemEx("PartyBall",0,0,0)
stop
}
}

actor ConfettiSpawner 
{
//+CLIENTSIDEONLY
+NOINTERACTION
+NOGRAVITY
Height 1
Radius 1
-SOLID
ReactionTime 10
States
{
Spawn:
TNT1 A 1 A_SpawnItemEx("Confetti",random(-16, 16),random(-16, 16),Random(8, 16),random(-3,3), random(-3,3), random(1,-1),0)
TNT1 A 0 A_SpawnItemEx("Confetti",random(-16, 16),random(-16, 16),Random(8, 16),random(-3,3), random(-3,3), random(1,-1),0)
TNT1 A 0 A_SpawnItemEx("Confetti",random(-16, 16),random(-16, 16),Random(8, 16),random(-3,3), random(-3,3), random(1,-1),0)
TNT1 A 0 A_CountDown
Loop
}
}

actor Confetti
{
+MISSILE
+DONTBLAST
+CLIENTSIDEONLY
+LOWGRAVITY
+RIPPER
+DONTSPLASH
damage 0
height 2
radius 2
scale 2.0
States
{
Spawn:
PCNF A 0
PCNF A 0 A_Jump(85,"Spawn2")
PCNF A 0 A_Jump(85,"Spawn3")
Spawn1:
PCNF A 5
PCNF BCD 5 A_ChangeVelocity(momx*0.9, momy*0.9, momz, CVF_REPLACE)
PCNF ABCDABCD 5 
PCNF AAAAABBBBBCCCCCDDDDD 1 A_Fadeout
stop
Spawn2:
PCNF E 5
PCNF FEF 5 A_ChangeVelocity(momx*0.9, momy*0.9, momz, CVF_REPLACE)
PCNF EFEFEFEF 5
PCNF EEEEEFFFFFEEEEEFFFFF 1 A_Fadeout
stop
Spawn3:
PCNF G 5
PCNF HI 5 A_ChangeVelocity(momx*0.9, momy*0.9, momz, CVF_REPLACE)
PCNF GHIGHIGH 5
PCNF HHHHHIIIIIGGGGGHHHHHIIIII 1 A_Fadeout
stop
}
}

actor RandomItem
{
+NOINTERACTION
+NOGRAVITY
-SOLID
States
{
Spawn:
TNT1 A 0
TNT1 A 1 A_Jump(128, "Tanks")
TNT1 A 1 A_Jump(192, "Assists")
TNT1 A 1 A_Jump(256, "Pickups")
stop

Tanks:
TNT1 A 1 A_Jump(128, "METanks")
TNT1 A 1 A_Jump(256, "WTank")
stop

	METanks:
	TNT1 A 1 A_Jump(192, "ETank")
	TNT1 A 1 A_Jump(40, "MTank")
	TNT1 A 1 A_Jump(256, "Pickups")
	stop

Assists:
TNT1 A 1 A_Jump(192, "AssistWeps")
TNT1 A 1 A_Jump(192, "AssistOther")
TNT1 A 1 A_Jump(256, "Pickups")
stop

AssistWeps:
TNT1 A 1 A_Jump(128, "TrebleBeat", "EddieBomber")
TNT1 A 1 A_Jump(256, "TangoSummon")
stop

	TrebleBeat:
	TNT1 A 1 A_Jump(192, "TrebleSentry")
	TNT1 A 1 A_Jump(192, "BeatSupport")
	TNT1 A 1 A_Jump(256, "EnergyBalancer")
	stop
	
AssistOther:
TNT1 A 1 A_Jump(128, "ReggaeCall")
TNT1 A 1 A_Jump(256, "EnergyBalancer")
stop

Pickups:
TNT1 A 1 A_Jump(96,
"BigHealth",
"BigWeaponEnergy"
)
TNT1 A 1 A_Jump(256,
"SmallHealth",
"WeaponEnergy"
)
stop

ETank:
TNT1 A 1 A_SpawnItemEx("ETank")
stop
WTank:
TNT1 A 1 A_SpawnItemEx("WTank")
stop
MTank:
TNT1 A 1 A_SpawnItemEx("MTank")
PRTB C 0 A_SpawnItemEx("DoveSpawner",0,0,0,random(-3,3),random(-3,3))
stop
TangoSummon:
TNT1 A 1 A_SpawnItemEx("TangoSummon")
stop
TrebleSentry:
TNT1 A 1 A_SpawnItemEx("TrebleSentry")
stop
EddieBomber:
TNT1 A 1 A_SpawnItemEx("EddieBomber")
stop
BeatSupport:
TNT1 A 1 A_SpawnItemEx("BeatSupport")
stop
ReggaeCall:
TNT1 A 1 A_SpawnItemEx("ReggaeCall")
stop
EnergyBalancer:
TNT1 A 1 A_SpawnItemEx("EnergyBalancer")
stop
SmallHealth:
TNT1 A 1 A_SpawnItemEx("SmallHealth")
stop
BigHealth:
TNT1 A 1 A_SpawnItemEx("BigHealth")
stop
WeaponEnergy:
TNT1 A 1 A_SpawnItemEx("WeaponEnergy")
stop
BigWeaponEnergy:
TNT1 A 1 A_SpawnItemEx("BigWeaponEnergy")
stop
}
}