
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
	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 PressedUse : Inventory
{
inventory.maxamount 1
}

Actor PressedJump : 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
	Inventory.PickupMessage "$GOTCLIP"
	Inventory.Amount 0
	Inventory.MaxAmount 999
	Ammo.BackpackAmount 0
	Ammo.BackpackMaxAmount 999
	Inventory.Icon "TNT1A0"
	States
	{
	Spawn:
		CLIP A -1
		Stop
	}
}

Actor TankDirection : Inventory
{
inventory.maxamount 60
}

ACTOR TankBaseDirection : Ammo
{
	Game Doom
	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 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 DestroyedArmouredVehicleTemp : DestroyedArmouredVehicle
{
	States
	{
		Spawn:
			TNT1 A 0 A_JumpIfInventory("BrutalCounter",105,"Extinguish")
			8762 B 1 A_CustomMissile ("FlamethrowerFireParticles", 36, 0, random (0, 360), 2, random (40, 90))
			8762 B 9
			TNT1 A 0 A_GiveInventory("BrutalCounter",1)
			Loop
		Extinguish:
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			8762 B 1 A_NoBlocking
			8762 B -1
			Stop
	}
}

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

		TNT1 A 0 A_Explode(200,200)
		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 (4, 35, 0, 10, 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 DestroyedAircraftTemp : DestroyedArmouredVehicle
{
	States
	{
		Spawn:
			TNT1 A 0 A_JumpIfInventory("BrutalCounter",105,"Extinguish")
			8762 C 1 A_CustomMissile ("FlamethrowerFireParticles", 36, 0, random (0, 360), 2, random (40, 90))
			8762 C 9
			TNT1 A 0 A_GiveInventory("BrutalCounter",1)
			Loop
		Extinguish:
			TNT1 A 0 A_SpawnItem("BarrelExplosionSmokeColumn")
			8762 C 1 A_NoBlocking
			8762 C -1
			Stop
	}
}

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 128
	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(125,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 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}}