actor VantaGatling_NormalBar : NormalBar {args 65,60}
actor VantaGatling_ScriptBar : ScriptBar{}

actor VantaGatlingUpgrade : BaseMM8BDMBusterUpgrade
{
inventory.amount 1
inventory.maxamount 1
inventory.pickupmessage "$PU_VANTAGATLING"
Tag "$TAG_VANTAGATLING"
obituary "$OB_VANTAGATLING"
inventory.icon "VGATICON"
Inventory.PickupSound "item/1up"
Inventory.RespawnTics 350
scale 2.0
+COUNTITEM
+INVBAR
states
{
SpawnLoop:
VGAT Z 1 
loop
Use:
TRBB I 0 A_PlaySoundEx("item/refill","Voice")
TNT1 A 0 A_GiveInventory("BusterGiven",1)
TRBB I 0 A_GiveInventory("VantaGatling",1)
TRBB I 0 A_SelectWeapon("VantaGatling")
stop
}
}

actor VantaGatlingUpgrade_Respawn : 8BDMItemRespawn
{
	translation "192:192=65:65", "198:198=60:60"
	mass 350
}
actor VantaGatlingUpgrade_RespawnShadow : 8BDMItemRespawnShadow
{
	mass 350
	States
	{
	Spawn:
		VGAT Z 0
		goto Super::Spawn
	}
}

actor VantaGatling : BaseMM8BDMWep
{
Weapon.AmmoUse 1
Weapon.AmmoGive 9
Weapon.SlotNumber 1
scale 2.0
inventory.pickupmessage "$PU_VANTAGATLING"
Tag "$TAG_VANTAGATLING"
inventory.icon "NULLICON"
weapon.ammotype "VantaGatlingAmmo"
+WEAPON.AMMO_OPTIONAL
+WEAPON.DONTBOB
States
{
Spawn:
VGAT Z 1
stop
Ready:
VGAT B 0 A_JumpIfInventory("BusterGiven",1,"TakeBusters")
Goto Ready2
TakeBusters:
VGAT B 0 A_GiveInventory("TakeBuster", 1)
Goto Ready2
Ready2:
VGAT A 0 ACS_NamedExecuteWithResult("core_weaponcolor",CLR_DARKMAN3)
VGAT A 0 A_GiveInventory("VantaGatlingFlag",1)
VGAT A 0 A_SpawnItemEx("VantaGatlingActor",0,0,0,0,0,0,0,0)
VGAT A 0 A_SpawnItemEx("VantaGatlingActor2",0,0,0,0,0,0,0,0)
Ready3:
VGAT A 1 A_WeaponReady
Goto Ready3
ReadyC: Goto Ready3
Deselect:
VGAT A 0 
goto DeselectSwap
Select:
VGAT A 0 
goto SelectSwap
Fire:
VGAT A 0 A_TakeInventory("VantaGatlingFireFlag",99)
VGAT A 0 A_TakeInventory("VantaGatlingFireFlag2",99)
VGAT A 0 A_PlaySoundEx("misc/fakeshot","Weapon")
VGAT A 0 A_GiveInventory("VantaGatlingFireFlag",1)
VGAT A 2 OffSet(10,42)A_FireCustomMissile("VantaGatlingShotSP",0,1,8,0)
VGAT A 0 A_GiveInventory("VantaGatlingFireFlag2",1)
VGAT A 2 OffSet(20,52)
VGAT A 0 A_JumpIfNoAmmo(2)
VGAT A 0 A_Refire
VGAT A 0
VGAT A 1 OffSet(10,42)
VGAT A 2 A_WeaponReady(14)
VGAT A 2 OffSet(0,24)
VGAT A 0 A_TakeInventory("VantaGatlingFireFlag",99)
VGAT A 0 A_TakeInventory("VantaGatlingFireFlag2",99)
VGAT A 4 OffSet(0,16)
VGAT A 2 OffSet(0,44)
FireReload:
VGAT A 0 
VGAT A 0 A_PlaySoundEx("weapon/adapterreturn","Weapon")
VGAT A 2 OffSet(0,62)A_GiveInventory("VantaGatlingAmmo",1)
VGAT A 2 OffSet(0,57)
VGAT A 0 A_JumpIfInventory("VantaGatlingAmmo",9,1)
goto FireReload
VGAT A 2 OffSet(0,44)
VGAT A 3 A_WeaponReady(14)
goto Ready3

Flash:
TNT1 A 0 A_JumpIfInventory("IsDead",1,"NoFlash")
NoFlash:
TNT1 A 0
stop

NoAmmo:
VGAT A 1
Goto Ready3
}
}

actor VantaGatlingAmmo : Ammo
{
inventory.amount 1
inventory.maxamount 9
+INVENTORY.IGNORESKILL
}

actor VantaGatlingFlag : Once {}
actor VantaGatlingFireFlag : Once {}
actor VantaGatlingFireFlag2 : Once {}

actor VantaGatlingActor : BasicShieldWarper
{
	speed 100
	translation "192:192=65:65", "198:198=60:60"
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("core_shieldwarper", 0, 1)
		TNT1 A 0 A_Jump(256, "Shield")
		Goto Shield
	Shield:
		VGAT B 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT B 0 A_JumpIfInTargetInventory("VantaGatlingFireFlag2",1,"ShieldFrame3")
		VGAT B 0 A_JumpIfInTargetInventory("VantaGatlingFireFlag",1,"ShieldFrame2")
		VGAT B 1 A_Warp(AAPTR_TARGET, -1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		loop
	ShieldFrame2:
		VGAT C 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT C 1 A_Warp(AAPTR_TARGET, -1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		goto Shield
	ShieldFrame3:
		VGAT D 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT D 1 A_Warp(AAPTR_TARGET, -1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		goto Shield
	}
}

actor VantaGatlingActor2 : VantaGatlingActor
{
	States
	{
	Shield:
		VGAT B 0
		VGAT B 1 A_JumpIf(CallACS("vile_IsPointerClient",2)==1,"Spawn2")//A_Stop
		goto Shield2
		Spawn2:
		VGAT A 0 //A_SetScale(1.5)
		VGAT B 1 A_SetTranslucent(0.05*0.01)
		goto Shield2
	Shield2:
		VGAT B 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT B 0 A_JumpIfInTargetInventory("VantaGatlingFireFlag2",1,"ShieldFrame3")
		VGAT B 0 A_JumpIfInTargetInventory("VantaGatlingFireFlag",1,"ShieldFrame2")
		VGAT B 1 A_Warp(AAPTR_TARGET, 1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		loop
	ShieldFrame2:
		VGAT C 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT C 1 A_Warp(AAPTR_TARGET, 1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		goto Shield2
	ShieldFrame3:
		VGAT D 0 ACS_NamedExecuteWithResult("core_copytranslation_client",0)
		VGAT D 1 A_Warp(AAPTR_TARGET, 1, 18, 14, 0, WARPF_COPYINTERPOLATION|WARPF_NOCHECKPOSITION)
		goto Shield2
	}
}

actor VantaGatlingShotSP : MegaShot
{
translation "210:210=216:216"
PROJECTILE
+LOOKALLAROUND
+SKYEXPLODE
+DONTBLAST
+FORCEXYBILLBOARD
radius 16
height 16
speed 50
scale 2.5
damage (CallACS("vile_cbm_damage",11))
obituary "$OB_VANTAGATLING"
damagetype "VantaGatling"
States
{
Spawn:
DARS D 1
loop
}
}
