module Base
{
    model ATARoofLightWorld
    {
        mesh = WorldItems/ATA_MiddleLigts,
        texture = WorldItems/ATA_Common_items,
        scale = 0.04,
    }
    
    item ATARoofLightItem /* Спавн */ 
    {
        Weight    =    1.0,
        Type    =    Normal,
        DisplayName    = ATARoofLightItem,
        Icon    =    ATARoofLightItem,
        ChanceToSpawnDamaged = 25,
        ConditionMax = 100,
        MechanicsItem = TRUE,
        Tooltip = Tooltip_item_tuning,
        WorldStaticModel = ATARoofLightWorld,
    }
    
    template vehicle ATARoofLights
    {
        part ATARoofLightFront
        {
            area = Engine,
            table uninstall
            {
                requireUninstalled = ATARoofLampFront,
            }
        }
        
        part ATARoofLightLeft
        {
            area = SeatFrontLeft,
            table uninstall
            {
                requireUninstalled = ATARoofLampLeft,
            }
        }

        part ATARoofLightRight
        {
            area = SeatFrontRight,
            table uninstall
            {
                requireUninstalled = ATARoofLampRight,
            }
        }

        part ATARoofLightRear
        {
            area = TruckBed,
            table uninstall
            {
                requireUninstalled = ATARoofLampRear,
            }
        }

        part ATARoofLight*
        {
            category = lights,
            specificItem = false,
            itemType = Base.ATARoofLightItem,
            mechanicRequireKey = false,
            table install
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
                test = ATATuning.InstallTest.multiRequire,
            }
            table uninstall
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
                test = ATATuning.UninstallTest.multiRequire,
            }
            lua
            {
                create = ATATuning.Create.Chance0,
                init = Vehicles.Init.Headlight,
            }
        }
        
        part ATARoofLampFront
        {
            area = Engine,
            table install
            {
                requireInstalled = ATARoofLightFront,
            }
        }
        
        part ATARoofLampLeft
        {
            area = SeatFrontLeft,
            table install
            {
                requireInstalled = ATARoofLightLeft,
            }
        }

        part ATARoofLampRight
        {
            area = SeatFrontRight,
            table install
            {
                requireInstalled = ATARoofLightRight,
            }
        }

        part ATARoofLampRear
        {
            area = TruckBed,
            table install
            {
                requireInstalled = ATARoofLightRear,
            }
        }

        part ATARoofLamp*
        {
            category = lights,
            specificItem = false,
            itemType = Base.LightBulb,
            mechanicRequireKey = false,
            table install
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
                test = ATATuning.InstallTest.multiRequire,
            }
            table uninstall
            {
                items
                {
                    1
                    {
                        type = Base.Screwdriver,
                        count = 1,
                        keep = true,
                        equip = primary,
                    }
                }
                time = 100,
                test = ATATuning.UninstallTest.multiRequire,
            }
            lua
            {
                create = ATATuning.Create.ATALight,
                init = Vehicles.Init.Headlight,
                update = Vehicles.Update.Headlight,
            }
        }
    }
}