//Sergeant Mark IV's vehicles.
//If you want to modify and reuse this on your wad, please ask me first.

Actor HeliBase1
{
Scale 1.0
+FORCEXYBILLBOARD
+NOGRAVITY
+NOINTERACTION
+NOTIMEFREEZE
States
{
Spawn:
TNT1 A 0
HEL1 A 1
Stop
}}

Actor HeliBase2: HeliBase1
{
States
{
Spawn:
TNT1 A 0
HEL1 B 1
Stop
}}

Actor HeliBase3: HeliBase1
{
States
{
Spawn:
TNT1 A 0
HEL1 C 1
Stop
}}

Actor HeliBase4: HeliBase1
{
States
{
Spawn:
TNT1 A 0
HEL1 D 1
Stop
}}


Actor HeliBase8
{
States
{
Spawn:
TNT1 A 0
HEL1 A 8
Stop
}}



ACTOR attackhelicopter: SwitchableDecoration 7262
{
var int user_helicopterdirection;
    Scale 1.0
	Radius 36
	Height 96
	+SOLID
	+USESPECIAL
	MONSTER
	-COUNTKILL
	+SHOOTABLE
	+LOOKALLAROUND
	+THRUACTORS
	+NOINFIGHTING
	+NORADIUSDMG
	-COUNTKILL
	MaxTargetRange 120
	PainChance "Repair", 255
	BloodType "TankBlood", "TankBlood", "TankBlood"
	Activation THINGSPEC_Activate | THINGSPEC_ThingTargets | THINGSPEC_NoDeathSpecial
	Mass 9999
	Speed 0
	health 400
	damagefactor "stomp", 0
	damagefactor "Explosives", 0.5 damagefactor "bullet", 0.25 damagefactor "monsterbullet", 0.25 damagefactor "shotgun", 0
	damagefactor "Repair", 1.0 damagefactor "CheckRepair", 0.0
	damagefactor "Head", 0.0	damagefactor "FriendBullet", 0.0    damagefactor "Taunt", 0.0    damagefactor "KillMe", 0.0
	damagefactor "Shotgun", 0.7    damagefactor "Shrapnel", 0.0    damagefactor "Blood", 0.0    damagefactor "BlueBlood", 0.0
	damagefactor "Explosives", 0.5 damagefactor "bullet", 0.25 damagefactor "monsterbullet", 0.25 damagefactor "shotgun", 0 damagefactor "monstershotgun", 0.2 damagefactor "monsterminigun", 0.2
	damagefactor "GreenBlood", 0.0    damagefactor "MinorHead", 0.0    damagefactor "Decaptate", 0.0	damagefactor "MonsterKnocked", 0.0
    damagefactor "CancelTeleportFog", 0.0	damagefactor "BHFTOnBarrel", 0.0	damagefactor "GibRemoving", 0.0	damagefactor "SuperPunch", 5.0
	damagefactor "HelperMarineFatallity", 0.0	damagefactor "Leg", 0.0	damagefactor "SpawnMarine", 0.0	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseObjectsToSplash", 0.0 DamageFactor "Trample", 0.0
	DamageFactor "TankWeakSpot", 3.0 damagefactor "Plasma", 1.5 damagefactor "Plasma2", 1.5
	damagefactor "Desintegrate", 3.0 DamageFactor "Minigun", 0.2 damageFactor "Machinegun", 0.3
    States
    {
    Spawn:
	    HELA A 0
		TNT1 A 1
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_ExecuteAlways(137, 0, 0, 0, 0)//Check vehicle initial angle.
		TNT1 A 1 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_SpawnItem("HeliBase8")
		TNT1 A 5 
		TNT1 A 0 Thing_ChangeTID(0, 0)
		TNK1 C 0 A_ChangeFlag("THRUACTORS", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		Goto StandingHere
		
	  StandingHere:
		TNT1 A 7
		TNT1 A 0 A_SpawnItem("HeliBase8")
		TNT1 A 0 A_SpawnItem("StationedVehicleCheckRepairs")
		Loop
		
	Active:
		TNT1 A 0 
		//TNT1 A 0 A_Look
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_ExecuteAlways(130, 0, 0, 0, 0)//Check Vehicle Health	
		//TNT1 A 0 A_Chase("","",CHF_DONTMOVE )
		TNT1 A 0 A_GiveToTarget("CheckingMorphingPlayerHealth", 1)
		HELA A 3
		TNT1 A 0 A_GiveToTarget("attackhelicopterMorpher", 1)
		TNT1 A 0 A_GiveToTarget("HeavyMachinegunAmmo", 999)
		TNT1 A 0 A_GiveToTarget("HelicopterRocketAmmo", 2000)
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 A_NoBlocking
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 10
		TNT1 A 0 Thing_ChangeTID(0, 0)
		TNT1 A 1
		Stop
	Death:	
	TNT1 A 1
	TNT1 A 0 A_SpawnItem("BigExplosion1112")
	TNT1 A 0 A_PlaySound("weapons/explode")
	TNT1 A 0 A_PlaySound("EXPLOSIO", 3)
	TNT1 A 0 A_Scream
	NULL AAAAAA 0 A_CustomMissile ("MetalShard1", 96, 0, random (0, 360), 2, random (0, 180))
	NULL AAAAAA 0 A_CustomMissile ("MetalShard2", 96, 0, random (0, 360), 2, random (0, 180))
	NULL AAAAAAAAA 0 A_CustomMissile ("GlassShard", 96, 0, random (0, 360), 2, random (0, 360))
	TNT1 A 0 A_SpawnItem("DestroyedArmouredVehicle")
	ELEC A 0 A_Explode(100, 250)
	TNT1 A 15
	TNT1 A 0
	Stop	
	
		Pain.Repair:
		 TNT1 A 0
		 TNT1 A 0 A_ChangeFLag("NOPAIN", 1)
		 TNT1 A 0 HealThing(5)
		 HELA A 1
		 TNT1 A 0 HealThing(5)
		 TNT1 A 0 A_ChangeFLag("NOPAIN", 0)
		 Goto StandingHere
	}
}



ACTOR attackhelicopterUsed: attackhelicopter
{
    States
    {
	Spawn:
		TNT1 A 0
	    TNT1 A 1
		TNT1 A 0 ACS_ExecuteAlways(136, 0, 0, 0, 0)//SpawnVehicleBase
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 1 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 5 
		TNT1 A 0 Thing_ChangeTID(0, 0)
		TNK1 C 0 A_ChangeFlag("THRUACTORS", 0)
		TNT1 A 0 A_ChangeFlag("FRIENDLY", 1)
		TNT1 A 0 ACS_Execute(129)
		Goto StandingHere
	
	IsOnline:
		TNT1 A 0
		TNT1 A 1
		//TNT1 A 0 A_TAkeInventory("attackhelicopterBaseDirection", 500)
		Goto StandingHere
		
	
	
	Active:
		TNT1 A 0 
		TTR1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_ExecuteAlways(130, 0, 0, 0, 0)//Check Vehicle Health
		//TNT1 A 0 A_Chase("","",CHF_DONTMOVE )
		TNT1 A 0 A_GiveToTarget("CheckingMorphingPlayerHealth", 1)
		TNT1 A 3
		TNT1 A 0 A_GiveToTarget("attackhelicopterMorpher", 1)
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 A_NoBlocking
		TNT1 A 1
		TNT1 A 0 A_ChangeFlag("USESPECIAL", 0)
		TNT1 A 10
		TNT1 A 0 Thing_ChangeTID(0, 0)
		Stop
	}
}

	


ACTOR PowerattackhelicopterSwitch : PowerMorph {PowerMorph.PlayerClass "Playerattackhelicopter"}



ACTOR attackhelicopterMorpher : CustomInventory 
{
  States
  {
  PickUp:
  TNT1 A 1
  TNT1 A 0 ACS_ExecuteAlways(134, 0, 0, 0, 0)//Get into attackhelicopter
  TNT1 A 0 A_GiveInventory("attackhelicopterMorphActivation")
  TNT1 A 0 A_SpawnItem("CancelTeleportFog")
  TNT1 A 1
  Stop
  }
 }
 


ACTOR attackhelicopterMorphActivation : PowerupGiver
{
  Powerup.Type "PowerattackhelicopterSwitch"
  Powerup.Duration 252000
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  Inventory.MaxAmount 1
  Health 100
  GibHealth 1
  Mass 9999
  Height 96
  Radius 32
  States
  {
  Spawn:
  TNT1 A 100
  Stop
  
  PickUp:
  TNT1 A 1
  TNT1 A 1
  Stop
  }
 }
 
 


ACTOR Playerattackhelicopter : PlayerPawn
{
var int user_attackhelicopterbasedirection;
	Speed 0.8
	Scale 1.0
	Radius 36
	Height 96
	Mass 9999
	PainChance 0
	PainChance "HitGround", 255
	health 400
	-PICKUP
	player.viewheight	90
    player.attackzoffset 40
	MaxStepHeight 64
	Player.MorphWeapon "attackhelicopterGun"
    Player.JumpZ 0
	BloodType "TankBlood", "TankBlood", "TankBlood"
	damagefactor "stomp", 0
	damagefactor "Explosives", 0.5 damagefactor "bullet", 0.25 damagefactor "monsterbullet", 0.25 damagefactor "shotgun", 0
	+NOSKIN
	+NORADIUSDMG
	+FORCERADIUSDMG
	+FIXMAPTHINGPOS
	+DONTRIP
	-CANUSEWALLS
	-PICKUP
	+FLOAT
	+FORCEXYBILLBOARD
	DamageFactor "Repair", 0.0 damagefactor "CheckRepair", 0.0
	damagefactor "Head", 0.0	damagefactor "FriendBullet", 0.0    damagefactor "Taunt", 0.0    damagefactor "KillMe", 0.0
	damagefactor "Shotgun", 0.7    damagefactor "Shrapnel", 0.0    damagefactor "Blood", 0.0    damagefactor "BlueBlood", 0.0
	damagefactor "Explosives", 0.5 damagefactor "bullet", 0.25 damagefactor "monsterbullet", 0.25 damagefactor "shotgun", 0 damagefactor "monstershotgun", 0.2 damagefactor "monsterminigun", 0.2
	damagefactor "GreenBlood", 0.0    damagefactor "MinorHead", 0.0    damagefactor "Decaptate", 0.0	damagefactor "MonsterKnocked", 0.0
    damagefactor "CancelTeleportFog", 0.0	damagefactor "BHFTOnBarrel", 0.0	damagefactor "GibRemoving", 0.0	damagefactor "SuperPunch", 5.0
	damagefactor "HelperMarineFatallity", 0.0	damagefactor "Leg", 0.0	damagefactor "SpawnMarine", 0.0	damagefactor "TeleportRemover", 0.0
	DamageFactor "CauseObjectsToSplash", 0.0 DamageFactor "Trample", 0.0
	DamageFactor "TankWeakSpot", 3.0 damagefactor "Plasma", 1.5 damagefactor "Plasma2", 1.5
	damagefactor "Desintegrate", 3.0 DamageFactor "Minigun", 0.2 damageFactor "Machinegun", 0.2
	damagefactor "HitGround", 3.0
	States
	{
	
	ExitVehicle:
		TNT1 A 0
		TNT1 A 0 SetPlayerProperty(0,1,4)
		TNT1 A 0 A_StopSound(6)
		TNT1 A 0 A_PlaySound("HELSTOP", 4)
		TNT1 A 0 ThrustThingZ(0,-20,0,1)
		HEL1 ABABAB 1
		TNT1 A 0 ThrustThingZ(0,-20,0,1)
	    HEL1 ABCD 1
		TNT1 A 0 ThrustThingZ(0,-30,0,1)
	    HEL1 ABCD 1
		TNT1 A 0 ThrustThingZ(0,-40,0,1)
		HEL1 ABCD 2
		TNT1 A 0 ThrustThingZ(0,-50,0,1)
		HEL1 ABCD 3
		TNT1 A 0 ThrustThingZ(0,-60,0,1)
		HEL1 ABCD 4
		TNT1 A 0 ThrustThingZ(0,-60,0,1)
		HEL1 ABCD 5
		TNT1 A 0 ThrustThingZ(0,-20,0,1)
		TNT1 A 0 SetPlayerProperty(0,0,4)
		TNT1 A 0 A_TAKEiNVENTORY("PowerFlight", 1)
	
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
	
		TNT1 A 0 A_SpawnItemEx ("TransferPlayerOutOfVehicle", 100, 150, 0)
		
		HEL1 A 3
	
		TNT1 A 0 A_JumpIfInventory("CanLeaveVehicle", 1, "CanExit")
		TNT1 A 0 A_Print("Can't leave from this direction", 1)
		Goto Stay
	
	CanExit:
		TNT1 A 0
		TNT1 A 2
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("HelicopterIsFlying", 1)
		TNT1 A 0 A_TakeInventory("CanLeaveVehicle", 1)
		TNT1 A 0 ACS_Execute(135)
		TNT1 A 0 ACS_ExecuteAlways(871, 0, 0, 0, 0)
		TNT1 A 0 A_SpawnItemEx ("attackhelicopterUsed", 0, 0, 0, 0, 0, 0, 0, SXF_NOCHECKPOSITION)
		Goto FinishExit

	FinishExit:
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 AAA 10 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		Goto Stay
		
	
	Spawn2: //Taking Off
		HELA A 1
	    TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TNT1 A 0 A_TakeInventory("Accelerate", 1)
		TNT1 A 0 A_TakeInventory("BackPedal", 1)
		TNT1 A 0 ACS_ExecuteAlways(877, 0, 0, 0, 0)//Camera
		HEL1 A 1
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("FiredTankMainGun", 1)
		TNT1 A 0 SetPlayerProperty(0,1,4)
		TNT1 A 0 A_PlaySound("HELSTAR", 1)
		TNT1 A 0 A_ChangeFlag("NOPAIN", 1)
		HEL1 ABCD 6
		HEL1 ABCD 5
		HEL1 ABCD 4
		HEL1 ABCD 3
		TNT1 A 0 A_GIVEiNVENTORY("PowerFlight", 1)
		TNT1 A 0 ThrustThingZ(0,25,0,1)
		HEL1 ABCD 2
		TNT1 A 0 ThrustThingZ(0,25,0,1)
		HEL1 ABCDABCD 1
		TNT1 A 0 ThrustThingZ(0,25,0,1)
		HEL1 AB 1
		TNT1 A 0 A_ChangeFlag("NOPAIN", 0)
		TNT1 A 0 A_GiveInventory("HelicopterIsFlying", 1)
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 SetPlayerProperty(0,0,4)
	Goto Stay
	
	
	See:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("HeliBase1")
		Goto Stay
	
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HelicopterIsFlying", 1, "Stay")
		TNT1 A 0 A_SpawnItem("HeliBase1")
		Goto Spawn2
		
	Stay:
		TNT1 A 1 A_SpawnItem("HeliBase1")
		TNT1 A 1 A_SpawnItem("HeliBase2")
		TNT1 A 1 A_SpawnItem("HeliBase3")
		TNT1 A 1 A_SpawnItem("HeliBase4")
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 0, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 90, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 45, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 135, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 180, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 225, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 270, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetection", 70, 0, 315, 2, 0)
		TNT1 A 0 A_CustomMissile ("HelicopterHitDetectionGround", 0, 0, 0, 2, -90)
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_PlaySound("HELILOP", 6, 1, 1)
		TNT1 A 0 A_PlaySound("HELILOP2", 7, 1, 1)
		TNT1 A 0 A_GIVEiNVENTORY("PowerFlight", 1)
		TNT1 A 0 A_SpawnItem("HeliBase4")
		Loop
		
	Pain.HitGround:
		PLAY G 0
		TNT1 A 0 ThrustThingZ(0,60,0,1)
		TNT1 A 0 A_SpawnItem("HeliBase1")
		HEL1 A 1 A_Pain
		Goto Stay
	
		
	Death:
	XDeath:
	TNT1 A 0
	
	TNT1 A 0 A_StopSound(6)
	TNT1 A 0 A_StopSound(7)
	TNT1 A 0 A_TakeInventory("AttackhelicopterGun", 1)
	TNT1 A 0 ACS_ExecuteAlways(871, 0, 0, 0, 0)
	TNT1 A 0 SetPlayerProperty(0,0,4)
	TNT1 A 0 A_PlaySound("HELSTOP", 6)
	TNT1 A 0 A_ChangeFlag("QUARTERGRAVITY", 1)
	
	falling:
	TNT1 A 0 A_Scream
	TNT1 A 0 A_ClearTarget
	TNT1 A 0 A_NoBlocking
	HEL1 AB 1 A_CustomMissile ("FlamethrowerFireParticles", 32, 0, random (0, 360), 2, random (0, 180))
	TNT1 A 0 A_SetAngle(10 + angle)
	HEL1 CD 1 A_CustomMissile ("FlamethrowerFireParticles", 32, 0, random (0, 360), 2, random (0, 180))
	TNT1 A 0 A_SetAngle(10 + angle)
	TNT1 A 0 A_CheckFloor("Crashed")
	Loop
	
	Crashed:
	TNT1 A 0 A_SpawnItem("BigExplosion1112")
	TNT1 A 0 A_PlaySound("weapons/explode")
	TNT1 A 0 A_PlaySound("EXPLOSIO", 3)
	
	NULL AAAAAA 0 A_CustomMissile ("MetalShard1", 96, 0, random (0, 360), 2, random (0, 180))
	NULL AAAAAA 0 A_CustomMissile ("MetalShard2", 96, 0, random (0, 360), 2, random (0, 180))
	NULL AAAAAAAAA 0 A_CustomMissile ("GlassShard", 96, 0, random (0, 360), 2, random (0, 360))
	TNT1 A 0 A_StopSound(6)
	ELEC A 0 A_Explode(100, 250)
	TNT1 A 0 A_SpawnItem("DestroyedAircraft")
	8762 A 500
	8762 A 2000
	8762 A -1
	Stop
	
	}
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//Vehicle's weapons and misc
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

ACTOR attackhelicopterGun : DoomWeapon
{
	Game Doom
	Weapon.SelectionOrder 1900
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Weapon.AmmoType2 "HelicopterRocketAmmo"
	Weapon.AmmoType1 "HeavyMachinegunAmmo"
	Obituary "$OB_MPPISTOL"
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.ALT_AMMO_OPTIONAL
	//+WEAPON.NOAUTOFIRE
	Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED"
	Tag "$TAG_PISTOL"
	States
	{
	
	
	
	Ready:
		HELH A 1 A_WeaponReady(1)
		TNT1 A 0 ACS_ExecuteAlways(111, 0, 0, 0, 0)//SHOWHUD
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 22, "TooLowCheck2")
		Loop
	
	
	NotReady:
		TNT1 A 1 //A_GiveInventory("attackhelicopterReady", 1)
		Goto Ready
		
	Deselect:
		TNT1 A 1 A_Lower
		TNT1 A 0 SetPlayerProperty(0,0,4)
		Loop
	Select:
		HELH AAAAAAAAAAAA 0 A_Raise
		TNT1 A 0 SetPlayerProperty(0,1,4)
		TNT1 A 1 A_TakeInventory("PressedUse", 1)
		TNT1 A 1 A_TakeInventory("PressedJump", 2)
		HELH AAA 1 A_Raise
		TNT1 A 0
		Goto Ready
		
		
	
	NoAmmo:
		HELH A 1
		TNT1 A 0 A_Print("Ammunition Depleted", 2)
		Goto Ready 
			
	
	
	
	Fire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HelicopterRocketAmmo", 1, 1)
		Goto NoAmmo
		TNT1 A 0 A_PlaySound("MISLFIRE", 1)
		TNT1 A 0 A_TakeInventory("HelicopterRocketAmmo", 1)
		MISG A 0 A_FireCustomMissile("AssaultHelicopterRocket", 0, 0, -20, -40)
		MISG A 0 A_FireCustomMissile("TankFireEffect", 0, 1, -45, -45)
		HELH A 1 BRIGHT 
		TNT1 A 0 A_GunFlash
		HELH AA 4
		TNT1 AAAA 0
		TNT1 A 0 A_PlaySound("MISLFIRE", 2)
		TNT1 A 0 A_TakeInventory("HelicopterRocketAmmo", 1)
		MISG A 0 A_FireCustomMissile("AssaultHelicopterRocket", 0, 0, 20, -40)
		MISG A 0 A_FireCustomMissile("TankFireEffect", 0, 1, 45, -45)
		HELH A 1 BRIGHT 
		TNT1 A 0 A_GunFlash
		HELH AA 4
		TNT1 A 0 A_GunFlash
		HELH AA 4
		TNT1 A 0 A_GunFlash
		HELH AA 4
		TNT1 A 0 A_GunFlash
		Goto Ready
		
		
	
		
	
	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HeavyMachinegunAmmo", 1, 1)
		Goto NoAmmo
		TNT1 A 0 ACS_ExecuteAlways(111, 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_PlaySound("TANKMG", 1)
		TNT1 A 0 A_TakeInventory("HeavyMachinegunAmmo", 1)
		TNT1 A 0 A_FireCustomMissile("HeavyMachinegunProjectile", 0, 1, 0, -10)
		TNT1 AA 0 A_FireCustomMissile("HeavyMachinegunFlash", 0, 1, 0, -10)
		HELH A 1 BRIGHT
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_GiveInventory("TankReady", 1)
		HELH AA 1 A_GiveInventory("TankReady", 1)
		HELH A 1 A_GiveInventory("TankReady", 1)
		Goto Ready
		
	
	Flash:
		TNT1 A 1
		TNT1 A 0 ACS_ExecuteAlways(111, 0, 0, 0, 0)//SHOWHUD
		
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 22, "TooLowCheck1")
		TNT1 A 1
		TNT1 A 0 ACS_ExecuteAlways(111, 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 22, "TooLowCheck1")
		TNT1 A 1
		TNT1 A 0 ACS_ExecuteAlways(111, 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 22, "TooLowCheck1")
		Stop
	
	
	Spawn:
		LAUN A -1
		Stop
		
	TooHigh2:
		TNT1 A 0 A_SetPitch(346)
		Goto Ready
		
	
	TooLowCheck2:
		//NULL A 0 A_JumpIf (pitch > 180, "TooHighCheck1")
		TNT1 A 0 A_SetPitch(22)
		Goto Ready
		
		
	TooHighCheck2:
		TNT1 A 0
		NULL A 0 A_JumpIf (pitch < 345, "TooHigh2")
		Goto Ready
	
	
	
	TooHigh:
		TNT1 A 0 A_SetPitch(346)
		Goto Flash
		
	
	TooLowCheck1:
		//NULL A 0 A_JumpIf (pitch > 180, "TooHighCheck1")
		TNT1 A 0 A_SetPitch(22)
		Goto Flash
		
	TooHighCheck1:
		TNT1 A 0
		NULL A 0 A_JumpIf (pitch < 345, "TooHigh")
		Goto Flash
	
	LightEnd:
		TNT1 A 10
		Stop	
		
	}
}



ACTOR AssaultHelicopterRocket: Rocket2
{
	Radius 11
	Height 8
	Speed 40
	Damage (random (250, 350))
	Projectile
	+RANDOMIZE
	+DEHEXPLOSION
	+ROCKETTRAIL
	+MISSILE
	+NOGRAVITY
	+FORCERADIUSDMG
	SeeSound "weapons/rocklf"
	DeathSound "weapons/rocklx"
	Obituary "$OB_MPROCKET"
	//+DONTHURTSHOOTER
	States
	{
	Spawn:
		MISL I 1 Bright
		Loop
	}
}




ACTOR MechHommingMissile: AssaultHelicopterRocket
{
	Damage (random (350, 380))
	+SCREENSEEKER
	+SEEKERMISSILE
	
	States
	{
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_SeekerMissile (4,8, SMF_LOOK)
		MISL I 1 Bright
		Loop
	}
}
