
ACTOR RepairTool : Weapon 6544
{
	Weapon.Kickback 0
	Weapon.SelectionOrder 2200
	Inventory.PickupMessage "You got the Repair Tool (Slot 0)"
	Obituary "$OB_MPCHAINSAW"
	Tag "$TAG_CHAINSAW"
	+WEAPON.MELEEWEAPON		
	+NOBLOOD
	States
	{
	Ready:
		REPT A 4 A_WeaponReady
		Loop
	Deselect:
		REPT A 1 A_Lower
		Loop
	Select:
		REPT A 1 A_Raise
		Loop
	Fire:
		TNT1 A 0
		TNT1 A 0 A_FireCustomMissile("RepairMissile")
		REPT BC 1 BRIGHT
		REPT A 1
		SAWG B 0 A_ReFire
		Goto Ready
	Spawn:
		REPT Z 1
		REPT Z -1
		Stop
	}
}





ACTOR RepairMissile
{
	Game Doom
	Radius 13
	Height 8
	Speed 25
	Damage (random (8, 8))
	Projectile
	+RANDOMIZE
	RenderStyle Add
	Species "VehicleSpecial"
	DamageType Repair
	Decal "BulletChip"
	+THRUSPECIES
	+NOBLOOD
	+NOBLOODDECALS
	Alpha 0.75
	States
	{
	Spawn:
		TNT1 A 3
		Stop
	Death:
		TNT1 A 0
		TNT1 AAA 0 A_SpawnItem ("RepairToolRicochet", 0)
		Stop
	}
}

ACTOR RepairToolRicochet: BulletPuff
{
  renderstyle Add
  alpha 0.7
  +NOBLOCKMAP
  +NOGRAVITY
  +CLIENTSIDEONLY
  +BLOODLESSIMPACT 
  +FORCEXYBILLBOARD
  +NOBLOOD
  
	Obituary "%o ate bullet shrapnel."
  damagetype "Shrapnel"
  Scale 0.6
  Speed 0
  states
  {
  Spawn:
    TNT1 A 0 A_SpawnItem ("BlueFlareSmall", 0)
	TNT1 A 0 A_Jump(255, "Spawn1", "Spawn2")
    
	Spawn1:
	TNT1 AA 0 A_SpawnItem ("BlueFlareSmall", 0)
	FXB7 ABCDEFGHIJ 1 BRIGHT
    Stop
	
	Spawn2:
	TNT1 AA 0 A_SpawnItem ("BlueFlareSmall", 0)
	FXB8 ABCDEFGHIJ 1 BRIGHT
    Stop
    
    stop
  }
}














Actor StationedVehicleCheckRepairs
{
+MISSILE
Damagetype "CheckRepair"
Speed 0
States
{
Spawn:
TNT1 A 1
Goto Death
Death:
TNT1 A 0
TNT1 A 0 A_Explode(3, 50)
Stop
}}


Actor RepairVehicleMissile
{
+MISSILE
Radius 2
Height 2
Damagetype "Repair"
Speed 3
Damage (random (1, 2))
States
{
Spawn:
TNT1 A 2
Stop
Death:
TNT1 A 1
TNT1 A 5
Stop
}}


Actor VehicleRepairStation 8723
{
+SHOOTABLE
+NOTIMEFREEZE
+FLOORCLIP
+NOBLOOD
+THRUACTORS
DamageFactor "CheckRepair", 1.0
DamageFactor "Stomp", 0.0
DamageFactor "Repair", 0.0
Painchance "CheckRepair", 255
Mass 99999
Radius 16
Height 16
Gravity 0
Health 999999
States
{
Spawn:
TNT1 A 1
TNT1 A -1
Stop

Pain:
TNT1 A 3
Goto Spawn

Pain.CheckRepair:
TNT1 A 0
TNT1 A 0 A_SpawnItemEx("RepairVehicleMissile", 0, 0, 20)
TNT1 A 3
Goto Spawn
}}










//Sergeant Mark IV's Tanks and Helicopter.
//If you use this in your mod, give me credits.

//Helicopter model used for rips by killst4r
//Helicopter sound effects by the youtube channel Audio Productions
//tank fire sounds by Andy Pang
//M1 abrams engine sounds by kempet
//car crash sound effect by SoundIdeasCanada
//Tank turret sprites originally based on Scuba Steve's Action Doom Tank

//To implement these vehicles into your mod, copy all lumps.
//The fire and smoke effects used for explosions are inside the TESTMAP.wad file and are not obligatory.

Actor MechFireMode : Inventory
{
inventory.maxamount 3
}

Actor CanLeaveVehicle : Inventory
{
inventory.maxamount 1
}

Actor HelicopterIsFlying : Inventory
{
inventory.maxamount 1
}

Actor StoredHealthInsideVehicle : Inventory
{
inventory.maxamount 9999
}

Actor StoredArmorInsideVehicle : Inventory
{
inventory.maxamount 9999
}

Actor Accelerate : Inventory
{
inventory.maxamount 1
}

Actor Backpedal : Inventory
{
inventory.maxamount 1
}

Actor TurnLeft : Inventory
{
inventory.maxamount 1
}

Actor TurnRight : Inventory
{
inventory.maxamount 1
}

Actor TurnMouseLeft : Inventory
{
inventory.maxamount 1
}

Actor TurnMouseRight : Inventory
{
inventory.maxamount 1
}

Actor PressedUse : Inventory
{
inventory.maxamount 1
}

Actor PressedJump : Inventory
{
inventory.maxamount 1
}

Actor PressedLeft : Inventory
{
inventory.maxamount 1
}


Actor TankZoom : Inventory
{
inventory.maxamount 1
}


Actor MaxLeft : Inventory
{
inventory.maxamount 1
}

Actor MaxRight : Inventory
{
inventory.maxamount 1
}


Actor IsAVehicle : Inventory
{
inventory.maxamount 1
}


Actor VehicleFallingCount : Inventory
{
inventory.maxamount 100
}

ACTOR VehicleSpeed : Ammo
{
	Game Doom
	SpawnID 11
	Inventory.PickupMessage "$GOTCLIP"
	Inventory.Amount 0
	Inventory.MaxAmount 999
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 999
	Inventory.Icon "CLIPA0"
	States
	{
	Spawn:
		CLIP A -1
		Stop
	}
}

Actor TankDirection : Inventory
{
inventory.maxamount 60
}



ACTOR TankBaseDirection : Ammo
{
	Game Doom
	SpawnID 11
	Inventory.PickupMessage "$GOTCLIP"
	Inventory.Amount 0
	Inventory.MaxAmount 360
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 360
	Inventory.Icon "CLIPA0"
	States
	{
	Spawn:
		CLIP A -1
		Stop
	}
}

actor ChaseCam3
{
  height 1
  radius 1
  +NOGRAVITY
  +THRUACTORS
  states
  {
  Spawn:
    NULL A -1
    stop
  }
}
	


Actor DestroyedArmouredVehicle
{
+solid
+SHOOTABLE
+INVULNERABLE
+NOBLOOD
Height 24
Radius 24
Mass 999999
Scale 1.4
States
{
Spawn:
8762 B 1 A_CustomMissile ("FlamethrowerFireParticles", 36, 0, random (0, 360), 2, random (40, 90))
8762 B 9
Loop
}
}



Actor TankExplode
{
+solid
+SHOOTABLE
+INVULNERABLE
+NOBLOOD
Height 24
Radius 24
Mass 999999
Scale 1.4
States
{
Spawn:

		TNT1 A 0 A_SpawnItemEx ("BarrelExplosionDamage",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		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 ("ExplosionFlareSpawner",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
        TNT1 A 0 A_SpawnItem("WhiteShockwaveBig")
		TNT1 A 0 A_NoBlocking
	    TNT1 A 0 A_Fall
		
		
		TNT1 A 0 A_SpawnItemEx ("BarrelKaboom",0,0,0,0,0,0,0,SXF_NOCHECKPOSITION,0)
		TNT1 AAAA 0 A_CustomMissile ("FireworkSFXType2", 64, 0, random (0, 360), 2, random (30, 60))
		TNT1 AAA 0 A_CustomMissile ("HighExplosiveFlames", random (10, 20), 0, random (0, 360), 2, random (10, 90))
		TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles3", 45, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles4", 45, 0, random (0, 360), 2, random (40, 90))
		EXPL A 0 Radius_Quake (3, 24, 0, 15, 0)
		8762 B 10
		TNT1 AAA 0 A_CustomMissile ("HighExplosiveFlamesBig", random (100, 600), 0, random (0, 360), 2, random (10, 90))
		TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles3", 45, 0, random (0, 360), 2, random (40, 90))
		TNT1 AAA 0 A_CustomMissile ("BDExplosionparticles4", 45, 0, random (0, 360), 2, random (40, 90))
		8762 B 5
		TNT1 A 0 A_CustomMissile ("hUGEExplosionSpawner2", 30, 0, random (0, 360), 2, random(80, 90))
		Live:
		8762 B 1 A_CustomMissile ("FlamethrowerFireParticles", 36, 0, random (0, 360), 2, random (40, 90))
		8762 B 9
		Loop
}
}


Actor DestroyedAircraft: DestroyedArmouredVehicle
{
States
{
Spawn:
8762 C 1 A_CustomMissile ("FlamethrowerFireParticles", 36, 0, random (0, 360), 2, random (40, 90))
8762 C 9
Loop
}
}


Actor CancelTeleportFog
{
+THRUACTORS
+MISSILE
+NOPAIN
Height 0
Radius 0
Speed 0
damagetype "CancelTeleportFog"
States
{
Spawn:
TNT1 A 1
Death:
TNT1 A 0 A_Explode(4, 128, 0)
Stop
}
}


ACTOR TransferPlayerOutOfVehicle
{

	Radius 16
	Height 40
	+MISSILE
	+NOGRAVITY
	MaxTargetRange 120
	Speed 0
    States
    {
    Spawn:
	    TNT1 A 0
		TNT1 A 0 A_GiveToTarget("CanLeaveVehicle", 1)
		TNT1 A 0 Thing_ChangeTID(0, 264)
		TNT1 A 0 A_NoBlocking
		TNT1 A 6
		TNT1 A 0 A_SpawnItem("CancelTeleportFog")
		TNT1 A 2
		TNT1 A 0 Thing_ChangeTID(0, 0)
		Stop
		
	Death:
		TNT1 A 0
		Stop
	}
}












Actor FiredTankMainGun : Inventory
{
inventory.maxamount 1
}





actor TnkTreadsDamage
{
+NOTARGET
Radius 1
Height 1
DamageType Stomp
+NOGRAVITY
+NOTELEPORT
+NODAMAGETHRUST
+THRUGHOST
+NORADIUSDMG
+FORCERADIUSDMG
PROJECTILE
+DEHEXPLOSION
+ACTIVATEMCROSS
+EXPLODEONWATER
-BLOODSPLATTER +BLOODLESSIMPACT 
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(200,50,0)
TNT1 A 0 A_CustomMissile("TreadsDamage2", 4, 50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage2", 4, -50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage3", 48, 50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage3", 48, -50, 0, 2, 0)
TNT1 A 1 A_Noblocking
PLAY A 0
Stop
 }
}


actor EnemyTnkTreadsDamage: TnkTreadsDamage
{
States
{
Spawn:
TNT1 A 0
TNT1 A 0 A_Explode(200,50,0)
TNT1 A 0 A_CustomMissile("TreadsDamage2", 4, 50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage2", 4, -50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage3", 48, 50, 0, 2, 0)
TNT1 A 0 A_CustomMissile("TreadsDamage3", 48, -50, 0, 2, 0)
TNT1 A 0 A_spawnItemex("TankEngineWeakSpot", -150,0, 10, 0, 0, 0)
TNT1 A 1 A_Noblocking
PLAY A 0
Stop
 }
}




actor TreadsDamage2: TnkTreadsDamage
{
Speed 12
States
{
Spawn:
TNT1 A 0

PLAY A 0
TNT1 A 1 A_Noblocking
TNT1 A 0 A_Explode(200,50,0)
Stop
 }
}


actor TreadsDamage3: TnkTreadsDamage
{
DamageType Kick
Speed 18
-FORCERADIUSDMG
+GHOST
+THRUGHOST
States
{
Spawn:
TNT1 A 0

PLAY A 0
TNT1 A 1 A_Noblocking
TNT1 A 0 A_Stop
TNT1 A 0 A_Explode(10,50,0)
Stop
 }
}



Actor TankBlood
{
	+THRUACTORS
	-ALLOWPARTICLES
	+NOBLOODDECALS
	-BLOODSPLATTER
	+CLIENTSIDEONLY
	Renderstyle Add
	Speed 0
	Scale 0.4
	States
		{
		Spawn:
			TNT1 A 0
			TNT1 A 0 A_Stop
			TNT1 A 0 A_PlaySound("RICMET")
			TNT1 A 0 A_SpawnItem ("YellowFlareSmall", 0)
			FX58 ABCD 1 BRIGHT 
			FX58 EFGHIJ 1 bright
			TNT1 A 60
		Stop}}
		
		
		
		

actor TankWeakSpotBase
{
	+NOTARGET
damagefactor "Taunt", 0.0
damagefactor "Blood", 0.0
damagefactor "BlueBlood", 0.0
damagefactor "Head", 0.0
damagefactor "MinorHead", 0.0
damagefactor "KillMe", 0.0
damagefactor "Control", 0.0
damagefactor "Trample", 0.0
damagefactor "GibRemoving", 0.0
//damagefactor "Melee", 0.3
damagefactor "Alert", 0.0
damagefactor "SSG", 1.0
damagefactor "ExplosiveImpact", 0.0
damagefactor "Bullet", 1.5
damagefactor "GibRemoving", 0.0
damagefactor "Kick", 0.0
damagefactor "Stomp", 0.0
damagefactor "TeleportRemover", 0.0
damagefactor "TankShell", 5.5
damagefactor "Plasma", 1.2
damagefactor "Plasma2", 1.2
damagefactor "Railgun", 1.2 damagefactor "Explosives", 1.2
damagefactor "Repair", 0.0 damagefactor "CheckRepair", 0.0
//MONSTER
-COUNTKILL
Health 3000
GibHealth 10000
Radius 32
Height 52
DamageType TankWeakSpot
BloodType "TankBlood"
PainChance 255
+NOGRAVITY
+SHOOTABLE
+NOTELEPORT
+FORCERADIUSDMG
-SOLID
+NODAMAGETHRUST
+NORADIUSDMG
-COUNTKILL
-CLIENTSIDEONLY
+NORADIUSDMG
+THRUACTORS
damagefactor "Trample", 0
damagefactor "TankWeakSpot", 0
Species "VehicleSpecial"
States
{
Spawn:
TNT1 A 4
XXXX A 0 A_NoBlocking
Stop

Pain.Explosive:
TNT1 A 3
Goto Pain

Pain.ExplosiveImpact:
TNT1 A 3
Goto Pain

Pain:
TNT1 A 0
//TNT1 A 0 ThrustThingZ(0,-40,0,1)
TNT1 A 0 A_NoBlocking
TNT1 A 0 A_JumpIfHealthLower(-100, "SuperDeath")
TNT1 A 0 A_JumpIfHealthLower(25, "Pain550")
TNT1 A 0 A_JumpIfHealthLower(50, "Pain500")
TNT1 A 0 A_JumpIfHealthLower(75, "Pain450")
TNT1 A 0 A_JumpIfHealthLower(100, "Pain400")
TNT1 A 0 A_JumpIfHealthLower(125, "Pain350")
TNT1 A 0 A_JumpIfHealthLower(150, "Pain300")
TNT1 A 0 A_JumpIfHealthLower(175, "Pain250")
TNT1 A 0 A_JumpIfHealthLower(200, "Pain200")
TNT1 A 0 A_JumpIfHealthLower(225, "Pain150")
TNT1 A 0 A_JumpIfHealthLower(250, "Pain100")
TNT1 A 0 A_JumpIfHealthLower(275, "Pain50")
TNT1 A 0 A_JumpIfHealthLower(288, "Pain35")
TNT1 A 0 A_JumpIfHealthLower(292, "Pain25")
XDT3 A 0 A_Explode(20,20,0)//hs
PLAY A 0
Stop


Pain25:
TNT1 A 0
XDT3 A 0 A_Explode(10,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop


Pain35:
TNT1 A 0
XDT3 A 0 A_Explode(15,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain50:
TNT1 A 0
XDT3 A 0 A_Explode(30,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain100:
TNT1 A 0
XDT3 A 0 A_Explode(80,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain150:
TNT1 A 0
XDT3 A 0 A_Explode(100,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain200:
TNT1 A 0
XDT3 A 0 A_Explode(150,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain250:
TNT1 A 0
XDT3 A 0 A_Explode(200,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain300:
TNT1 A 0
XDT3 A 0 A_Explode(300,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain350:
TNT1 A 0
XDT3 A 0 A_Explode(350,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain400:
TNT1 A 0
XDT3 A 0 A_Explode(400,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain450:
TNT1 A 0
XDT3 A 0 A_Explode(600,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain500:
TNT1 A 0
XDT3 A 0 A_Explode(1200,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain550:
TNT1 A 0
XDT3 A 0 A_Explode(1550,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

Pain600:
TNT1 A 0
XDT3 A 0 A_Explode(1600,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop

SuperDeath:
Death:
TNT1 A 0
XDT3 A 0 A_Explode(1800,80,0)//hs
TNT1 A 0 A_NoBlocking
Stop
 }
}	




		

actor TankWeakSpot3: TankWeakSpotBase
{
States
{
Spawn:
TNT1 A 3
XXXX A 0 A_NoBlocking
Stop
 }
}	
	