
moveAttacher = {};

function moveAttacher.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;

function moveAttacher:load(xmlFile)

	self.moveableAttacher = {};
	self.moveableAttacher.index = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.moveableAttacher#index"));
	self.moveableAttacher.max = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.moveableAttacher#maxY"), 0); 
	self.moveableAttacher.min = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.moveableAttacher#minY"), 0); 
	
end;

function moveAttacher:delete()
end;

function moveAttacher:mouseEvent(posX, posY, isDown, isUp, button)
end;

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

end;

function moveAttacher:update(dt)

	if self.moveableAttacher ~= nil then
		local xAttacher, yAttacher, zAttacher = getTranslation(self.moveableAttacher.index);
		local maxY = self.moveableAttacher.max;
		local minY = self.moveableAttacher.min;
		local moveSpeed = 0.0055;
			if InputBinding.isPressed(InputBinding.ATTACHER_UP) then
				if yAttacher < maxY then
					yAttacher = yAttacher + moveSpeed;
				else
					yAttacher = maxY;
				end;
			elseif InputBinding.isPressed(InputBinding.ATTACHER_DOWN) then
				if yAttacher > minY then
					yAttacher = yAttacher - moveSpeed;
				else
					yAttacher = minY;
				end;
			end;
		setTranslation(self.moveableAttacher.index, xAttacher, yAttacher, zAttacher);
	end;
				
end;

function moveAttacher:onLeave()

end;

function moveAttacher:draw()

end;

function moveAttacher:validateAttacherJoint(implement, jointDesc, dt)
    return true;
end;

