module Base
{
	vehicle SemiTrailerVanCattle
    {
        model
        {
            file = Rotators.TrailerVanBase,
            scale = 1.1500,
            offset = 0.0000 1.3217 0.2188,
        }

        skin
        {
            texture = Vehicles/Trailers_rVan_White_Cattle,
        }

        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,
        extents = 1.8087 1.3217 8.3478,
        physicsChassisShape = 1.8261 1.3391 8.3304,
        centerOfMassOffset = 0.0000 1.9826 2.2753,
        shadowExtents = 1.8266 8.5960,
        shadowOffset = 0.0000 2.3457,
        animalTrailerSize = 1850,
        mass = 465,
        brakingForce = 1,
        stoppingMovementForce = 2.5f,
        rollInfluence = 0.15f,
        suspensionStiffness = 40,
        suspensionCompression = 4.83,
        suspensionDamping = 3.88,
        maxSuspensionTravelCm = 15,
        suspensionRestLength = 0.16f,
        wheelFriction = 0.5f,
        frontEndHealth = 150,
        rearEndHealth = 150,
        seats = 2,
        template = Door/part/DoorRear,

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

            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,
            }

            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,
            }

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

        template = TrunkDoorOpened,
        template = Trunk/part/TrailerAnimalFood,

        part TrailerAnimalFood
        {
            container
            {
                capacity = 50,
            }
        }

        template = Trunk/part/TrailerAnimalEggs,

        part TrailerAnimalEggs
        {
            container
            {
                capacity = 50,
            }
        }

        wheel FrontLeft
        {
            front = false,
            offset = 0.6000 -0.9043 0.2696,
            radius = 0.40f,
            width = 0.90f,
        }

        wheel FrontRight
        {
            front = false,
            offset = -0.6000 -0.9043 0.2696,
            radius = 0.40f,
            width = 0.90f,
        }

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

        wheel RearRight
        {
            front = false,
            offset = -0.6000 -0.9043 -0.7130,
            radius = 0.40f,
            width = 0.90f,
        }

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

        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.0000 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.0000 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.0000 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.0000 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
        {
            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 = 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.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,
        }

        area TrailerAnimalFood
        {
            xywh = 0.0000 -2.2032 1.9130 0.6609,
        }

        area AnimalEntry
        {
            xywh = 0.0000 -2.3973 2.1043 1.2000,
        }

        template = SemiTruckTrailerCollision,
        attachment trailerTruck
        {
            offset = 0.0000 -0.4537 5.6435,
            rotate = 0.0000 0.0000 0.0000,
            canAttach = trailerTruck,
            updateconstraint = false,
        }
    }
}
