/* Это шаблон палатки для крыши автомобиля. Фактически, роль палатки выполняют изолированные сиденья. По-умолчанию, предполагается изолировать средние сиденья. Для установке в автомобиль палатки, в скрипт необходимо вписать строку:
This is a car roof tent template. The insulated seats actually act as the tent. By default, the middle seats are insulated. To install the tent in the car, add the following line to the script:
    template = ATA2RoofTent/part/ATA2RoofTent,
Спавн палатки (предмет ATARoofTentItem) уже настроен в моде. Однако, вы можете создать свой предмет и переопределить его в шаблоне, тогда спавн необходимо будет настраивать самостоятельно.
Для отключения части функций в радиальном меню автомобиля, при нахождении игрока в палатке, служат шаблоны "InRoofTent + *название сиденья*".
Для импортирования готового шаблона палатки, в котором изолированы средние сиденья и отключены лишние функции радиального меню, необходимо использовать строку:
The tent spawn (ATARoofTentItem) is already configured in the mod. However, you can create your own item and override it in the template, in which case you'll need to configure the spawn yourself.
To disable some of the functions in the car's radial menu when the player is in a tent, use the "InRoofTent + *seat name*" templates.
To import a pre-built tent template with the middle seats isolated and unnecessary radial menu features disabled, use the line:
    template! = ATARoofMiddleTent,
Внимание! Строка должна быть добавлена после стандартного "ванильного" шаблона с пассажирами и шаблонов с сиденьями.
Important! This line must be added after the standard "vanilla" passenger template and the seat templates.

Палатка предполагает три типа 3д-моделей: "Default" - общая рама, "Open" - открытая палатка, "Close" - закрытая палатка. Модель "Default" - не обязательна.
Зд-модели должны быть переопределены в скрипте вашего автомобиля. Так же, в ходе этого процесса, вам следуем самостоятельно указать части автомобиля, обязательные для установки/снятия палатки. Пример переопределения:
The tent comes with three 3D model types: "Default" (general frame), "Open" (open tent), and "Close" (closed tent). The "Default" model is optional.
3D models must be redefined in your vehicle's script. During this process, you should also manually specify the vehicle parts required for installing and removing the tent. Example of redefinition:

    part ATARoofTent
    {
        model Default
        {
            file = ATA_Jeep_palatka_base,
        }
        model Open
        {
            file = ATA_Jeep_palatka_open,
        }
        model Close
        {
            file = ATA_Jeep_palatka_closed,
        }
        table install
        {
            requireInstalled = ATARoofBase,
            requireUninstalled = ATARoofRackFirst,
        }
    }
*/

module ATA2
{
    item ATASleepingBag
    {
        Weight   = 1.0,
        ItemType = base:normal,
        Icon     = ATASleepingBag,
        ChanceToSpawnDamaged = 0,
        ConditionMax = 100,
        MechanicsItem = TRUE,
    }
    
}

module Base
{    
    template vehicle ATA2RoofTent
    {
        part ATA2RoofTent
        {
/*            itemType = Base.CampingTentKit2;Base.ImprovisedTentKit;Base.HideTent;Base.TentYellow;Base.TentBlue;Base.TentBrown;Base.TentGreen,*/
            itemType = Base.LightBulb,
            container
            {
                capacity = 30,
                test = ATATuning2.ContainerAccess.RoofTent,
            }
            area = TruckBed,
            category = nodisplay,
            specificItem = false,
            mechanicRequireKey = false,
            repairMechanic = false,
            setAllModelsVisible = false,
            
            table install
            {
                test = ATATuning2.InstallTest.Tuning,
                complete = ATATuning2.InstallComplete.RoofTent,
            }
            table uninstall
            {
                test = ATATuning2.UninstallTest.RoofTent,
                complete = ATATuning2.UninstallComplete.Tuning,
            }
            lua
            {
                create = ATATuning2.Create.Tuning,
                init = ATATuning2.Init.RoofTent,
                use = ATATuning2.Use.RoofTent,
            }
        }
        
        part InRoofTentFrontLeft
        {
            area = SeatFrontLeft,
        }
        part InRoofTentFrontRight
        {
            area = SeatFrontRight,
        }
        part InRoofTentMiddleLeft
        {
            area = SeatMiddleLeft,
        }
        part InRoofTentMiddleRight
        {
            area = SeatMiddleRight,
        }
        part InRoofTentRearLeft
        {
            area = SeatRearLeft,
        }
        part InRoofTentRearRight
        {
            area = SeatRearRight,
        }
        part InRoofTent*
        {
            category = nodisplay,
        }
    }
    
    template vehicle ATA2RoofMiddleTentSetting
    {
        template = ATARoofTent/part/InRoofTentMiddleLeft,
        template = ATARoofTent/part/InRoofTentMiddleRight,
        template = Mattresses/part/MattressMiddleLeft,
        template = Mattresses/part/MattressMiddleRight,
        passenger FrontLeft
        {
            switchSeat MiddleLeft
            {
            }

            switchSeat MiddleRight
            {
            }
        }

        passenger FrontRight
        {
            switchSeat MiddleLeft
            {
            }

            switchSeat MiddleRight
            {
            }
        }

        passenger MiddleLeft
        {
            switchSeat FrontLeft
            {
            }

            switchSeat FrontRight
            {
            }

            switchSeat RearLeft
            {
            }

            switchSeat RearRight
            {
            }
        }

        passenger MiddleRight
        {    
            switchSeat FrontLeft
            {
            }

            switchSeat FrontRight
            {
            }

            switchSeat RearLeft
            {
            }

            switchSeat RearRight
            {
            }
        }
    
        passenger RearLeft
        {
            switchSeat MiddleLeft
            {
            }

            switchSeat MiddleRight
            {
            }
        }

        passenger RearRight
        {
            switchSeat MiddleLeft
            {
            }

            switchSeat MiddleRight
            {
            }
        }
        template = Seat/part/SeatMiddleLeft,
        template = Seat/part/SeatMiddleRight,
        part SeatMiddleLeft
        {
            category = nodisplay,
        }
        part SeatMiddleRight
        {
            category = nodisplay,
        }
        template = Door/part/DoorMiddleRight,
        template = Door/part/DoorMiddleLeft,
        part DoorMiddle*
        {
            category = nodisplay,
            anim Open
            {
                sound = OpenBag,
            }
            anim Close
            {
                sound = CloseBag,
            }
            anim Lock
            {
                sound = PutItemInBag,
            }
            anim Unlock
            {
                sound = PutItemInBag,
            }
            anim IsLocked
            {
                sound = PutItemInBag,
            }
            lua
            {
                create = ATATuning2.Create.Unlock,
            }

        }
    
        template = Window/part/WindowMiddleRight,
        template = Window/part/WindowMiddleLeft,
        part WindowMiddle*
        {
            category = nodisplay,
        }
        
        part SeatMiddle*
        {
            category = nodisplay,
            itemType = ATA2.ATASleepingBag,
            specificItem = false,
            container
            {
                test = ATATuning2.ContainerAccess.BlockSeat,
            }
            lua
            {
                create = ATATuning2.Create.Tuning,
            }
        }
    }
}