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



Actor ArtilleryTankTurretNotReal: TankBaseNotReal
{
Scale 1.25
States
{
Spawn:
TNT1 A 0
TN2M T 1
Stop
}}








Actor ArtilleryTankTurretNotReal2: ArtilleryTankTurretNotReal
{
States
{
Spawn:
TNT1 A 0
TN2M T 2
Stop
}}

Actor ArtilleryTankTurretNotReal4: ArtilleryTankTurretNotReal
{
States
{
Spawn:
TNT1 A 0
TN2M T 4
Stop
}}


Actor ArtilleryTankTurretNotReal8: ArtilleryTankTurretNotReal
{
States
{
Spawn:
TNT1 A 0
TN2E T 8
Stop
}}



ACTOR ArtilleryTank: Tank 7264
{
    Radius 64
	Height 72
	health 1200
	Scale 1.25
    States
    {
    Spawn:
	    TNT1 A 1
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_NamedExecuteAlways("BDSetNewTankDirection", 0, 0, 0, 0)//Check vehicle initial angle.
		TNT1 A 0 A_SpawnItem("ArtilleryTankTurretNotReal8")
		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)
		Goto StandingHere
		
	  StandingHere:
		TNT1 A 0
		TNT1 A 0 ACS_NamedExecuteAlways("BDSetBaseAngle", 0, 0, 0, 0)//SpawnVehicleBase
		TNT1 A 0 A_SpawnItem("ArtilleryTankTurretNotReal8")
		TNT1 A 2
		TNT1 A 0 A_SpawnItem("StationedVehicleCheckRepairs")
		Loop
		
	Active:
		TNT1 A 0 
		TNT1 A 0 A_TakeFromTarget("PowerInvulnerable", 1)
		TNT1 A 0 A_GiveToTarget("CeaseMorph", 1)
		TNK1 C 0 A_ChangeFlag("FRIENDLY", 0)
		//TNT1 A 0 A_Look
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_NamedExecuteAlways("GetVehiclePreviousHealth", 0, 0, 0, 0)//Check Vehicle Health	
		//TNT1 A 0 A_Chase("","",CHF_DONTMOVE )
		TNT1 A 0 A_GiveToTarget("CheckingMorphingPlayerHealth", 1)
		TNT1 A 0 A_SpawnItem("ArtilleryTankTurretNotReal8")
		TNT1 A 3
		TNT1 A 0 A_GiveToTarget("ArtilleryTankMorpher", 1)
		TNT1 A 0 A_GiveToTarget("HeavyMachinegunAmmo", 1200)
		TNT1 A 0 A_GiveToTarget("HelicopterRocketAmmo", 18)
		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_ChangeFlag("USESPECIAL", 0)
	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)
		 TN2E T 1
		 TNT1 A 0 HealThing(5)
		 TNT1 A 0 A_ChangeFLag("NOPAIN", 0)
		 Goto StandingHere
	}
}


ACTOR ArtilleryTankRealism: ArtilleryTank
{
Health 10000
}

ACTOR ArtilleryTankUsed: ArtilleryTank
{
    States
    {
	Spawn:
		TNT1 A 0
	    TNT1 A 1
		TNT1 A 0 ACS_NamedExecuteAlways("BDSetBaseAngle", 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_NamedExecuteAlways("BDCHeckOnline")
		Goto StandingHere
	
	IsOnline:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_TAkeInventory("TankBaseDirection", 500)
		Goto StandingHere
		
	
	
	Active:
		TNT1 A 0 
		TNT1 A 0 A_TakeFromTarget("PowerInvulnerable", 1)
		TNT1 A 0 A_GiveToTarget("CeaseMorph", 1)
		TTR1 A 0 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 Thing_ChangeTID(0, 261)
		TNT1 A 0 ACS_NamedExecuteAlways("GetVehiclePreviousHealth", 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("ArtilleryTankMorpher", 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 PowerArtilleryTankSwitch : PowerMorph {PowerMorph.PlayerClass "PlayerArtilleryTank"}



ACTOR ArtilleryTankMorpher : CustomInventory 
{
  States
  {
  PickUp:
  TNT1 A 1
  TNT1 A 0 ACS_NamedExecuteAlways("BDEnterTank", 0, 0, 0, 0)//Get into ArtilleryTank
  TNT1 A 0 A_GiveInventory("ArtilleryTankMorphActivation")
  TNT1 A 0 A_SpawnItem("CancelTeleportFog")
  TNT1 A 1
  Stop
  }
 }
 


ACTOR ArtilleryTankMorphActivation : PowerupGiver
{
  Powerup.Type "PowerArtilleryTankSwitch"
  Powerup.Duration 252000
  +INVENTORY.AUTOACTIVATE
  +INVENTORY.ALWAYSPICKUP
  Inventory.MaxAmount 1
  Health 100
  GibHealth 1
  Mass 5000
  Height 72
  Radius 32
  States
  {
  Spawn:
  TNT1 A 100
  Stop
  
  PickUp:
  TNT1 A 1
  TNT1 A 1
  Stop
  }
 }
 
 


ACTOR PlayerArtilleryTank : PlayerTank
{
	Speed 0
	Scale 1.25
	Radius 64
	Height 72
	health 1200
	player.viewheight	72
    player.attackzoffset 56
	MaxStepHeight 32
	Player.MorphWeapon "ArtilleryTankGun"
	States
	{
		
	
		
	Spawn:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 ThrustTHingZ(0, 100, -1, 1)
		TN2M T 1
	Spawn2:
	    TNT1 A 0 A_GiveInventory("IsInATank", 1)
		TNT1 A 0 A_TakeInventory("PressedUse", 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 SetPlayerProperty(0, 1, PROP_BUDDHA)
		TN2M T 1
		TN2M TTTT 1 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, -90, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TN2M TTTT 1 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, -90, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("FiredTankMainGun", 1)
		TNT1 A 0 A_Print (a, 4, "TUTO1")
	Goto Stay

		

	ExitVehicle:
	TNT1 A 1
	TNT1 A 0 A_JumpIfHealthLower(2, "EmergencyExit")
	TNT1 A 0 A_TakeInventory("PressedUse", 1)
	
	TNT1 A 0 A_SpawnItemEx ("TransferPlayerOutOfVehicle", 0, 0, 76)
	
	TN2M T 1
	TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
	TN2M T 1
	TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
	TN2M T 1
	TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
	
	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 A_TakeInventory("IsInATank", 1)
	TNT1 A 0 A_TakeInventory("PressedUse", 1)
	TNT1 A 0 A_TakeInventory("CanLeaveVehicle", 1)
	TNT1 A 0 SetPlayerProperty(0, 0, PROP_BUDDHA)
	TNT1 A 0 ACS_NamedExecuteAlways("BDLeaveTank")
	TNT1 A 0 A_SpawnItemEx ("ArtilleryTankUsed", 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
	
	EmergencyExit:
	TNT1 A 0
	
	TNT1 A 2 A_TakeInventory("IsInATank", 1)
	TNT1 A 0 A_TakeInventory("PressedUse", 1)
	TNT1 A 0 A_TakeInventory("CanLeaveVehicle", 1)
	
	TNT1 A 0 ThrustThingZ(0,120,0,1)
	TNT1 A 0 A_SpawnItem("TankExplode")
	PLA1 J 2
	TNT1 A 0 A_StopSound(1)
	TNT1 A 0 SetPlayerProperty(0, 0, PROP_BUDDHA)
	TNT1 A 0 SetPlayerProperty(0, 0, PROP_FLIGHT)
	TNT1 A 0 ACS_NamedExecuteAlways("BDLeaveTank")
	PLA1 J 100
	Goto Stay
	
		
		
	TurnLeft:
		TNT1 A 0
		TN2M T 1 
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Stay")
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(user_tankbasedirection > 359, "TurnLeft2")
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection+4)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		Goto CheckIfStillMoves
	
	TurnLeft2:
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", 0)
		Goto TurnLeftAccel
		
		
	TurnLeftAccel:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TN2M T 1 
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(user_tankbasedirection > 359, "TurnLeft2")

		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection+3)
		
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving3" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TNT1 A 0 A_PlaySound("TANK1", 5, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TnkTreadsDamage" , 100, 0, 0, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE | SXF_ABSOLUTEVELOCITY)
		
		TNT1 A 0 A_SpawnItemEx("TnkStep", 0, 0, 8, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE)
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 2, 1)
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection+3)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving2" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 1, 1)
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection+3)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving2" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TNT1 A 0 A_JumpIF(velz < 0, "Falling")
		
		TNT1 A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeftAccel")
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		
		Goto CheckIfStillMoves	
		
	TurnRight:
		TNT1 A 0
		TN2M T 1 
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Stay")
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(user_tankbasedirection == 0, "TurnRIght2")
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection-4)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		Goto CheckIfStillMoves
	
	TurnRight2:
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", 360)
		Goto TurnRightAccel	
		
	
	TurnRightAccel:
		TNT1 A 0
		TN2M T 1 
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(user_tankbasedirection == 0, "TurnRIght2")
		
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection-3)
		
		
		TNT1 A 0 A_PlaySound("TANK1", 5, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TnkTreadsDamage" , 100, 0, 0, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE | SXF_ABSOLUTEVELOCITY)
		
		TNT1 A 0 A_SpawnItemEx("TnkStep", 0, 0, 8, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE)
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving3" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection-3)
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 2, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving2" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TNT1 A 0 A_SetUserVar("user_tankbasedirection", user_tankbasedirection-3)
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIF(velz < 0, "Falling")
		TNT1 A 0 A_JumpIfInventory("TurnRight", 1, "TurnRightAccel")
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		Goto CheckIfStillMoves
	
	CheckIfStillMoves:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate")
		TNT1 A 0 A_JumpIfInventory("BackPedal", 1, "BackPedal")
		TNT1 A 0 A_StopSound(2)
		TNT1 A 0 A_PlaySound("TANK2", 5, 1, 1)
		TNT1 A 0 A_PlaySound("TANK3", 2)
		
	Stay:
	    TNT1 A 0
		TNT1 A 0 
		
		TNT1 A 0 A_PlaySound("TANK2", 5, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_JumpIfInventory("BackPedal", 1, "BackPedal")
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate")
		TN2M T 1 
		TNT1 A 0 A_JumpIF(velz < 0, "Falling")
		Goto Stay
		
	
	Pain.TracksDamaged:
	    TNT1 A 0
		TNT1 A 0 
		
		TNT1 A 0 A_Jump(32, "DestroyTracks")
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_JumpIfInventory("BackPedal", 1, "BackPedal")
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, "Accelerate")
		TN2M T 1 
		Goto Stay
		
		
	
	Accelerate:
		
		TNT1 A 0 A_PlaySound("TANK1", 5, 1, 1)
		TNT1 A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeftAccel")
		TNT1 A 0 A_JumpIfInventory("TurnRight", 1, "TurnRightAccel")
		TNT1 A 0 A_SpawnItemEx ("TnkTreadsDamage" , 100, 0, 0, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE | SXF_ABSOLUTEVELOCITY)
		
		TN2M T 1 
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Stay")
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 2, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving3" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		
		TNT1 A 0 A_SpawnItemEx("TnkStep", 0, 0, 8, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE)
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 2, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving2" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		
		TNT1 A 0 A_JumpIfInventory("TurnLeft", 1, "TurnLeftAccel")
		TNT1 A 0 A_JumpIfInventory("TurnRight", 1, "TurnRightAccel")
		
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIF(velz < 0, "Falling")
		Goto CheckIfStillMoves
		
		
	Backpedal:
		
		
		TNT1 A 0 A_PlaySound("TANK1", 5, 1, 1)
		TNT1 A 0 A_SpawnItemEx("TnkStep", 0, 0, 8, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_SpawnItemEx ("TnkTreadsDamage" , -100, 0, 0, 0, 0, 0, user_tankbasedirection, SXF_ABSOLUTEANGLE | SXF_ABSOLUTEVELOCITY)
		
		TN2M T 1 
		TNT1 A 0 A_JumpIf(waterlevel > 1, "Stay")
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360+128, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving3" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		
		TN2M T 1 
		TNT1 A 0 //ThrustThing(user_tankbasedirection*256/360+128, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving2" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360+128, 2, 1)
		
		TNT1 A 0 A_JumpIfInventory("TurnRight", 1, "TurnLeft")
		TNT1 A 0 A_JumpIfInventory("TurnLeft", 1, "TurnRight")
		
		TN2M T 1 
		TNT1 A 0 ThrustThing(user_tankbasedirection*256/360+128, 1, 1)
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIF(velz < 0, "Falling")
		Goto CheckIfStillMoves
		
		
	Falling:
		TNT1 A 0
		TNT1 A 0 A_CheckFloor("CheckIfStillMoves")
	
	FallingForReal:
		TNT1 A 0
		TN2M T 1 
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIF(velz == 0, "CrashIntoGround")
		TNT1 A 0 A_GiveInventory("VehicleFallingCount", 1)
		Loop
		
	CrashIntoGround:
		TNT1 A 0
		TNT1 A 0 A_JumpIfinventory("VehicleFallingCount", 6, "CrashIntoGroundViolently")
		TN2M T 1 
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround1")
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround2")
		TNT1 A 0 A_SpawnItemEx ("LargeMassWaterImpact", 0, 0, -10)
		TNT1 A 0 Radius_Quake(1, 6, 0, 4, 0)
		TNT1 A 0 A_PlaySound("EBIKEBNC", 2)
		TNT1 A 0 A_TakeInventory("VehicleFallingCount", 100)
		Goto Stay
		
	CrashIntoGroundViolently:
		TNT1 A 0
		TN2M T 1 
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround1")
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround2")
		
		TNT1 A 0 A_SpawnItemEx ("ExplosionSplashSpawner", 0, 0, -10)
		
		TNT1 A 0 Radius_Quake(8, 24, 0, 4, 0)
		TNT1 A 0 A_PlaySound("BIKECLW", 1)
		TNT1 A 0 A_PlaySound("EBIKECLS", 2)
		TNT1 AAAA 0 A_CustomMissile ("PlasmaSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_TakeInventory("VehicleFallingCount", 100)
		TNT1 A 0 A_SetPitch(-8.0 + pitch)
		TN2M T 1 
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_SetPitch(4.0 + pitch)
		TN2M T 1
		TNT1 A 0 A_SpawnItemEx ("TankBaseNotRealMoving1" , 0, 0, 0, momx, momy, momz, user_tankbasedirection, SXF_ABSOLUTEVELOCITY | SXF_ABSOLUTEANGLE)
		TNT1 A 0 A_SetPitch(4.0 + pitch)
		Goto Stay	
		
		
		
	Death:	
	XDeath:
    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
	TNT1 A 0 A_NoBlocking
	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))
	ELEC A 0 A_Explode(100, 250)
	TNT1 A 0 A_SpawnItem("DestroyedArmouredVehicle")
	8762 A 5
	TNT1 A 0 A_TakeInventory("ArtilleryTankGun", 1)
	TNT1 A 0 A_TakeInventory("IsInATank", 1)
	8762 A 100
	8762 A -1
	Stop
	}
}


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

ACTOR ArtilleryTankGun : DoomWeapon
{
	Game Doom
	Weapon.SelectionOrder 1900
	Weapon.AmmoUse1 1
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 1
	Weapon.AmmoGive1 0
	Weapon.AmmoType1 "HeavyMachinegunAmmo"
	Weapon.AmmoType2 "HelicopterRocketAmmo"
	Obituary "$OB_MPPISTOL"
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.ALT_AMMO_OPTIONAL
	//+WEAPON.NOAUTOFIRE
	Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED"
	Tag "$TAG_PISTOL"
	States
	{
	
	
	
	Ready:
		TNT1 A 0
		TNT1 A 0 A_PlaySound("TNKENGS", 4)
		TNHD W 10
		TNT1 A 0 A_PlaySound("INFRARED", 1)
		TNHD XYZXYZXYZXYZXYZXYZXYZ 1 BRIGHT
		TNT1 A 0 A_GiveInventory("TankReady", 100)
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
		TNT1 A 0 A_TakeInventory("PressedJump", 2)
		TNHD Y 0 A_TakeInventory("PressedJump", 2)
		TNHD X 1 A_GunFlash
		Goto ReadyToFire
		
	ReadyToFire:
	    TNT1 A 0
		TNT1 A 0 A_JumpIfinventory("TankZoom", 1, "Ready2")
		TNT1 A 0 A_JumpIfInventory("SwitchFlashlight",1,"SwitchFlashlight")
		
		TNLH G 1 A_WeaponReady(1)
		TNT1 A 0 A_JumpIfInventory("Kicking", 1, "ZoomMode")
		TNT1 A 0 A_GiveInventory("TankReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 16, "TooLowCheck2")
		Loop
		
		
	Ready2:
	    TNT1 A 0
		TNT1 A 1 A_WeaponReady(1)
		TNT1 A 0 A_JumpIfInventory("SwitchFlashlight",1,"SwitchFlashlight")
		TNT1 A 0 A_JumpIfInventory("Kicking", 1, "ZoomMode")
		TNT1 A 0 A_GiveInventory("TankReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 16, "TooLowCheck2")
		Loop
		
		
		
	NotReady:
		TNLH A 1 A_GiveInventory("TankReady", 1)
		Goto ReadyToFire
		
		
	NotReadyZoom:
		TNT1 A 1 A_GiveInventory("TankReady", 1)
		Goto ReadyToFire	
			
		
	ZoomMode:
		TNT1 A 0
		TNT1 A 1
		TNT1 A 0 A_JumpIfinventory("TankZoom", 1, "StopZoom")
		TNT1 A 0 A_ZoomFactor(5.0)
		TNT1 A 0 A_GiveInventory("TankZoom")
		TNT1 A 1
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		Goto Ready2
	
	StopZoom:
		TNT1 A 0
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 A_TakeInventory("TankZoom", 1)
		TNT1 A 1
		TNT1 A 0 A_TakeInventory("Kicking", 1)
		Goto ReadyToFire
	
	Deselect:
		TNHD Z 1 A_Lower
		TNT1 A 0 A_ZoomFactor(1.0)
		TNT1 A 0 SetPlayerProperty(0,0,4)
		Loop
		
	Select:
		TNT1 A 0
		TNHD z 1 A_Raise
		TNHD zzzzzzzzzzzzzzzzzzzzzz 0 A_Raise
		TNHD z 1 A_Raise
		Goto Ready
	
	Flash:
		TNT1 A 0
		TNT1 A 0 A_JumpIfHealthLower(2, "EmergencyExit")
		TNHD K 1 BRIGHT
		
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 16, "TooLowCheck1")
		TNHD K 1 BRIGHT
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 16, "TooLowCheck1")
		TNHD K 1 BRIGHT
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "LightEnd")
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck1")
		NULL A 0 A_JumpIf (pitch > 16, "TooLowCheck1")
		Goto Flash
		
		
	EmergencyExit:
		TNT1 A 0 
		TNT1 A 0 A_PlaySound("CARSTE", 1)
		TNT1 A 0 A_GiveInventory("PressedUse")
		TNT1 A 5
		Goto LightEnd	
		
	Fire:
	    TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HeavyMachinegunAmmo", 1, 1)
		Goto NoAmmo
		
		TNT1 A 0 A_JumpIfinventory("TankZoom", 1, "FireZoom")
		//TNT1 A 0 A_PlaySound("TANKF", 1)
		
		TNT1 A 0 A_SpawnItemEx("AutoCannonCaseSpawn", 0, 0, 40, 0, 0, 0, 180)
		TNT1 A 0 A_SpawnItemEx("AutoCannonCaseSpawn", 0, 0, 40, 0, 0, 0, 0)
		
		TNLH H 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", random(-1,0), 1, 20, -24, 0, random(-1,1))
		TNT1 A 0 A_SpawnItemEx("AutocannonMuzzle2", 80, 40, 60)
		
		
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		
		TNLH J 1
		
		TNLH K 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", 0, 1, -20, -24, 0, 0)
		TNT1 A 0 A_SpawnItemEx("AutocannonMuzzle2", 80, -40, 60)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNLH M 1
		
		
		TNT1 A 0 A_SpawnItemEx("AutoCannonCaseSpawn", 0, 0, 40, 0, 0, 0, 180)
		TNT1 A 0 A_SpawnItemEx("AutoCannonCaseSpawn", 0, 0, 40, 0, 0, 0, 0)
		
		TNLH I 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", 0, 1, 20, -24, 0, 0)
		TNT1 A 0 A_SpawnItemEx("AutocannonMuzzle2", 80, 40, 60)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNLH J 1
		
		TNLH L 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", random(0,1), 1, -20, -24, 0, random(-1,1))
		TNT1 A 0 A_SpawnItemEx("AutocannonMuzzle2", 80, -40, 60)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNLH M 1
		
		TNT1 A 0 A_ReFire
		Goto ReadyToFire
		
		
	FireZoom:	
		TNT1 A 0
		TNT1 H 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", random(-1,0), 1, 10, -24, 0, random(-1,1))
		TNT1 A 0 A_FireCustomMissile("AutoCannonFlash", 0, 0, -20, -45)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNT1 J 1
		
		TNT1 K 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", 0, 1, -10, -24, 0, 0)
		TNT1 A 0 A_FireCustomMissile("AutoCannonFlash", 0, 0, 20, -45)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNT1 M 1
		
		TNT1 I 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", 0, 1, 10, -24, 0, 0)
		TNT1 A 0 A_FireCustomMissile("AutoCannonFlash", 0, 0, -20, -45)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNT1 J 1
		
		TNT1 L 1 BRIGHT A_FireCustomMissile("AutoCannonProjectile", random(0,1), 1, -10, -24, 0, random(-1,1))
		TNT1 A 0 A_FireCustomMissile("AutoCannonFlash", 0, 0, 20, -45)
		TNT1 A 0 A_PlaySound("ACANO1", 1)
		TNT1 A 0 A_PlaySound("FARCAN1", 4)
		TNT1 M 1
		
		TNT1 A 0 A_ReFire
		Goto ReadyToFire
		
	NoAmmo:
		TNLH G 2
		Goto ReadyToFire 
		
	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("HelicopterRocketAmmo", 1, 1)
		Goto NoAmmo
		
		TNT1 A 0 A_PlaySound("MISFAR", 2)
		TNT1 A 0 A_FireCustomMissile("TankMissile", 0, 1, 20, 15, 0, 10)
		TNT1 A 0 A_JumpIfinventory("TankZoom", 1, "AltFire2")
		TNLH G 30 
		Goto ReadyToFire
		
		
	AltFire2:	
		TNT1 A 30
		Goto Ready2	
		
		
		
	
	TooHigh2:
		TNT1 A 0 A_SetPitch(326)
		Goto ReadyToFire
		
	
	TooLowCheck2:
		//NULL A 0 A_JumpIf (pitch > 180, "TooHighCheck1")
		TNT1 A 0 A_SetPitch(16)
		Goto ReadyToFire
		
		
	TooHighCheck2:
		TNT1 A 0
		NULL A 0 A_JumpIf (pitch < 325, "TooHigh2")
		Goto ReadyToFire
	
	
	
	TooHigh:
		TNT1 A 0 A_SetPitch(326)
		Goto Flash
		
	
	TooLowCheck1:
		//NULL A 0 A_JumpIf (pitch > 180, "TooHighCheck1")
		TNT1 A 0 A_SetPitch(16)
		Goto Flash
		
	TooHighCheck1:
		TNT1 A 0
		NULL A 0 A_JumpIf (pitch < 325, "TooHigh")
		Goto Flash
	
	
	
		
		
		
	SwitchFlashlight:
		TNT1 A 0
		TNT1 A 0 A_TakeInventory("SwitchFlashlight", 1)
		TNT1 A 0 A_JumpIfInventory("FlashlightOn",1,"TurnFlashOff")
		TNT1 A 0 A_Giveinventory("FlashlightOn",1)
		TNT1 A 0 A_giveinventory("PowerLightAmp", 1)
		TNT1 A 0 A_PlaySound("INFRARED", 1)
		TNT1 A 0 A_PlaySound("FLASHON", 2)
		
        Goto ReadyToFire
	TurnFlashOff:
		TNT1 A 0 A_Takeinventory("FlashlightOn",1)
		TNT1 A 0 A_TakEinventory("PowerLightAmp", 1)
		TNT1 A 0 A_PlaySound("FLASHOFF", 2)
        Goto ReadyToFire
	
	LightEnd:
		TNT1 A 1
		TNT1 A 0 A_Takeinventory("PowerLightAmp", 1)
		Stop
		
	Spawn:
		LAUN A -1
		Stop
		
	}
}




ACTOR TankMissile: Rocket2
{
	Speed 70
    Damage (random (1000, 1000))
	DamageType Explosive
	Scale 1.0
    -THRUSPECIES
	+SEEKERMISSILE
	+SCREENSEEKER
	Species "None"
	States
	{
	Spawn:
	
		TNT1 A 0
		TNT1 A 0 A_PlaySound("DSMISLAU", 1, 1, 1)
		TNT1 A 0 A_PlaySound("DSMISFIR", 4)
		
		TNT1 A 0 BRIGHT A_CustomMissile("HugeRocketBackblast", 0, 0, angle-160, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames1", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames2", 0, 0, angle-150, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames3", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames4", 0, 0, angle-180, CMF_ABSOLUTEANGLE)
		
		TNT1 A 0 ThrustThingZ(0, 6, -1, 1)
		MISL A 0 A_CustomMissile("HugeBackblastFlames1", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("HighExplosiveFlamesSmall")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		MISL A 0 A_CustomMissile("HugeBackblastFlames2", 0, 0, angle-190, CMF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("HighExplosiveFlamesSmall")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		MISL A 0 A_CustomMissile("HugeBackblastFlames3", 0, 0, angle-180, CMF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		
		
		TNT1 A 0 ThrustThingZ(0, 6, -1, 1)
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("PlasmaSmoke")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		
		TNT1 A 0 ThrustThingZ(0, 40, 1, 1)
		
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("PlasmaSmoke")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		
		TNT1 A 0 ThrustThingZ(0, 40, 1, 1)
		
		
	Live:
	    MISL A 1 Bright A_SeekerMissile (4,8, SMF_LOOK)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("PlasmaSmoke")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		Loop
	
	SpawnUnderwater:
	    TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
	    TNT1 A 0 A_CustomMissile ("BUBULZ", 0, 0, random (0, 360), 2, random (0, 180))
	    Goto Live
	
	Death:
	XDeath:
		TNT1 A 0
		TNT1 A 0 A_StopSound(1)
        EXPL A 0 Radius_Quake (3, 8, 0, 15, 0)//(intensity, duration, damrad, tremrad, tid)
		TNT1 A 0 A_CustomMissile("ExplosionSplashSpawner")
        TNT1 A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
        EXPL A 0 A_CustomMissile ("BigNeoSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_SpawnItemEx ("TankMissileExplosion",0,0,13,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItemEx ("BarrelKaboom",0,0,13,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 AAA 0 A_CustomMissile ("HighExplosiveFlames", random (10, 20), 0, random (0, 360), 2, random (10, 90))
		//TNT1 A 0 A_SpawnItemEx ("RocketPenetrator",cos(-pitch)*42,0,0+(sin(pitch)*42),cos(-pitch)*40,0,sin(pitch)*40,0,SXF_TRANSFERPITCH)
		TNT1 A 2
		TNT1 A 0 A_SpawnItemEx ("LiquidExplosionEffectSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_PlaySound("FAREXPL", 3)
		TNT1 A 15
		TNT1 A 0 A_PlaySound("distantexp", 5)
		TNT1 AA 4 A_CustomMissile ("ExplosionSmoke", 2, 0, random (0, 360), 2, random (0, 360))
		Stop
	}
}






















ACTOR TankMissile2: Rocket2
{
	Speed 40
    Damage (random (100, 200))
	DamageType Explosive
	Scale 1.0
	+THRUSPECIES
	Species "EnemyTank"
	States
	{
	Spawn:
	
		TNT1 A 0
		TNT1 A 0 A_PlaySound("DSMISLAU", 1, 1, 1)
		TNT1 A 0 A_PlaySound("DSMISFIR", 4)
		
		TNT1 A 0 BRIGHT A_CustomMissile("HugeRocketBackblast", 0, 0, angle-160, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames1", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames2", 0, 0, angle-150, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames3", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		TNT1 A 0 BRIGHT A_CustomMissile("HugeBackblastFlames4", 0, 0, angle-180, CMF_ABSOLUTEANGLE)
		
		MISL A 0 A_CustomMissile("HugeBackblastFlames1", 0, 0, angle-170, CMF_ABSOLUTEANGLE)
		MISL A 1 Bright
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("HighExplosiveFlamesSmall")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright
		MISL A 0 A_CustomMissile("HugeBackblastFlames2", 0, 0, angle-190, CMF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("HighExplosiveFlamesSmall")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		MISL A 1 Bright
		MISL A 0 A_CustomMissile("HugeBackblastFlames3", 0, 0, angle-180, CMF_ABSOLUTEANGLE)
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		
	Live:
	    MISL A 1 Bright
		TNT1 A 0 A_JumpIf(waterlevel > 1, "SpawnUnderwater")
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
		TNT1 A 0 A_SpawnItem ("PlasmaSmoke")
		TNT1 A 0 A_CustomMissile ("PlasmaSmoke", 2, 0, random (160, 210), 2, random (-30, 30))
		Loop
	
	SpawnUnderwater:
	    TNT1 A 0 A_ChangeFlag("NOGRAVITY", 0)
		TNT1 A 0 A_SpawnItem("RocketFlare",-20,0)
	    TNT1 A 0 A_CustomMissile ("BUBULZ", 0, 0, random (0, 360), 2, random (0, 180))
	    Goto Live
	
	Death:
	XDeath:
		TNT1 A 0
		TNT1 A 0 A_StopSound(1)
        EXPL A 0 Radius_Quake (3, 8, 0, 15, 0)//(intensity, duration, damrad, tremrad, tid)
		TNT1 A 0 A_CustomMissile("ExplosionSplashSpawner")
        TNT1 A 0 A_SpawnItemEx ("DetectFloorCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("DetectCeilCrater",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
	    TNT1 A 0 A_SpawnItemEx ("UnderwaterExplosion",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_SpawnItemEx ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles2", 0, 0, random (0, 360), 2, random (40, 90))
		TNT1 AA 0 A_CustomMissile ("BDExplosionparticles3", 10, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAA 0 A_CustomMissile ("MediumExplosionFlames", 0, 0, random (0, 360), 2, random (0, 360))
        EXPL A 0 A_CustomMissile ("BigNeoSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_SpawnItemEx ("BarrelExplosion",0,0,13,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_SpawnItemEx ("BarrelKaboom",0,0,13,0,0,0,0,SXF_NOCHECKPOSITION,0)
		//TNT1 A 0 A_SpawnItemEx ("RocketPenetrator",cos(-pitch)*42,0,0+(sin(pitch)*42),cos(-pitch)*40,0,sin(pitch)*40,0,SXF_TRANSFERPITCH)
		TNT1 A 2
		TNT1 A 0 A_SpawnItemEx ("LiquidExplosionEffectSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 A 0 A_PlaySound("FAREXPL", 3)
		TNT1 A 15
		TNT1 A 0 A_PlaySound("distantexp", 5)
		TNT1 AA 4 A_CustomMissile ("ExplosionSmoke", 2, 0, random (0, 360), 2, random (0, 360))
		Stop
	}
}


