module Base
{
	model cobbM540Base
	{
		mesh = vehicles/Vehicles_cobbM540_Body|m540_body,
		shader = damn_vehicle_noreflect_shader,
		scale = 0.1,
	}
	model cobbM540Interior
	{
		mesh = vehicles/Vehicles_cobbM540_Body|m540_interior,
		texture = vehicles/Vehicles_cobbM540_Interior,
		shader = damn_wheel_shader,
		scale = 0.1,
	}
	model cobbM540BatteryTIS
	{
		mesh = vehicles/Vehicles_cobbM540_Body|TIS_CarBattery,
		texture = Vehicles/Vehicles_cobbM540_Interior,
		shader = damn_wheel_shader,
		scale = 0.1,
	}
	vehicle cobbM540
    {
        mechanicType = 2,
        offRoadEfficiency = 4,
        engineRepairLevel = 4,
        playerDamageProtection = 1.2,
        engineRPMType = van,

        model
        {
            file = cobbM540Base,
            scale = 0.9000,
            offset = 0.0000 0.6111 0.0000,
        }

        spawnOffsetY = 0,

        skin
        {
            texture = Vehicles/Vehicles_cobbM540_Shell,
        }

        textureRust = Vehicles/Vehicles_cobbM540_Rust,
        textureMask = Vehicles/Vehicles_cobbM540_Mask,
        textureLights = Vehicles/Vehicles_cobbM540_Lights,
        textureDamage1Shell = Vehicles/Vehicles_cobbM540_Shell_Damage1,
        textureDamage2Shell = Vehicles/Vehicles_cobbM540_Shell_Damage2,
        textureDamage1Overlay = Vehicles/Vehicles_cobbM540_Blood1,
        textureDamage2Overlay = Vehicles/Vehicles_cobbM540_Blood1,
        textureShadow = Vehicles/Vehicles_cobbM540_Shadow,

        sound
        {
            engine = VehicleEngineSUV,
            engineStart = VehicleEngineSUV,
            engineTurnOff = VehicleEngineSUV,
            horn = VehicleHornStandard,
            ignitionFail = VehicleIgnitionFailSUV,
        }

        extents = 2.8889 1.4889 6.1778,
        mass = 1050,
        physicsChassisShape = 2.8889 1.4889 6.1778,
        centerOfMassOffset = 0.0000 0.7444 0.7889,
        shadowExtents = 3.8436 6.2509,
        shadowOffset = 0.0000 0.7759,
        engineForce = 5000,
        maxSpeed = 55f,
        engineLoudness = 60,
        engineQuality = 90,
        gearRatioCount = 4,
        gearRatioR = 4,
        gearRatio1 = 4,
        gearRatio2 = 3,
        gearRatio3 = 2.5,
        gearRatio4 = 1.0,
        brakingForce = 50,
        stoppingMovementForce = 4.0f,
        rollInfluence = 0.50f,
        steeringIncrement = 0.02,
        steeringClamp = 0.2,
        suspensionStiffness = 37,
        suspensionCompression = 3.83,
        suspensionDamping = 2.88,
        maxSuspensionTravelCm = 12,
        suspensionRestLength = 0.5,
        wheelFriction = 2.0f,
        frontEndHealth = 3500,
        rearEndHealth = 3000,
        seats = 6,

        wheel FrontLeft
		{
			front = true,
			offset = 1.3444 -0.4444 1.6000,
			radius = 0.73f,
			width = 0.42f,
		}

		wheel FrontRight
		{
			front = true,
			offset = -1.3444 -0.4444 1.6000,
			radius = 0.73f,
			width = 0.42f,
		}

		wheel RearLeft
		{
			front = false,
			offset = 1.5333 -0.4444 -1.5556,
			radius = 0.73f,
			width = 0.42f,
		}

		wheel RearRight
		{
			front = false,
			offset = -1.5333 -0.4444 -1.5556,
			radius = 0.73f,
			width = 0.42f,
		}

        template = M540Passengers,

        passenger FrontLeft
        {
            position inside
            {
                offset = 0.4667 -0.1778 1.8333,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.7778 -1.1222 -0.5000,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        passenger FrontRight
        {
            position inside
            {
                offset = -0.3889 -0.0444 1.1778,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.8000 -1.1556 -0.2111,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        passenger Crew1
        {
            position inside
            {
                offset = 0.6889 -0.0333 0.3222,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.8333 -1.1556 0.1000,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        passenger Crew2
        {
            position inside
            {
                offset = 0.2889 -0.0333 -0.3778,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.8333 -1.1556 0.1000,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        passenger Crew3
        {
            position inside
            {
                offset = -0.1667 -0.0333 -0.3778,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.8333 -1.1556 0.1000,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        passenger Crew4
        {
            position inside
            {
                offset = -0.6778 -0.0333 -0.3778,
                rotate = 0.0000 0.0000 0.0000,
            }

            position outside
            {
                offset = -1.8333 -1.1556 0.1000,
                rotate = 0.0000 0.0000 0.0000,
                area = SeatRearRight,
            }
        }

        area Engine
        {
            xywh = 1.8333 0.2000 0.7778 1.1111,
        }

        area SeatFrontLeft
        {
            xywh = 1.8333 3.1333 0.7778 1.1111,
        }

        area SeatRearRight
        {
            xywh = -2.0000 0.0889 1.1111 1.3333,
        }

        area GasTank
        {
            xywh = 2.0111 -0.1444 0.4222 0.4222,
        }

        area TireFrontLeft
        {
            xywh = 2.1556 1.6333 0.4222 0.4222,
        }

        area TireFrontRight
        {
            xywh = -2.1556 1.6333 0.4222 0.4222,
        }

        area TireRearLeft
        {
            xywh = 2.2222 -1.5000 0.4222 0.4222,
        }

        area TireRearRight
        {
            xywh = -2.2222 -1.5000 0.4222 0.4222,
        }

        template = M540Tires,
        template = runFlatTires,
        template = centralTireInflation,
        template = M540TrunkCompartment,
        template = M540GunCab,
        template = M540Seats,

        part GloveBox
        {
            model M540Interior
            {
                file = cobbM540Interior,
                offset = 0.0000 0.0000 0.0000,
                rotate = 0.0000 0.0000 0.0000,
            }

            area = SeatFrontRight,
            itemType = Base.GloveBox,
            mechanicRequireKey = true,

            container
            {
                capacity = 10,
                test = Vehicles.ContainerAccess.GloveBox,
            }

            lua
            {
                create = Vehicles.Create.Default,
            }
        }

        template = GasTank,

        part GasTank
        {
            container
            {
                conditionAffectsCapacity = false,
                capacity = 150,
            }

            install
            {
                skills = Mechanics:4,
                recipes = Intermediate Mechanics,
            }

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

        template = Battery,

        part Battery
        {
            model M540bat
            {
                file = cobbM540BatteryTIS,
                offset = 0.0000 0.0000 0.0000,
                rotate = 0.0000 0.0000 0.0000,
            }
        }

        template = Engine,
        template = Muffler,

        part Muffler
        {
            table install
            {
                recipes = Intermediate Mechanics,
            }

            table uninstall
            {
                recipes = Intermediate Mechanics,
            }
        }

        template = M540Hood,

        part Heater
        {
            category = engine,

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

        part PassengerCompartment
        {
            category = nodisplay,

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

        template = M540Windshield,
        template = M540Doors,
        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 = Radio_HAM,
        template = M540Headlights,
        template = M540Windshield,
        template = DAMNglobal,
		template = DAMNcobbM540,
		useChassisPhysicsCollision = false,

        physics box
        {
            offset = 0.0000 0.5667 0.2000,
            extents = 3.1778 1.1333 4.2889,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 1.5000 0.5577 -1.5556,
            extents = 0.6000 1.1111 1.4889,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = -1.4982 0.5556 -1.5556,
            extents = 0.6000 1.1111 1.4889,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 0.3606 3.1111,
            extents = 1.6667 0.6667 1.5333,
            rotate = 0.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = -0.8111 0.3553 3.0444,
            extents = 0.5111 0.6667 1.6000,
            rotate = 0.0000 16.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 0.7000 2.9012,
            extents = 1.6667 0.4667 1.3333,
            rotate = 19.0000 0.0000 0.0000,
        }

        physics box
        {
            offset = 0.8111 0.3587 3.0444,
            extents = 0.5111 0.6667 1.6000,
            rotate = 0.0000 -16.0000 0.0000,
        }

        physics box
        {
            offset = 0.0000 1.2976 0.0000,
            extents = 1.8667 0.3333 2.2444,
            rotate = 0.0000 0.0000 0.0000,
        }

        attachment trailer
        {
            offset = 0.0000 -0.4778 -1.9889,
            rotate = 0.0000 0.0000 0.0000,
            zoffset = -1.0000,
        }

        attachment trailerfront
        {
            offset = 0.0000 -0.4778 4.0444,
            rotate = 0.0000 0.0000 0.0000,
            zoffset = 1.0000,
        }
    }
}
