Roue = {};

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

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

function Roue: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 Roue:getSaveAttributesAndNodes(nodeIdent)
   local attributes = ' steer="'..tonumber(self.changeWheel)..'"';
   return attributes, nil;
end;

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

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

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

function Roue:draw()
    g_currentMission:addHelpButtonText(g_i18n:getText("ClaasScorpion_changeWheel1"), InputBinding.ClaasScorpion_changeWheel); 
end;

function Roue: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;

function Roue:delete()
end;