module Base
{
	vehicle SemiTrailerVan
    {
        template! = Base.TrailerBase,

        skin
        {
            texture = Vehicles/Trailers_rVan_White,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_Black,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_Red,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_Blue,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_Green,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_Yellow,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_USMCgreen,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_CaspianBlue_magenta,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_CaspianBlue_amber,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_CaspianBlue_crimson,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_CaspianBlue_lime,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_CaspianBlue_hot_orange,
        }

        template = SemiTruckTrailerCollision,
    }
	template vehicle TrailerBase
	{

        model
        {
            file = Rotators.TrailerVanBase,
            scale = 1.1500,
            offset = 0.0000 1.3217 0.2231,
        }
		neverSpawnKey = true,
		mechanicType = 2,
		offRoadEfficiency = 1,
		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 = 400,


        extents = 1.9130 1.3217 8.3478,
        physicsChassisShape = 1.9130 1.9826 8.3304,
        centerOfMassOffset = 0.0000 1.9826 2.2822,
        shadowExtents = 1.8266 8.8221,
        shadowOffset = 0.0000 1.7796,

		brakingForce = 1,
		stoppingMovementForce = 2.0f,
		rollInfluence = 0.15f,
		steeringIncrement = 0.001f,
		steeringClamp = 0.3f,
		suspensionStiffness = 55,
		suspensionCompression = 2.83f,
		suspensionDamping = 2.88f,
		maxSuspensionTravelCm = 15,
		suspensionRestLength = 0.4f,
		wheelFriction = 0.5f,
		frontEndHealth = 650,
		rearEndHealth = 450,
		seats = 2,

		wheel FrontLeft
		{
			front = true,
			offset = 0.600 -0.9010 0.2673,
			radius = 0.40f,
			width = 2.0,
		}

		wheel FrontRight
		{
			front = true,
			offset = -0.600 -0.9010 0.2673,
			radius = 0.40f,
			width = 2.0,
		}

		wheel RearLeft
		{
			front = true,
			offset = 0.600 -0.9010 -0.7129,
			radius = 0.40f,
			width = 2.0,
		}

		wheel RearRight
		{
			front = true,
			offset = -0.600 -0.9010 -0.7129,
			radius = 0.40f,
			width = 2.0,
		}

		area TruckBed
		{
			xywh = 0.0000 -4.2475 3.3465 1.8020,
		}

		template = Rotators.DoubleTires,


		part TireFrontLeft
		{
			table uninstall
			{
				requireUninstalled = WheelChainFrontLeft,
				recipes = Basic Mechanics,
			}
			model InflatedTirePlusWheel
			{
				file = Rotators.TrailerVanFrontWheelLeft,
				rotate = 0 0 0,
			}
			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = -0.00 0 0,
				rotate = 0 0 0,
			}
		}

		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,
			}
			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = 0.0 0 0,
				rotate = 0 0 0,
			}
		}

		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,
			}
			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = -0.0 0 0,
				rotate = 0 0 0,
			}
		}

		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,
			}
			model ATAProtection
			{
				file = Rotators.SemiTruckArmorTireTrailer,
				offset = 0.00 0 0,
				rotate = 0 0 0,
			}
		}

		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 = Door/part/DoorRear,

		part DoorRear
		{
			model DoorRear
			{
				file = Rotators.TrailerVanTrunk,
				rotate = 0 0 0,
				scale = 1,
				offset = 0 0 0,
			}

			anim Close
			{
				sound = VehicleTrunkCloseStandard,
				anim = Trunk_closing,
				rate = 1.5,
			}

			anim Open
			{
				sound = VehicleTrunkOpenStandard,
				anim = Trunk_closing,
				reverse = TRUE,
				rate = 0.75,
			}

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

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

			lua
			{
				create = Vehicles.Create.TrunkDoorOpen,
				init = Vehicles.Init.Door,
				update = Vehicles.Update.TrunkDoor,
				use = Vehicles.Use.TrunkDoor,
			}

			mechanicRequireKey = false,

			anim ActorOpen
			{
				anim = WindowOpenSuccess,
				rate = 0.15,
				angle = 0.0 0.0 0.0,
			}

			anim ActorClose
			{
				anim = Attack_Shove,
				rate = 0.3,
				angle = 0.0 0.0 0.0,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,

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

				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

      template = Battery,
		part Battery
		{
         category = nodisplay,
			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 = Trunk/part/TruckBed,
		template = Rotators.SemiTrailerArmor/part/ArmorTrailerVan,
		part TruckBed
		{
			echanicRequireKey = false,
			durability = 10,
			container
			{
				conditionAffectsCapacity = true,
				capacity = 1500,
			}
			table armor
			{
				logic = RotatorsLib,
				condition = 100,

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

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

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

				lua =
				{
					repair = rSemiTruck.Event.PostAutoRepair,
				}
			}
		}

		template = Rotators.SemiVanSpareTire/part/SpareTire,

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

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

		part ToolboxDoor
		{
			model ToolboxDoor
			{
				file = Rotators.TrailerVanToolbox,
				rotate = 0 0 0,
				scale = 1,
				offset = 0 0 0,
			}
		}
		useChassisPhysicsCollision = false,
        area TireFrontLeft
        {
            xywh = 1.1826 0.4969 0.4522 0.5043,
        }

        area TireFrontRight
        {
            xywh = -1.1913 0.5011 0.4522 0.5043,
        }

        area TireRearLeft
        {
            xywh = 1.1826 -0.4931 0.4522 0.5043,
        }

        area TireRearRight
        {
            xywh = -1.1826 -0.4902 0.4522 0.5043,
        }

        area TruckBed
        {
            xywh = 0.0000 -2.6087 1.9130 0.6609,
        }

        area Toolbox
        {
            xywh = -1.2435 1.8229 0.5739 1.0957,
        }

        area SpareTire
        {
            xywh = 1.1565 1.8200 0.5739 1.0957,
        }
        attachment trailerTruck
        {
            offset = 0.0000 -0.5531 5.6435,
            rotate = 0.0000 0.0000 0.0000,
            canAttach = trailerTruck,
            updateconstraint = false,
        }
	}
}
