module Rotators
{
   /* Wheels 4 Axle */

	template vehicle SemiTruckTemplate
	{
		mechanicType = 2,
		engineRepairLevel = 5,
		playerDamageProtection = 0.85,
		engineRPMType = SemiTruckRPM,
      	frontEndHealth = 1000,
		rearEndHealth = 500,
		isSmallVehicle = false,

		sound
		{
			engine = VehicleEngineStepVan,
			engineStart = VehicleEngineStepVan,
			engineTurnOff = VehicleEngineStepVan,
			horn = truckhorn1,
			ignitionFail = VehicleIgnitionFailStepVan,
			backSignal = VehicleBackUpBeeper,
		}

		textureRust = Vehicles/Vehicles_rSemiTruck_Rust,
		textureMask = Vehicles/Vehicles_rSemiTruck_Mask,
		textureLights = Vehicles/Vehicles_rSemiTruck_Lights,
		textureDamage1Shell = Vehicles/vehicles_rSemiTruck_Shell_Damaged01,
		textureDamage2Shell = Vehicles/vehicles_rSemiTruck_Shell_Damaged02,
		textureDamage1Overlay = Vehicles/vehicles_rSemiTruck_Overlay_Damaged01,
		textureDamage2Overlay = Vehicles/vehicles_rSemiTruck_Overlay_Damaged02,
		textureShadow = Vehicles/Vehicles_rSemiTruck_Shadow,

        wheel FrontLeft
        {
            front = true,
            offset = 0.76 -0.8504 2.51,
            radius = 0.38f,
            width = 0.3f,
        }

        wheel FrontRight
        {
            front = true,
            offset = -0.76 -0.8504 2.51,
            radius = 0.38f,
            width = 0.3f,
        }

        wheel RearLeft
        {
            front = false,
            offset = 0.76 -0.9504 -1.49,
            radius = 0.38f,
            width = 0.18f,
        }

        wheel RearRight
        {
            front = false,
            offset = -0.76 -0.9504 -2.53,
            radius = 0.38f,
            width = 0.18f,
        }
 

		area Engine
		{
			xywh = 0.0000 2.8158 3.4386 1.7018,
		}

		area SeatFrontLeft
		{
			xywh = 1.3168 1.1980 0.7921 0.8119,
		}

		area SeatFrontRight
		{
			xywh = -1.3168 1.1980 0.7921 0.8119,
		}

        area GasTank
        {
            xywh = -1.1316 0.1284 0.4211 1.1404,
        }

		area TireFrontLeft
		{
			xywh = 1.1842 2.5175 0.4211 0.4211,
		}

		area TireFrontRight
		{
			xywh = -1.1667 2.5175 0.4211 0.4211,
		}

		area TireMiddleLeft
		{
			xywh = 1.1667 -1.5088 0.4211 0.4211,
		}

		area TireMiddleRight
		{
			xywh = -1.1842 -1.5088 0.4211 0.4211,
		}
		area TireRearRight
		{
			xywh = -1.1842 -2.5263 0.4211 0.4211,
		}

		area TireRearLeft
		{
			xywh = 1.1667 -2.5263 0.4211 0.4211,
		}



		template = Seat/part/SeatFrontLeft,
		template = Seat/part/SeatFrontRight,
		part Seat*
		{
			table install
			{
				skills = Mechanics:2,
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				skills = Mechanics:2,
				recipes = Intermediate Mechanics,
			}
		}
      
		template = Radio,

		part Radio*
		{
			model Radio.HamRadio1
			{
				file = Rotators.SemiTruckAntenna,
			}

			itemType = Base.RadioBlack;Base.RadioRed;Base.RadioMakeShift;Base.HamRadioMakeShift;Base.HamRadio1,

			table install
			{
				complete = rLib.Vehicles.Functions.InstallComplete.DefaultWithItemTypeModel,
			}

			table uninstall
			{
				complete = rLib.Vehicles.Functions.UninstallComplete.DefaultWithItemTypeModel,
			}

			lua
			{
				create = rLib.Vehicles.Functions.Create.RadioWithItemTypeModel,
				init = rLib.Vehicles.Functions.Init.DefaultWithItemTypeModel,
				update = Vehicles.Update.Radio,
			}
		}

		template = GasTank,
		part GasTank
		{	
			itemType = Rotators.Tank125_;Base.Tank125_;Base.SmallGasTank;Base.NormalGasTank;Base.BigGasTank,
			durability = 10,
			model GasTank
			{
				file = Rotators.SemiTruckGasTank,
			}
		}

		template = Battery,
		template = Engine,

		part Engine
		{
			table armor
			{
				logic = RotatorsLib,
				condition = 100,

				needs =
				{
					part = ArmorBullbar,
					condition = 1,
				}

				lua =
				{
					check = rSemiTruck.Event.EngineBullbarCheck,
					repair = rSemiTruck.Event.EngineBullbarRepair,
				}
			}
		}

		template = Muffler,
		part Muffler
		{
         /*setAllModelsVisible = false;*/
         
			model Base.OldCarMuffler2
			{
				file = Rotators.SemiTruckMuffler1,
			}

			model Base.NormalCarMuffler2
			{
				file = Rotators.SemiTruckMuffler2,
			}

			model Base.ModernCarMuffler2
			{
				file = Rotators.SemiTruckMuffler3,
			}

			anim Close
			{
				sound = VehicleTrunkCloseStandard,
				anim = Muffler_anim,
				rate = 1.0,
			}

			anim Open
			{
				sound = VehicleTrunkOpenStandard,
				anim = Muffler_anim,
				rate = 1.0,
			}

			anim Closed
			{
				anim = Muffler_anim,
				animate = FALSE,
			}

			anim Opened
			{
				anim = Muffler_anim,
				animate = FALSE,
			}

			table install
			{
				recipes = Intermediate Mechanics,
				complete = rLib.Vehicles.Functions.InstallComplete.DefaultWithItemTypeModel,
			}

			table uninstall
			{
				recipes = Intermediate Mechanics,
				complete = rLib.Vehicles.Functions.UninstallComplete.DefaultWithItemTypeModel,
			}

			lua
			{
				create = rLib.Vehicles.Functions.Create.DefaultWithItemTypeModel,
				init = rLib.Vehicles.Functions.Init.DefaultWithItemTypeModel,
			}
		}

		template = EngineDoor,

		part EngineDoor
		{
			model hood
			{
				file = Rotators.SemiTruckHood,
				rotate = 0 0 0,
				scale = 1,
				offset = 0 0 0,
			}

			anim Open
			{
				sound = VehicleHoodOpenJeep,
				anim = Hood_closing,
				reverse = TRUE,
				rate = 1.0,
			}

			anim Close
			{
				sound = VehicleHoodCloseJeep,
				anim = Hood_closing,
				rate = 2.6,
			}

			anim Closed
			{
				anim = Hood_closing,
				reverse = TRUE,
				animate = FALSE,
			}

			anim Opened
			{
				anim = Hood_closing,
				animate = FALSE,
			}

			table install
			{
				recipes = Advanced Mechanics,
			}

			table uninstall
			{
				recipes = Advanced Mechanics,
			}

			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorBullbar,
					condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		part Heater
		{
			category = engine,

			lua
			{
				update = Vehicles.Update.Heater,
			}
		}

		part PassengerCompartment
		{
			category = nodisplay,

			lua
			{
				update = Vehicles.Update.PassengerCompartment,
			}
		}

		template = Windshield/part/Windshield,

		part Windshield*
		{
			table install
			{
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				requireUninstalled = ArmorFront,
				recipes = Intermediate Mechanics,
			}

			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorFront,
					condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}
		template = Rotators.SemiTruckArmor/part/ArmorFront,

		template = Window/part/WindowFrontLeft,
		template = Window/part/WindowFrontRight,

		part WindowFrontLeft
		{
			table uninstall
			{
				requireUninstalled = ArmorDoorL,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,

				needs =
				{
					part = ArmorDoorL,
					condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		part WindowFrontRight
		{
			table uninstall
			{
				requireUninstalled = ArmorDoorR,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorDoorR,
					condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		part Window*
		{
			table install
			{
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				recipes = Intermediate Mechanics,
			}
		}

		template = Door/part/DoorFrontLeft,
		template = Rotators.SemiTruckArmor/part/ArmorDoorL,

		template = Door/part/DoorFrontRight,
		template = Rotators.SemiTruckArmor/part/ArmorDoorR,

		part DoorFrontLeft
		{
			table uninstall
			{
				requireUninstalled = ArmorDoorL,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorDoorL,
					condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		part DoorFrontRight
		{
			table uninstall
			{
				requireUninstalled = ArmorDoorR,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorDoorR,
               condition = 1,
				}
				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		part Door*
		{
			anim Lock
			{
				sound = LockVehicleDoorVan,
			}
			
			anim Unlock
			{
				sound = UnlockVehicleDoorVan,
			}

			anim IsLocked
			{
				sound = VehicleDoorIsLockedVan,
			}
			table install
			{
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				recipes = Intermediate Mechanics,
			}
		}
		template = Rotators.Axle4Tires,
		template = Rotators.SemiTruckArmor/part/WheelChainFrontLeft,
		template = Rotators.SemiTruckArmor/part/WheelChainFrontRight,
		template = Rotators.SemiTruckArmor/part/WheelChainMiddleLeft,
		template = Rotators.SemiTruckArmor/part/WheelChainMiddleRight,
		template = Rotators.SemiTruckArmor/part/WheelChainRearLeft,
		template = Rotators.SemiTruckArmor/part/WheelChainRearRight,
		part Tire*
		{
		setAllModelsVisible = false,
        
		
		table install
         {
			 complete = rSemiTruck.ATATuning.InstallComplete.SafeTireNotAllModelsVisible,
         }
         table uninstall
         {
			 complete = rSemiTruck.ATATuning.UninstallComplete.SafeTireNotAllModelsVisible,
         }
         lua
         {
             create = Vehicles.Create.Tire,
			 init = rSemiTruck.ATATuning.Init.SafeTireNotAllModelsVisible,
             checkOperate = Vehicles.CheckOperate.Tire,
             update = Vehicles.Update.Tire,
         }
		}

		template = Brake,

		part Brake*
		{
			table install
			{
				skills = Mechanics:4,
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				skills = Mechanics:4,
				recipes = Intermediate Mechanics,
			}
		}

		template = Suspension,

		part Suspension*
		{
			table install
			{
				skills = Mechanics:4,
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				skills = Mechanics:4,
				recipes = Intermediate Mechanics,
			}
		}
		template = Rotators.SemiTruckArmor/part/ArmorBullbar,
		template = Headlight,

		part HeadlightLeft
		{
			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorBullbar,
					condition = 35,
				}
			}
			table headlight
            {
                xOffset = 0.0,
                yOffset = 1.7,
                distance = 28,
                intensity = 1.75,
				focusing = 25,
            }
		}

		part HeadlightRight
		{
			table armor
			{
				logic = RotatorsLib,
				condition = 100,
				needs =
				{
					part = ArmorBullbar,
               condition = 35,
				}
			}
			table headlight
            {
                xOffset = 0.0,
                yOffset = 1.7,
                distance = 28,
                intensity = 1.75,
				focusing = 25,
            }
		}
		part HeadlightRearLeft
        {
            mechanicArea = Back,
            area = TruckBed,
        }
        part HeadlightRearRight
        {
            mechanicArea = Back,
            area = TruckBed,
        }
		
	}

}
