module Base
{
	vehicle SemiTrailerLowBed
    {
        template! = Base.TrailerLowBed,

        skin
        {
            texture = Vehicles/Trailers_LowBed,
        }

        physics box
        {
            offset = 0.0000 1.7392 -1.2783,
            extents = 1.7826 2.6435 2.2000,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 1.9563 1.2087,
            extents = 1.7826 2.1913 2.7913,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 2.0609 3.9586,
            extents = 1.7826 1.9478 2.7043,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = -0.3621 0.5217 3.4522,
            extents = 0.0870 0.8696 0.0870,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.3621 0.5217 3.4522,
            extents = 0.0870 0.8696 0.0870,
            rotate = 0.0000 0.0000 0.0000,
        }

        attachment trailerTruck
        {
            offset = 0.0000 -0.5056 5.6435,
            rotate = 0.0000 0.0000 0.0000,
            canAttach = trailerTruck,
            updateconstraint = false,
        }

        extents = 1.7739 1.9652 8.3826,
        physicsChassisShape = 1.7739 1.9652 8.4000,
        centerOfMassOffset = 0.0000 1.9739 1.8348,
        shadowExtents = 1.8266 8.9786,
        shadowOffset = 0.0000 2.3846,
    }
	template vehicle TrailerLowBed
	{
		model
        {
            file = Rotators.trailers_Flatbed_Body,
            scale = 1.1500,
            offset = 0.0000 1.3217 -0.2623,
        }
		neverSpawnKey = true,
		mechanicType = 2,
		offRoadEfficiency = 2,
		engineRepairLevel = 4,
		playerDamageProtection = 1,
		isSmallVehicle = false,
		textureRust = Vehicles/Trailers_rVan_Rust,
		textureMask = Vehicles/Trailers_rVan_Mask,
		textureLights = Vehicles/Trailers_rVan_Lights,
		textureDamage1Overlay = Vehicles/Trailers_rVan_Overlay_Damaged01,
		textureDamage2Overlay = Vehicles/Trailers_rVan_Overlay_Damaged02,
		textureDamage1Shell = Vehicles/Trailers_rVan_Shell_Damaged01,
		textureDamage2Shell = Vehicles/Trailers_rVan_Shell_Damaged02,
		mass = 310,

        extents = 1.7739 1.9652 8.3826,
        physicsChassisShape = 1.7739 1.9652 8.4000,
        centerOfMassOffset = 0.0000 1.9739 1.8348,
        shadowExtents = 1.8266 8.9786,
        shadowOffset = 0.0000 2.3846,

		brakingForce = 1,
		stoppingMovementForce = 1.0f,
		rollInfluence = 0.15f,
		steeringIncrement = 0.03,
		steeringClamp = 0.3,
		suspensionStiffness = 40,
		suspensionCompression = 4.83,
		suspensionDamping = 3.88,
		maxSuspensionTravelCm = 15,
		suspensionRestLength = 0.16f,
		wheelFriction = 0.5f,
		frontEndHealth = 150,
		rearEndHealth = 150,
		seats = 2,

        wheel FrontLeft
        {
            front = true,
            offset = 0.6000 -0.8870 0.2609,
            radius = 0.40f,
            width = 0.90f,
        }

        wheel FrontRight
        {
            front = true,
            offset = -0.6000 -0.8870 0.2609,
            radius = 0.40f,
            width = 0.90f,
        }

        wheel RearLeft
        {
            front = false,
            offset = 0.6000 -0.8870 -0.7217,
            radius = 0.40f,
            width = 0.90f,
        }

        wheel RearRight
        {
            front = false,
            offset = -0.6000 -0.8870 -0.7217,
            radius = 0.40f,
            width = 0.90f,
        }
        part ATAMultiSlotWrecker
        {
			area = TruckBed,
            specificItem = false,
            category = nodisplay,
            itemType = Base.LightBulb,

			model Default
			{
				file = Rotators.Vehicles_TrailerAHauler_Tent2,
			}


            table ATAMultiSlotWrecker
            {
                slots = 3,
                spawnDist = 4,
                spawnSize = 2,
            }
            table install
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                skills = Mechanics:6,
                time = 400,
                test = ATATuning.InstallTest.multiRequire,
                complete = ATATuning.InstallComplete.DefaultModel,
            }
            table uninstall
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                skills = Mechanics:5,
                time = 400,
                test = ATATuning.UninstallTest.multiRequire,
                complete = ATATuning.UninstallComplete.DefaultModel,
            }
            
            lua
            {
                create = ATATuning.Create.Chance0,
                init = ATATuning.Init.Default,
            }
		}

        part wrecker_TireMiddleLeft
        {
        }
		part wrecker_TireMiddleRight
        {
        }
        part wrecker_BrakeMiddleRight
        {
        }
		part wrecker_BrakeMiddleLeft
        {
        }
        part wrecker_SuspensionMiddleRight
        {
        }
		part wrecker_SuspensionMiddleLeft
        {
        }
        part wrecker_MatressRearLeft
        {
        }
		part wrecker_MatressRearRight
        {
        }		
		part wrecker_ArmorFront
        {
        }	
		part wrecker_ArmorDoorL
        {
        }	
		part wrecker_ArmorDoorR
        {
        }	
		part wrecker_ArmorRear
        {
        }	
		part wrecker_ArmorBullbar
        {
        }	
		part wrecker_ArmorTires
        {
        }	
		part wrecker_TrunkLeft
        {
        }	
		part wrecker_TrunkDoorLeft
        {
			itemType = Rotators.TrunkDoorLeft,
        }
		part wrecker_TruckBed
        {
        }
		part wrecker_PassengerCompartment
        {
        }		
		part wrecker_RefrigeratorUnit
        {
        }
		part wrecker_MattressRearLeft
		{
		}
		part wrecker_MattressRearRight
		{
		}
		part wrecker_MicrowaveRearRight
		{
		}
		part wrecker_FridgeRearLeft
		{
		}
		part wrecker_CounterRearRight
		{
		}
		part wrecker*
        {
            itemType = Base.LightBulb,
           category = nodisplay,
            table install
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
            }
            table uninstall
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
            }
        }
		template = Rotators.DoubleTires,

		part TireFrontLeft
		{
			table uninstall
			{
				requireUninstalled = WheelChainFrontLeft,
				recipes = Basic Mechanics,
			}

			model InflatedTirePlusWheel
			{
				file = Rotators.TrailerVanFrontWheelLeft,
				offset = 0.0000 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}

			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = -0.0 0.0000 0.0000,
				rotate = 0.0000 0.0000 180.0000,
			}
		}

		part WheelChainFrontLeft
		{
			parent = TireFrontLeft,
			area = TireFrontLeft,
			table install
			{
				requireInstalled = TireFrontLeft,
			}
			table uninstall
			{
				requireInstalled = TireFrontLeft,
			}
		}

		part TireFrontRight
		{
			table uninstall
			{
				requireUninstalled = WheelChainFrontRight,
				recipes = Basic Mechanics,
			}

			model InflatedTirePlusWheel
			{
				file = Rotators.TrailerVanFrontWheelRight,
				offset = 0.0000 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}

			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = 0.0 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}
		}

		part WheelChainFrontRight
		{
			parent = TireFrontRight,
			area = TireFrontRight,
			table install
			{
				requireInstalled = TireFrontRight,
			}
			table uninstall
			{
				requireInstalled = TireFrontRight,
			}
		}

		part TireRearLeft
		{
			table uninstall
			{
				requireUninstalled = WheelChainRearLeft,
				recipes = Basic Mechanics,
			}

			model InflatedTirePlusWheel
			{
				file = Rotators.TrailerVanRearWheelLeft,
				offset = 0.0000 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}

			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = -0.0 0.0000 0.0000,
				rotate = 0.0000 0.0000 180.0000,
			}
		}

		part WheelChainRearLeft
		{
			parent = TireRearLeft,
			area = TireRearLeft,
			table install
			{
				requireInstalled = TireRearLeft,
			}
			table uninstall
			{
				requireInstalled = TireRearLeft,
			}
		}

		part TireRearRight
		{
			table uninstall
			{
				requireUninstalled = WheelChainRearRight,
				recipes = Basic Mechanics,
			}

			model InflatedTirePlusWheel
			{
				file = Rotators.TrailerVanRearWheelRight,
				offset = 0.0000 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}

			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = 0.0 0.0000 0.0000,
				rotate = 0.0000 0.0000 0.0000,
			}
		}

		part WheelChainRearRight
		{
			parent = TireRearRight,
			area = TireRearRight,
			table install
			{
				requireInstalled = TireRearRight,
			}
			table uninstall
			{
				requireInstalled = TireRearRight,
			}
		}

		part WheelChain*
		{
			mechanicRequireKey = false,
			repairMechanic = true,
			category = tire,
			itemType = Base.SemiTruckArmorTires_Item,
			table install
			{
				complete = rSemiTruck.ATATuning.InstallComplete.IndividualWheelProtection,
				items
				{
					1
					{
						tags = base:wrench,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 300,
				skills = Mechanics:1,
				recipes = Basic Mechanics,
				test = rSemiTruck.ATATuning.InstallTest.IndividualWheelProtection,
			}
			table uninstall
			{
				complete = rSemiTruck.ATATuning.UninstallComplete.IndividualWheelProtection,
				items
				{
					1
					{
						tags = base:wrench,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 300,
				skills = Mechanics:1,
				recipes = Basic Mechanics,
				test = rSemiTruck.ATATuning.UninstallTest.IndividualWheelProtection,
				requireEmpty = true,
			}
			lua
			{
				create = ATATuning.Create.Chance0,
				init = rSemiTruck.ATATuning.Init.IndividualWheelProtection,
				update = rSemiTruck.ATATuning.Update.IndividualWheelProtection,
			}
		}

		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 = Battery,

		part Battery
		{
			

			lua
			{
				create = Vehicles.Create.Battery,
				update = Vehicles.Update.Battery,
			}
		}

		template = Headlight/part/HeadlightRearLeft,
		template = Headlight/part/HeadlightRearRight,
		template = Suspension/part/SuspensionFrontLeft,
		template = Suspension/part/SuspensionFrontRight,
		template = Suspension/part/SuspensionRearLeft,
		template = Suspension/part/SuspensionRearRight,
		template = Rotators.SemiVanSpareTire/part/SpareTire,

		part SpareTire
		{
			model SpareTire
			{
				file = Rotators.TrailerVanSpareTire,
				rotate = 0.0000 0.0000 0.0000,
				scale = 1,
				offset = 0.0000 0.0000 0.0000,
			}
		}

		template = Rotators.SemiVanToolbox/part/TrunkToolbox,
		template = Rotators.SemiVanToolbox/part/ToolboxDoor,

		part ToolboxDoor
		{
			model ToolboxDoor
			{
				file = Rotators.TrailerVanToolbox,
				rotate = 0.0000 0.0000 0.0000,
				scale = 1,
				offset = 0.0000 0.0000 0.0000,
			}
		}
        area TireFrontLeft
        {
            xywh = 1.1619 0.0000 0.4522 0.5043,
        }

        area TireFrontRight
        {
            xywh = -1.1532 0.0087 0.4522 0.5043,
        }

        area TireRearLeft
        {
            xywh = 1.1619 -0.9826 0.4522 0.5043,
        }

        area TireRearRight
        {
            xywh = -1.1618 -0.9826 0.4522 0.5043,
        }

        area Toolbox
        {
            xywh = -1.1565 1.3478 0.5739 1.0957,
        }

        area SpareTire
        {
            xywh = 1.1565 1.3478 0.5739 1.0957,
        }
		useChassisPhysicsCollision = false,
        physics box
        {
            offset = 0.0000 1.7392 -1.2783,
            extents = 1.7826 2.6435 2.2000,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 1.9563 1.2087,
            extents = 1.7826 2.1913 2.7913,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 2.0609 3.9586,
            extents = 1.7826 1.9478 2.7043,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = -0.3621 0.5217 3.4522,
            extents = 0.0870 0.8696 0.0870,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.3621 0.5217 3.4522,
            extents = 0.0870 0.8696 0.0870,
            rotate = 0.0000 0.0000 0.0000,
        }
        attachment trailerTruck
        {
            offset = 0.0000 -0.4537 5.6435,
            rotate = 0.0000 0.0000 0.0000,
            canAttach = trailerTruck,
            updateconstraint = false,
        }
	}
}
