--
-- IndoorSound
-- Specialization for IndoorSound
--
-- @author  	Timber131 (TT-Modding)
-- @version 	v1.0
-- @date  		20/11/13
-- @history:	v1.0 - Initial version
--


SpecializationUtil.registerSpecialization("Selectable", "Selectable", g_currentModDirectory.."scripts/selectable.lua")

Register = {};

function Register:loadMap(name)
	if self.firstRun == nil then
		self.firstRun = false;
		
		for k, v in pairs(VehicleTypeUtil.vehicleTypes) do
			if v ~= nil then
				local allowInsertion = true;
				for i = 1, table.maxn(v.specializations) do
					local vs = v.specializations[i];
					if vs ~= nil and vs == SpecializationUtil.getSpecialization("steerable") then
						local v_name_string = v.name 
						local point_location = string.find(v_name_string, ".", nil, true)
						if point_location ~= nil then
							local _name = string.sub(v_name_string, 1, point_location-1);
							if rawget(SpecializationUtil.specializations, string.format("%s.Selectable", _name)) ~= nil then
								allowInsertion = false;
							end;
						end;
						if allowInsertion then
							table.insert(v.specializations, SpecializationUtil.getSpecialization("Selectable"));
						end;						
						
					end;
				end;
			end;	
		end;
	end;
end;

function Register:deleteMap()
  
end;

function Register:keyEvent(unicode, sym, modifier, isDown)

end;

function Register:mouseEvent(posX, posY, isDown, isUp, button)

end;

function Register:update(dt)
	
end;

function Register:draw()
  
end;

addModEventListener(Register);