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



Actor MechBaseNotReal
{
+THRUACTORS
YScale 1.0
XScale 1.0
+NOTIMEFREEZE
+CLIENTSIDEONLY
+FLOORCLIP
+NOGRAVITY
+FLOAT
+NOBLOCKMAP
Mass 99999
Radius 0
Height 0
Gravity 0
States
{
Spawn:
TNT1 A 0
MECH A 8
Stop
}}


ACTOR Mech: Tank 7263
{
	Scale 1.00
	Radius 48
	Height 160
	+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 500
	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.1 damageFactor "Machinegun", 0.1
    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 1 A_ChangeFlag("FRIENDLY", 0)
		TNT1 A 0 A_SpawnItem("MechBaseNotReal")
		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("MechBaseNotReal")
		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)
		MECH A 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("MechBaseNotReal")
		TNT1 A 3
		TNT1 A 0 A_GiveToTarget("MechMorpher", 1)
		TNT1 A 0 A_GiveToTarget("HeavyMachinegunAmmo", 900)
		TNT1 A 0 A_GiveToTarget("MechlaserAmmo", 400)
		TNT1 A 0 A_GiveToTarget("MechRocketAmmo", 2000)
		TNT1 A 0 A_GiveToTarget("MechMortarAmmo", 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_ChangeFlag("USESPECIAL", 0)
	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)
		 MECH A 1
		 TNT1 A 0 HealThing(5)
		 TNT1 A 0 A_ChangeFLag("NOPAIN", 0)
		 Goto StandingHere
	}
}

ACTOR MechRealism: Mech
{
Health 5000
}

ACTOR MechUsed: Mech
{
    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("MechBaseDirection", 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("MechMorpher", 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 PowerMechSwitch : PowerMorph {PowerMorph.PlayerClass "PlayerMech"}



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


ACTOR MechMorphActivation : PowerupGiver
{
  Powerup.Type "PowerMechSwitch"
  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 PlayerMech : PlayerTank
{
	Speed 0.8
	Scale 1.00
	Radius 48
	Height 96
	Mass 9999
	PainChance 0
	Health 500
	-PICKUP
	player.viewheight	120
    player.attackzoffset 85
	MaxStepHeight 64
	Player.MorphWeapon "MechGun"
	States
	{
	
	ExitVehicle:
	TNT1 A 1 A_Stop
	
	TNT1 A 0 A_TakeInventory("PressedUse", 1)
	
	TNT1 A 0 A_SpawnItemEx ("TransferPlayerOutOfVehicle", 100, 0, 0)
	
	TNT1 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("CanLeaveVehicle", 1)
	TNT1 A 0 ACS_NamedExecuteAlways("BDLeaveTank")
	TNT1 A 0 A_SpawnItemEx ("MechUsed", 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
	
		
		
	Spawn:
	Spawn2:
		MECH 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)
		MECH A 15
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		TNT1 A 0 A_TakeInventory("PressedUse", 1)
	Goto Stay
	
	Stay:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(velz < 0, "FallingNoJump")
		TNT1 A 0 A_JumpIf(velz > 0, "FallingNoJump")
		TNT1 A 0 A_SpawnItem("MechStandingStillSmash")
		MECH G 1
		TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Jump")
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, "MoveForward")
		TNT1 A 0 A_JumpIfInventory("TurnLeft", 1, "MoveForward")
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		
		TNT1 A 0 A_JumpIfInventory("TurnRight", 1, "MoveForward")
		TNT1 A 0 A_JumpIfInventory("Backpedal", 1, "MoveBackward")
		//MECH G 1
		//TNT1 A 0 A_JumpIf(momx>0, "FalseMove")
		//TNT1 A 0 A_JumpIf(momy>0, "FalseMove")
		//TNT1 A 0 A_JumpIf(momx<0, "FalseMove")
		//TNT1 A 0 A_JumpIf(momy<0, "FalseMove")
		Loop
		
	
	MoveForward:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(velz < 0, "FallingNoJump")
		TNT1 A 0 A_JumpIf(velz > 0, "FallingNoJump")
		TNT1 A 0 A_TakeInventory("Accelerate", 1)
		TNT1 A 0 A_TakeInventory("Backpedal", 1)
		//TNT1 A 0 A_PlaySound("MECHWLK", 15)
		MECH BBBCCC 1 A_SetPitch(pitch -0.1)
		TNT1 A 0 A_SpawnItem("MechStomp")
		TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Jump")
		TNT1 A 0 A_JumpIf(velz < 0, "FallingNoJump")
		TNT1 A 0 A_JumpIf(velz > 0, "FallingNoJump")
		MECH DDD 1 A_SetPitch(pitch +0.2)
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		MECH D 2
		TNT1 A 0 A_SpawnItem("MechStomp")
		TNT1 A 0 A_JumpIfInventory("Backpedal", 1, "MoveBackward")
		//TNT1 A 0 A_PlaySound("MECHWLK", 15)
		MECH EEEFFF 1 A_SetPitch(pitch -0.1)
		TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Jump")
		TNT1 A 0 A_SpawnItem("MechStomp")
		MECH GGG 1 A_SetPitch(pitch +0.2)
		MECH G 2
		TNT1 A 0 A_SpawnItem("MechStomp")
		TNT1 A 0 A_TakeInventory("Accelerate", 1)
		TNT1 A 0 A_TakeInventory("Backpedal", 1)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		Goto Stay
		
	MoveBackward:
		TNT1 A 0
		TNT1 A 0 A_JumpIf(velz < 0, "FallingNoJump")
		TNT1 A 0 A_JumpIf(velz > 0, "FallingNoJump")
		TNT1 A 0 A_TakeInventory("Accelerate", 1)
		TNT1 A 0 A_TakeInventory("Backpedal", 1)
		TNT1 A 0 A_PlaySound("MECHWLK", 15)
		MECH FFFEEE 1 A_SetPitch(pitch -0.1)
		TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Jump")
		TNT1 A 0 A_SpawnItem("MechStomp")
		TNT1 A 0 A_JumpIf(velz < 0, "FallingNoJump")
		TNT1 A 0 A_JumpIf(velz > 0, "FallingNoJump")
		MECH DDD 1 A_SetPitch(pitch +0.2)
		MECH D 5
		TNT1 A 0 A_JumpIfInventory("Accelerate", 1, "MoveForward")
		TNT1 A 0 A_PlaySound("MECHWLK", 15)
		MECH CCCBBB 1 A_SetPitch(pitch -0.1)
		TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Jump")
		TNT1 A 0 A_SpawnItem("MechStomp")
		MECH GGG 1 A_SetPitch(pitch +0.2)
		MECH G 5
		TNT1 A 0 A_TakeInventory("Accelerate", 1)
		TNT1 A 0 A_TakeInventory("Backpedal", 1)
		TNT1 A 0 A_TakeInventory("TurnLeft", 1)
		TNT1 A 0 A_TakeInventory("TurnRight", 1)
		Goto Stay	
		
	//See:
		MECH BCDEFG 4
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		Goto Stay
		
	FallingNoJump:
		MECH HHH 2 A_JumpIf(velz == 0, "Stay")
		MECH HHHHHH 2 A_JumpIf(velz == 0, "HitGroundEasy")
		MECH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH 2 A_JumpIf(velz == 0, "HitGround")
		MECH HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH 2 A_JumpIf(velz == 0, "HitGround")
		Loop
		
	HitGroundEasy:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("MechStompLand")
		TNT1 A 0 A_Stop
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		Goto Stay	
		
	
	Jump:
		TNT1 A 0
		TNT1 A 0 ThrustThingZ(0,100,0,1)
		TNT1 A 0 A_PlaySound("MECHJUMP")
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		MECH H 30 
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		Goto Falling
		//Goto Flying
	
	//Flying:
		//MECH H 2 
		//TNT1 A 0 A_GIVEiNVENTORY("PowerFlight", 1)
		//TNT1 A 0 A_JumpIfInventory("PressedJump", 1, "Falling")
		//Loop
		
	Falling:
		MECH H 2 
		TNT1 A 0 A_JumpIfInventory("PressedUse", 1, "ExitVehicle")
		TNT1 A 0 A_TakeiNVENTORY("PowerFlight", 1)
		TNT1 A 0 A_TakeiNVENTORY("PressedJump", 1)
		TNT1 A 0 A_JumpIf(velz == 0, "HitGround")
		Loop
		
	HitGround:
		TNT1 A 0
		TNT1 A 0 A_SpawnItem("MechStompLand")
		TNT1 A 0 A_SpawnItem("MechStompLand2")
		TNT1 A 0 A_Stop
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround1")
		TNT1 A 0 A_SpawnItem("CrashTankIntotheGround2")
		TNT1 A 0 Radius_Quake(8, 24, 0, 4, 0)
		TNT1 A 0 A_PlaySound("BIKECLW", 1)
		TNT1 A 0 A_PlaySound("EBIKECLS", 2)
		MECH A 20
		TNT1 A 0 A_TakeInventory("PressedJump", 1)
		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("DestroyedAircraft")
	8762 A 5
	TNT1 A 0 A_TakeInventory("MechGun", 1)
	8762 A 100
	8762 A -1
	Stop
	
	
	}
}


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



ACTOR MechReady : Ammo
{
   Inventory.Amount 0
   Inventory.MaxAmount 100
   Ammo.BackpackAmount 0
   Ammo.BackpackMaxAmount 100
   Inventory.Icon TNT1A0
}

ACTOR MechGun : DoomWeapon
{
	Game Doom
	Weapon.SelectionOrder 1900
	Weapon.AmmoUse1 0
	Weapon.AmmoGive1 0
	Weapon.AmmoUse2 0
	Weapon.AmmoGive2 0
	Obituary "$OB_MPPISTOL"
	+WEAPON.AMMO_OPTIONAL
	+WEAPON.ALT_AMMO_OPTIONAL
	+WEAPON.NOAUTOFIRE
	//+WEAPON.NOAUTOFIRE
	-WEAPON.NOAUTOAIM
	Inventory.Pickupmessage "$PICKUP_PISTOL_DROPPED"
	Tag "$TAG_PISTOL"
	States
	{
	
	
	
	Ready:
	    TNT1 A 0
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 3, "Ready3")
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 2, "Ready2")
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 1, "Ready1")
		Goto Ready0
		
	Ready0:
		MEKH A 1 A_WeaponReady(1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_GiveInventory("MechReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 64, "TooLowCheck2")
		Goto Ready
		
	Ready1:
		MEKH B 1 A_WeaponReady(1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_GiveInventory("MechReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 64, "TooLowCheck2")
		Goto Ready
		
	Ready2:
		MEKH C 1 A_WeaponReady(1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_GiveInventory("MechReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 64, "TooLowCheck2")
		Goto Ready
		
	Ready3:
		MEKH D 1 A_WeaponReady(1)
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 0, 0, 0, 0)//SHOWHUD
		TNT1 A 0 A_GiveInventory("MechReady", 1)
		NULL A 0 A_JumpIf (pitch > 220, "TooHighCheck2")
		NULL A 0 A_JumpIf (pitch > 64, "TooLowCheck2")
		Goto Ready	
	
	
	
	NotReady:
		TNT1 A 1 A_GiveInventory("MechReady", 1)
		Goto Ready
		
	Deselect:
		TNT1 A 1 A_Lower
		TNT1 A 0 SetPlayerProperty(0,0,4)
		TNT1 AAAAA 0 A_Lower
		TNT1 A 0 A_TAkeInventory("MechGun")
		Loop
	Select:
		TNT1 A 1 A_Raise
		TNT1 AAAAAAAAAAAAAAAAAAAAAAAAAAA 0 A_Raise
		TNT1 A 1 A_Raise
		Goto Ready
		
		
	
	NoAmmo:
		MEKH A 1
		TNT1 A 0 A_Print("Ammunition Depleted", 2)
		Goto Ready 
			
	Fire:
		TNT1 A 0
		
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 3, "Mortar")
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 2, "Rocket")
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 1, "Laser")
		
	Machinegun:
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("HeavyMachinegunAmmo", 1, 1)
		Goto NoAmmo
		TNT1 A 0 A_PlaySound("TANKMG", 1)
		TNT1 A 0 A_FireBullets(3, 2, -1, 25, "MachinegunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
		TNT1 A 0 A_FireCustomMissile("DecorativeTracer", random(-1, 1), 0, -35, -35, 0, random(0, 1))
		TNT1 A 0 A_FireCustomMissile("HeavyMachinegunFlash", 0, 1, 45, -35)
		TNT1 A 0 A_TakeInventory("HeavyMachinegunAmmo", 1)
		MEKH A 1 BRIGHT
		TNT1 A 0 A_PlaySound("TANKMG", 1)
		TNT1 A 0 A_FireBullets(3, 2, -1, 25, "MachinegunBulletPuff", FBF_NORANDOM | FBF_USEAMMO)
		TNT1 A 0 A_FireCustomMissile("DecorativeTracer", random(-1, 1), 1, 35, -35, 0, random(0, 1))
		TNT1 A 0 A_FireCustomMissile("HeavyMachinegunFlash", 0, 1, -25, -35)
		TNT1 A 0 A_TakeInventory("HeavyMachinegunAmmo", 1)
		MEKH A 1 BRIGHT
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_ReFire
		Goto Ready0
		
	Laser:
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("MechLaserAmmo", 1, 1)
		Goto NoAmmo
		TNT1 A 0 A_PlaySound("BIGPLSM1", 1)
		TNT1 A 0 A_FireCustomMissile("heavyplasmaProjectile", 0, 1, -25, -65, 0, 2)
		TNT1 A 0 A_FireCustomMissile("heavyplasmaFlash", 0, 1, -25, -65, 0, 0)
		TNT1 A 0 A_TakeInventory("MechLaserAmmo", 1)
		MEKH BB 4 BRIGHT A_GunFlash
		TNT1 A 0 A_PlaySound("BIGPLSM1", 1)
		TNT1 A 0 A_FireCustomMissile("heavyplasmaProjectile", 0, 1, 25, -65, 0, 2)
		TNT1 A 0 A_FireCustomMissile("heavyplasmaFlash", 0, 1, 25, -65, 0, 0)
		TNT1 A 0 A_TakeInventory("MechlaserAmmo", 1)
		MEKH BB 4 BRIGHT A_GunFlash
		TNT1 A 0 A_ReFire
		Goto Ready1		
		
	Rocket:
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("MechRocketAmmo", 1, 1)
		Goto NoAmmo
		TNT1 A 0 A_FireCustomMissile("AssaultHelicopterRocket", random(-2, 2), 0, -40, 20, 0, random(-2, -1))
		TNT1 A 0 A_TakeInventory("MechRocketAmmo", 1)
		TNT1 A 0 A_PlaySound("MISLFIRE", 1)
		TNT1 A 0 A_PlaySound("MISFAR", 4)
		MEKH C 4 BRIGHT A_GunFlash
		TNT1 A 0 A_FireCustomMissile("AssaultHelicopterRocket", random(-2, 2), 0, 40, 20, 0, random(-2, -1))
		TNT1 A 0 A_TakeInventory("MechRocketAmmo", 1)
		TNT1 A 0 A_PlaySound("MISLFIRE", 1)
		TNT1 A 0 A_PlaySound("MISFAR", 3)
		MEKH C 4 BRIGHT A_GunFlash
		TNT1 A 0 A_ReFire
		Goto Ready2	
	
	Mortar:
		TNT1 A 0 A_GunFlash
		TNT1 A 0 A_JumpIfInventory("MechMortarAmmo", 1, 1)
		Goto NoAmmo
		//TNT1 A 0 A_PlaySound("TANKMG", 1)
		TNT1 A 0 A_FireCustomMissile("MechMortar", random(-1, 1), 1, -45, -15, 0, random(-1, 1))
		TNT1 A 0 A_FireCustomMissile("TankFireEffect", 0, 1, 45, -15)
		TNT1 A 0 A_TakeInventory("MechMortarAmmo", 1)
		MEKH DDDDDDDDDD 4 BRIGHT A_GunFlash
		TNT1 A 0 A_ReFire
		Goto Ready3	
		
	
	AltFire:
		TNT1 A 0
		TNT1 A 0 A_JumpIfInventory("MechFireMode", 3, "Switch0")
		TNT1 A 0 A_GiveInventory("MechFireMode", 1)
		Goto Ready
	
	Switch0:
		TNT1 A 0 A_TakeInventory("MechFireMode", 3)
		Goto Ready0
		
		
	
	
	Flash:
		TNT1 A 1
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 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 > 64, "TooLowCheck1")
		TNT1 A 1
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 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 > 64, "TooLowCheck1")
		TNT1 A 1
		TNT1 A 0 ACS_NamedExecuteAlways("BDMechAmmoHUD", 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 > 64, "TooLowCheck1")
		Stop
	
	
	
	
	
	TooHigh2:
		TNT1 A 0 A_SetPitch(326)
		Goto Ready
		
	
	TooLowCheck2:
		//NULL A 0 A_JumpIf (pitch > 180, "TooHighCheck1")
		TNT1 A 0 A_SetPitch(64)
		Goto Ready
		
		
	TooHighCheck2:
		TNT1 A 0
		NULL A 0 A_JumpIf (pitch < 325, "TooHigh2")
		Goto Ready
	
	
	
	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
	
	LightEnd:
		TNT1 A 10
		Stop
		
	Spawn:
		LAUN A -1
		Stop
		
	}
}




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


ACTOR MechFireEffect
{
	Radius 1
	Height 1
	Speed 70
	Damage 1
	Projectile
	+RANDOMIZE
	+MISSILE
	States
	{
	Spawn:
		TNT1 A 2
		Goto Death
	Death:
		TNT1 A 0
		TNT1 A 0 Radius_Quake(6, 12, 0, 4, 0)
		TNT1 AAAAA 0 A_SpawnItem("RedFlare")
		TNT1 AAAAA 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 1
		TNT1 AAAAA 0 A_SpawnItem("RedFlare")
		TNT1 A 12
		Stop
	}
}


ACTOR MechShotExplosionImpact
{
	damagetype "ExplosiveImpact"
	+MISSILE
	+NOCLIP
	States
	{
	Spawn:
		TNT1 A 1
		TNT1 A 0 A_Explode(50, 400)
		Stop
	}
}


ACTOR MechMachinegunProjectile
{
	Game Doom
	SpawnID 51
	Radius 13
	Height 8
	Speed 130
	Damage 12
	Projectile
	+RANDOMIZE
	+MISSILE
	-NOGRAVITY
	+BLOODSPLATTER
	+NOEXTREMEDEATH
	Gravity 0.2
	RenderStyle Translucent
	damagetype "Blast"
	Alpha 0.9
	Scale 1.1
	Obituary "$OB_MPPLASMARIFLE"
	States
	{
	Spawn:
		MG74 A 1 Bright
		Loop
	Death:
	    TNT1 A 0 A_SpawnItem("RicoChet")
		TNT1 A 10
		Stop
	}
}


actor MechStomp
{
+NOTARGET
Radius 1
Height 1
DamageType Stomp
+NOGRAVITY
+NOTELEPORT
+NODAMAGETHRUST
+THRUGHOST
+NORADIUSDMG
+FORCERADIUSDMG
PROJECTILE
	+DEHEXPLOSION
	+ACTIVATEMCROSS
	+EXPLODEONWATER
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(500,80,0)
TNT1 A 0 A_SpawnItemEx("TreadsDamage2", 0, 50)
TNT1 A 0 A_SpawnItemEx("TreadsDamage2", 0, -50)
TNT1 A 1 A_Noblocking
PLAY A 0
Stop
 }
}


actor MechStandingStillSmash: MechStomp
{
DamageType Extreme
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(2000,40,0)
TNT1 A 1
Stop
}
}



actor MechStompLand: MechStomp
{
DamageType Extreme
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(2000,100,0)
TNT1 A 1
Stop
}
}


actor MechStompLand2: MechStomp
{
DamageType ExplosiveImpact
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(50,600,0)
TNT1 A 1
Stop
}
}




ACTOR MechMortar
{
	Radius 11
	Height 8
	Speed 40
	Damage (random (300, 310))
	Projectile
	+RANDOMIZE
	+DEHEXPLOSION
	+ROCKETTRAIL
	+MISSILE
	+NOGRAVITY
	+FORCERADIUSDMG
	SeeSound "weapons/rocklf"
	DeathSound "weapons/rocklx"
	Obituary "$OB_MPROCKET"
	//+DONTHURTSHOOTER
	States
	{
	Spawn:
		RCKT A 15 Bright
		Goto Death
	Death:
		MISL B 0 Bright
		TNT1 A 0 A_Explode(300, 300)
		TNT1 A 0 A_PlaySound("EXPLOSIO", 3)
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("explosionflames", 0, 0, random (0, 360), 2, random (30, 160))
		
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("ExplosionParticle", 0, 0, random (-40, 40), 2, random (-30, 30))
		TNT1 AAA 0 A_SpawnItem("HeavyMachinegunFlash")
		TNT1 AAAAAAAAAAAAAA 0 A_CustomMissile ("MortarBombs", 0, 0, random (-15, 15), 2, random (-2, 20))
		TNT1 AAAAA 0 A_CustomMissile ("ExplosionSmoke", 0, 0, random (0, 360), 2, random (0, 360))
		TNT1 A 0 A_stop
		Stop
	}
}





ACTOR MortarBombs: Rocket2
{
	Radius 11
	Height 8
	Speed 30
	Damage (random (100, 120))
	+MISSILE
	-NOGRAVITY
	Gravity 0.4
	SeeSound "weapons/rocklf"
	DeathSound "weapons/rocklx"
	DamageType "ExplosiveImpact"
	//+DONTHURTSHOOTER
	States
	{
	Spawn:
		BS2X ABCD 5
		Loop
	}
}
