module Rotators
{
   /* Wheels 4 Axle */
	
	template vehicle SemiTruckBoxTemplate
	{
		template! = Rotators.SemiTruckTemplate,
        model
        {
            file = Rotators.SemiTruckBoxBase,
            scale = 1.1400,
            offset = 0.0000 0.6579 0.0038,
        }
		mass = 750,

        extents = 1.9123 2.5789 7.1930,
        physicsChassisShape = 1.7895 2.5789 7.1754,
        centerOfMassOffset = 0.0000 0.9936 -0.5175,
        shadowExtents = 2.1924 6.0386,
        shadowOffset = 0.0000 0.0000,

		offRoadEfficiency = 0.75,
		engineForce = 4000,
		maxSpeed = 55,
		engineLoudness = 125,
		engineQuality = 85,

		brakingForce = 22,
		stoppingMovementForce = 4.0f,
		rollInfluence = 0.35f,
		steeringIncrement = 0.03,
		steeringClamp = 0.35,
		suspensionStiffness = 40,
		suspensionCompression = 3.83,
		suspensionDamping = 2.9,
		maxSuspensionTravelCm = 10.0,
		suspensionRestLength = 0.2,
		wheelFriction = 0.74,
        frontEndHealth = 750,
        rearEndHealth = 750,
		seats = 2,
		template = PassengerSeat2,

		passenger FrontLeft
		{
			position inside
			{
				offset = 0.3158 -0.0175 1.1316,
				rotate = 0.0000 0.0000 0.0000,
			}

			position outside
			{
				offset = 1.1491 -0.5526 0.9561,
				rotate = 0.0000 0.0000 0.0000,
				area = SeatFrontLeft,
			}
		}

		passenger FrontRight
		{
			position inside
			{
				offset = -0.3158 -0.0175 1.1316,
				rotate = 0.0000 0.0000 0.0000,
			}

			position outside
			{
				offset = -1.1228 -0.5526 0.9649,
				rotate = 0.0000 0.0000 0.0000,
				area = SeatFrontRight,
			}
		}
        area TruckBed
        {
            xywh = 0.0000 -4.2252 2.0000 1.2281,
        }

        area FreezerTruckBed
        {
            xywh = 0.0000 -4.2252 2.0000 1.2281,
        }

		part Freezersystem
		{
			area = TruckBed,
			specificItem = false,
			itemType = Base.TransportFreezerSystem,
			durability = 2,
			table install
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				},
				time = 450,
				door = EngineDoor,
				skills = Mechanics:2,
				recipes = Intermediate Mechanics,
				test = Vehicles.InstallTest.Default,
			}

			table uninstall
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				},
				time = 350,
				skills = Mechanics:2,
				recipes = Intermediate Mechanics,
				test = Vehicles.UninstallTest.Default,
                complete = ATATuning.UninstallComplete.DefaultModel,
			}	

		lua
            {
			create = ATATuning2.Create.Chance0,
            }

		}

		
		template = Trunk/part/TruckBed,
		template = Door/part/DoorRear,
		part TruckBed
		{
			itemType = Base.BigTrunk,
			durability = 10,

			container
			{
				conditionAffectsCapacity = true,
				capacity = 500,
			}
			lua
            {
				create = CommonTemplates.Create.VehicleFreezer,
				init = CommonTemplates.Init.VehicleFreezer,
                update = CommonTemplates.Update.VehicleFreezer,
			}
		}


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

			table install
			{
				recipes = Intermediate Mechanics,
			}

			table uninstall
			{
				recipes = Intermediate Mechanics,
			}

			anim Close
			{
				sound = GarageDoorClose,
				anim = Trunk_closing,
				rate = 1.0,
			}

			anim Open
			{
				sound = GarageDoorOpen,
				anim = Trunk_closing,
				reverse = TRUE,
				rate = 0.7,
			}

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

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

			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 = ArmorBullbar,
					condition = 15,
				}

				lua =
				{
					check = rSemiTruck.Event.DoorRearBullbarCheck,
					repair = rSemiTruck.Event.DoorRearBullbarRepair,
				}
			}
		}
		part Battery1
		{
			area = Engine,
			itemType = Base.CarBattery,
			mechanicRequireKey = true,
			category = engine,
			durability = 2,
			table install
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				professions = ,
				skills = ,
				traits = ,
				recipes = ,
				test = Vehicles.InstallTest.Default,
				door = EngineDoor,
			}
			table uninstall
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				test = Vehicles.UninstallTest.Battery,
				requireUnistalled = Battery2,
			}
			lua
			{
				update = Vehicles.Update.Battery,
			}
		}

		part Battery2
		{
			area = Engine,
			itemType = Base.CarBattery,
			mechanicRequireKey = true,
			category = engine,
			durability = 2,
			table install
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				professions = ,
				skills = ,
				traits = ,
				recipes = ,
				test = Vehicles.InstallTest.Default,
				door = EngineDoor,
				requireInstalled = Battery1,
			}
			table uninstall
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				test = Vehicles.UninstallTest.Battery,
				requireUnistalled = Battery3,
			}
			lua
			{
				update = Vehicles.Update.Battery,
			}
		}

		part Battery3
		{
			area = Engine,
			itemType = Base.CarBattery,
			mechanicRequireKey = true,
			category = engine,
			durability = 2,
			table install
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				professions = ,
				skills = ,
				traits = ,
				recipes = ,
				test = Vehicles.InstallTest.Default,
				door = EngineDoor,
				requireInstalled = Battery2,
			}
			table uninstall
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				test = Vehicles.UninstallTest.Battery,
				requireUnistalled = Battery3,
			}
			lua
			{
				update = Vehicles.Update.Battery,
			}
		}

		part Battery4
		{
			area = Engine,
			itemType = Base.CarBattery,
			mechanicRequireKey = true,
			category = engine,
			durability = 2,
			table install
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				professions = ,
				skills = ,
				traits = ,
				recipes = ,
				test = Vehicles.InstallTest.Default,
				door = EngineDoor,
				requireInstalled = Battery3,
			}
			table uninstall
			{
				items
				{
					1
					{
						tags = Screwdriver,
						count = 1,
						keep = true,
						equip = primary,
					}
				}
				time = 100,
				test = Vehicles.UninstallTest.Battery,
			}
			lua
			{
				update = Vehicles.Update.Battery,
			}
		}

		template = GloveBox,

		part GasTank
		{
			durability = 10,
			model GasTank
			{
				file = Rotators.SemiTruckBoxGasTank,
			}
		}

		area Engine
		{
			xywh = 0.0000 2.9000 3.4386 1.5965,
		}

        area SeatFrontLeft
        {
		  xywh = 1.2119 1.2684 0.4737 0.8246,
        }

        area SeatFrontRight
        {
		  xywh = -1.2119 1.2684 0.4737 0.8246,
        }

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

		area TireFrontLeft
		{
			xywh = 1.1842 2.5491 0.4211 0.4211,
		}

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

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

        area TireRearRight
        {
		  xywh = -1.1842 -2.4860 0.4211 0.4211,
        }

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

        area TireMiddleRight
        {
		  xywh = -1.1842 -1.4680 0.4211 0.4211,
        }

        useChassisPhysicsCollision = false,

        physics box
        {
            offset = 0.0000 0.2126 1.9000,
            extents = 1.4211 0.8772 2.4912,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 1.0170 1.2105,
            extents = 1.4211 0.7193 1.1404,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 0.5728 -1.7281,
            extents = 1.8070 1.6140 4.7193,
            rotate = 0.0000 0.0000 0.0000,
        }

        attachment trailer
        {
            offset = 0.0000 -0.6649 -4.1454,
            rotate = 0.0000 0.0000 0.0000,
            zoffset = -1.0000,
        }

        attachment trailerfront
        {
            offset = 0.0000 -0.8218 3.2475,
            rotate = 0.0000 0.0000 0.0000,
            zoffset = 1.0000,
        }
	}
}
