wheelMode = {};

function wheelMode.prerequisitesPresent(specializations)
	return true;
end;

function wheelMode:load(xmlFile)
    self.changeSteer = SpecializationUtil.callSpecializationsFunction("changeSteer");
    self.changeWheel =0;
end;

function wheelMode:delete()
end;

function wheelMode:loadFromAttributesAndNodes(xmlFile, key, resetVehicles)  
   if not resetVehicles then
       self.changeWheel = Utils.getNoNil(getXMLFloat(xmlFile, key.."#steer"),0);
    end;
    return BaseMission.VEHICLE_LOAD_OK;
end;

function wheelMode:getSaveAttributesAndNodes(nodeIdent)
   local attributes = ' steer="'..tonumber(self.changeWheel)..'"';
   return attributes, nil;
end;

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

function wheelMode:keyEvent(unicode, sym, modifier, isDown)
end;

function wheelMode:update(dt)
	if InputBinding.hasEvent(InputBinding.JCB526_56_wheelModeChange) and self:getIsActiveForInput() then
			self.changeWheel = self.changeWheel +1 ;
	end; 
    if self.changeWheel == 0  then
             self:changeSteer(35, -35, 35, 35, -35, 35, 35, -35, -35, 35, -35, -35)
          elseif self.changeWheel == 1 then
             self:changeSteer(35, -35, 35, 35, -35, 35, 0, 0, 0, 0, 0, 0)		  
          elseif self.changeWheel == 2 then
             self:changeSteer(35, -35, 35, 35, -35, 35, 35, -35, 35, 35, -35, 35)
          elseif self.changeWheel == 3 then
             self.changeWheel = 0;
    end;  
end;

function wheelMode:draw()
		g_currentMission:addHelpButtonText(g_i18n:getText("JCB526_56_wheelModeChange"), InputBinding.JCB526_56_wheelModeChange);
end;

function wheelMode:changeSteer(wheel1min,wheel1max, wheel1speed, wheel2min, wheel2max,wheel2speed, wheel3min, wheel3max,wheel3speed, wheel4min, wheel4max, wheel4speed)
        self.wheels[1].rotMax = Utils.degToRad(wheel1min);
        self.wheels[2].rotMax = Utils.degToRad(wheel2min);
        self.wheels[1].rotMin = Utils.degToRad(wheel1max);
        self.wheels[2].rotMin = Utils.degToRad(wheel2max);   
        self.wheels[3].rotMax = Utils.degToRad(wheel3min);
        self.wheels[4].rotMax = Utils.degToRad(wheel4min);
        self.wheels[3].rotMin = Utils.degToRad(wheel3max);
        self.wheels[4].rotMin = Utils.degToRad(wheel4max); 
        self.wheels[1].rotSpeed = Utils.degToRad(wheel1speed);
        self.wheels[2].rotSpeed = Utils.degToRad(wheel2speed);
        self.wheels[3].rotSpeed = Utils.degToRad(wheel3speed);
        self.wheels[4].rotSpeed = Utils.degToRad(wheel4speed);       
end;





