require "DAMN_Parts";
require "DAMN_Spawns";

--***********************************************************
--**                   KI5 / bikinihorst                   **
--***********************************************************

DAMN.Parts:processConfigV2("SUB87", {
	["BumperFront"] = {
		partId = "DAMNBumperFront",
		itemToModel = {
			["Base.3rdGenChevyCKseriesBumperFront0"] = "FrontBumper0",
			["Base.3rdGenChevyCKseriesBumperFront1"] = "FrontBumper1",
			["Base.86chevyCUCVBullbarFrontA"] = "FrontBullbarA",
		},
		default = "trve_random",
		noPartChance = 15,
	},
	["BumperFrontCUCV"] = {
		partId = "DAMNBumperFront",
		itemToModel = {
			["Base.3rdGenChevyCKseriesBumperFront0"] = "FrontBumper0",
			["Base.3rdGenChevyCKseriesBumperFront1"] = "FrontBumper1",
			["Base.86chevyCUCVBullbarFrontA"] = "FrontBullbarA",
		},
		default = "86chevyCUCVBullbarFrontA",
	},
	["BumperRear"] = {
		partId = "DAMNBumperRear",
		itemToModel = {
			["Base.3rdGenChevyCKseriesBumperRear0"] = "RearBumper0",
		},
		default = "trve_random",
		noPartChance = 5,
	},
	["WindowFrontLeftArmor"] = {
		partId = "DAMNFrontLeftArmor",
		itemToModel = {
			["Base.87chevySuburbanFrontWindowArmor"] = "SUB87leftWindowa",
		},
	},
	["WindowFrontRightArmor"] = {
		partId = "DAMNFrontRightArmor",
		itemToModel = {
			["Base.87chevySuburbanFrontWindowArmor"] = "SUB87rightWindowa",
		},
	},
	["WindowRearLeftArmor"] = {
		partId = "DAMNRearLeftArmor",
		itemToModel = {
			["Base.87chevySuburbanRearWindowArmor"] = "SUB87leftWindowra",
		},
	},
	["WindowRearRightArmor"] = {
		partId = "DAMNRearRightArmor",
		itemToModel = {
			["Base.87chevySuburbanRearWindowArmor"] = "SUB87rightWindowra",
		},
	},
	["WindowBackLeftArmor"] = {
		partId = "DAMNBackLeftArmor",
		itemToModel = {
			["Base.87chevySuburbanBackWindowArmor"] = "SUB87leftWindowba",
		},
	},
	["WindowBackRightArmor"] = {
		partId = "DAMNBackRightArmor",
		itemToModel = {
			["Base.87chevySuburbanBackWindowArmor"] = "SUB87rightWindowba",
		},
	},
	["WindshieldArmor"] = {
		partId = "DAMNWindshieldArmor",
		itemToModel = {
			["Base.87chevySuburbanWindshieldArmor"] = "SUB87winda",
		},
	},
	["WindshieldRearArmor"] = {
		partId = "DAMNWindshieldRearArmor",
		itemToModel = {
			["Base.87chevySuburbanWindshieldRearArmor"] = "SUB87windra",
		},
	},
	["SideSteps"] = {
		partId = "DAMNSideSteps",
		itemToModel = {
			["Base.3rdGenChevyCKseriesSideSteps2"] = "SideSteps0",
		},
		default = "trve_random",
		noPartChance = 50,
	},
	["Roofrack"] = {
		partId = "SUB87Roofrack",
		itemToModel = {
			["Base.87chevySuburbanRoofrack2"] = "Roofrack0",
		},
		default = "trve_random",
		noPartChance = 75,
	},
	["RoofLights"] = {
		partId = "SUB87RoofLights",
		itemToModel = {
			["Base.87chevySuburbanRoofLights2"] = "SUB87RoofLights0",
		},
		default = "trve_random",
		noPartChance = 50,
	},
    ["TireFrontLeft"] = {
		partId = "TireFrontLeft",
		itemToModel = {
			["Base.87chevySuburbanTire2"] = "SUB87Tire0",
            ["Base.76chevyKseriesTire2"] = "SUB87Tire1",
            ["Base.80chevyCKseriesTire2"] = "SUB87Tire2",
            ["Base.80chevyCKseriesTire1"] = "SUB87Tire3",
            ["Base.90chevyCKseriesTire2"] = "SUB87Tire4",
            ["Base.90chevyCKseriesTire1"] = "SUB87Tire5",
            ["damnCraft.SmallTire2"] = "SUB87Tire6",
		},
	},
	["TireFrontRight"] = {
		partId = "TireFrontRight",
		itemToModel = {
			["Base.87chevySuburbanTire2"] = "SUB87Tire0",
            ["Base.76chevyKseriesTire2"] = "SUB87Tire1",
            ["Base.80chevyCKseriesTire2"] = "SUB87Tire2",
            ["Base.80chevyCKseriesTire1"] = "SUB87Tire3",
            ["Base.90chevyCKseriesTire2"] = "SUB87Tire4",
            ["Base.90chevyCKseriesTire1"] = "SUB87Tire5",
            ["damnCraft.SmallTire2"] = "SUB87Tire6",
		},
	},
	["TireRearLeft"] = {
		partId = "TireRearLeft",
		itemToModel = {
			["Base.87chevySuburbanTire2"] = "SUB87Tire0",
            ["Base.76chevyKseriesTire2"] = "SUB87Tire1",
            ["Base.80chevyCKseriesTire2"] = "SUB87Tire2",
            ["Base.80chevyCKseriesTire1"] = "SUB87Tire3",
            ["Base.90chevyCKseriesTire2"] = "SUB87Tire4",
            ["Base.90chevyCKseriesTire1"] = "SUB87Tire5",
            ["damnCraft.SmallTire2"] = "SUB87Tire6",
		},
	},
	["TireRearRight"] = {
		partId = "TireRearRight",
		itemToModel = {
			["Base.87chevySuburbanTire2"] = "SUB87Tire0",
            ["Base.76chevyKseriesTire2"] = "SUB87Tire1",
            ["Base.80chevyCKseriesTire2"] = "SUB87Tire2",
            ["Base.80chevyCKseriesTire1"] = "SUB87Tire3",
            ["Base.90chevyCKseriesTire2"] = "SUB87Tire4",
            ["Base.90chevyCKseriesTire1"] = "SUB87Tire5",
            ["damnCraft.SmallTire2"] = "SUB87Tire6",
		},
	},
    ["SpareTire"] = {
		partId = "DAMNSpareTire",
		itemToModel = {
            ["Base.87chevySuburbanTire2"] = "Spare0",
            ["Base.76chevyKseriesTire2"] = "Spare1",
            ["Base.80chevyCKseriesTire2"] = "Spare2",
            ["Base.80chevyCKseriesTire1"] = "Spare3",
            ["Base.90chevyCKseriesTire2"] = "Spare4",
            ["Base.90chevyCKseriesTire1"] = "Spare5",
            ["Base.86chevyCUCVTire1"] = "Spare6",
            ["Base.86chevyCUCVTire2"] = "Spare7",
            ["damnCraft.SmallTire2"] = "Spare8",
		},
	},
});

DAMN.Parts:processConfigV2("CUCV87", {
    ["TireFrontLeft"] = {
		partId = "TireFrontLeft",
		itemToModel = {
			["Base.86chevyCUCVTire1"] = "Tire1",
            ["Base.86chevyCUCVTire2"] = "Tire2",
		},
	},
	["TireFrontRight"] = {
		partId = "TireFrontRight",
		itemToModel = {
			["Base.86chevyCUCVTire1"] = "Tire1",
            ["Base.86chevyCUCVTire2"] = "Tire2",
		},
	},
	["TireRearLeft"] = {
		partId = "TireRearLeft",
		itemToModel = {
			["Base.86chevyCUCVTire1"] = "Tire1",
            ["Base.86chevyCUCVTire2"] = "Tire2",
		},
	},
	["TireRearRight"] = {
		partId = "TireRearRight",
		itemToModel = {
			["Base.86chevyCUCVTire1"] = "Tire1",
            ["Base.86chevyCUCVTire2"] = "Tire2",
		},
	},
});

function SUB87.ContainerAccess.SideStorage(vehicle, part, chr)
	if chr:getVehicle() then return false end
	if not vehicle:isInArea(part:getArea(), chr) then return false end
	return true
end