--
-- Teleskopladers
--
-- M@D Author  StarT
-- M@D date  16.12.2011
--
-- > Copyright (C) Headshot XXL - www.planet-ls.de < --


Teleskopladers = {}

function Teleskopladers.prerequisitesPresent(specializations)
	Vehicle.registerJointType("frontloader");
    return true ;
end;

function Teleskopladers:load(xmlFile)



local rotationPartNoderu4ka1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartru4ka1#index"));
      if rotationPartNoderu4ka1 ~= nil then
        self.rotationPartru4ka1 = {};
        self.rotationPartru4ka1.node = rotationPartNoderu4ka1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#minRot"));
        self.rotationPartru4ka1.minRot = {};
        self.rotationPartru4ka1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#maxRot"));
        self.rotationPartru4ka1.maxRot = {};
        self.rotationPartru4ka1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartru4ka1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#rotTime"), 2)*1000;
        self.rotationPartru4ka1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka1#touchRotLimit"), 10));
    end;

local rotationPartNoderu4ka2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartru4ka2#index"));
      if rotationPartNoderu4ka2 ~= nil then
        self.rotationPartru4ka2 = {};
        self.rotationPartru4ka2.node = rotationPartNoderu4ka2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#minRot"));
        self.rotationPartru4ka2.minRot = {};
        self.rotationPartru4ka2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#maxRot"));
        self.rotationPartru4ka2.maxRot = {};
        self.rotationPartru4ka2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartru4ka2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartru4ka2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartru4ka2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#rotTime"), 2)*1000;
        self.rotationPartru4ka2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartru4ka2#touchRotLimit"), 10));
    end;



    self.wiper1Active = false;	
    self.wiper2Active = false;
    self.wiper3Active = false;	
    self.wiper4Active = false;
    self.wiper5Active = false;	
    self.wiper6Active = false;	
    self.delayOnLeft = 0;
    self.delayOffLeft = 0;
    self.delayOnRight = 0;
    self.delayOffRight = 0;
    self.delayWischer1 = 0;
    self.delayWischer2 = 0;
    self.delayOn = 0;
    self.delayOff = 0;
    self.deltafo = 0;

  local wiper1Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper1#index"));
    if wiper1Node ~= nil then
        self.wiper1 = {};
        self.wiper1.node = wiper1Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper1#minRot"));
        self.wiper1.minRot = {};
        self.wiper1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper1#maxRot"));
        self.wiper1.maxRot = {};
        self.wiper1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper1#rotTime"), 2)*1000;
        self.wiper1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper1#touchRotLimit"), 10));
    end;
	
	local wiper2Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper2#index"));
    if wiper2Node ~= nil then
        self.wiper2 = {};
        self.wiper2.node = wiper2Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper2#minRot"));
        self.wiper2.minRot = {};
        self.wiper2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper2#maxRot"));
        self.wiper2.maxRot = {};
        self.wiper2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper2#rotTime"), 2)*1000;
        self.wiper2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper2#touchRotLimit"), 10));
    end;


  local wiper3Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper3#index"));
    if wiper3Node ~= nil then
        self.wiper3 = {};
        self.wiper3.node = wiper3Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper3#minRot"));
        self.wiper3.minRot = {};
        self.wiper3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper3#maxRot"));
        self.wiper3.maxRot = {};
        self.wiper3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper3#rotTime"), 2)*1000;
        self.wiper3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper3#touchRotLimit"), 10));
    end;
	
	local wiper4Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper4#index"));
    if wiper4Node ~= nil then
        self.wiper4 = {};
        self.wiper4.node = wiper4Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper4#minRot"));
        self.wiper4.minRot = {};
        self.wiper4.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper4.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper4.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper4#maxRot"));
        self.wiper4.maxRot = {};
        self.wiper4.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper4.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper4.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper4.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper4#rotTime"), 2)*1000;
        self.wiper4.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper4#touchRotLimit"), 10));
    end;

  local wiper5Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper5#index"));
    if wiper5Node ~= nil then
        self.wiper5 = {};
        self.wiper5.node = wiper5Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper5#minRot"));
        self.wiper5.minRot = {};
        self.wiper5.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper5.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper5.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper5#maxRot"));
        self.wiper5.maxRot = {};
        self.wiper5.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper5.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper5.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper5.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper5#rotTime"), 2)*1000;
        self.wiper5.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper5#touchRotLimit"), 10));
    end;
	
	local wiper6Node = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wiper6#index"));
    if wiper6Node ~= nil then
        self.wiper6 = {};
        self.wiper6.node = wiper6Node;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper6#minRot"));
        self.wiper6.minRot = {};
        self.wiper6.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper6.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper6.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.wiper6#maxRot"));
        self.wiper6.maxRot = {};
        self.wiper6.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.wiper6.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.wiper6.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.wiper6.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper6#rotTime"), 2)*1000;
        self.wiper6.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.wiper6#touchRotLimit"), 10));
    end;





self.wentelatorNode1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.wentelator#index"));
	self.wentelatorRotationScale = Utils.getNoNil(getXMLFloat(xmlFile, "vehicle.wentelator#rotationScale"), 1);
	self.isTurnedOn = false;



local rotationPartNodepoworotnika = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnika#index"));
    if rotationPartNodepoworotnika ~= nil then
        self.rotationPartpoworotnika = {};
        self.rotationPartpoworotnika.node = rotationPartNodepoworotnika;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnika#minRot"));
        self.rotationPartpoworotnika.minRot = {};
        self.rotationPartpoworotnika.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnika.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnika.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnika#maxRot"));
        self.rotationPartpoworotnika.maxRot = {};
        self.rotationPartpoworotnika.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnika.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnika.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnika.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnika#rotTime"), 2)*1000;
        self.rotationPartpoworotnika.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnika#touchRotLimit"), 10));
    end;

local rotationPartNodepoworotnikk = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnikk#index"));
    if rotationPartNodepoworotnikk ~= nil then
        self.rotationPartpoworotnikk = {};
        self.rotationPartpoworotnikk.node = rotationPartNodepoworotnikk;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnikk#minRot"));
        self.rotationPartpoworotnikk.minRot = {};
        self.rotationPartpoworotnikk.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnikk.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnikk.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnikk#maxRot"));
        self.rotationPartpoworotnikk.maxRot = {};
        self.rotationPartpoworotnikk.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnikk.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnikk.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnikk.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnikk#rotTime"), 2)*1000;
        self.rotationPartpoworotnikk.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnikk#touchRotLimit"), 10));
    end;

local rotationPartNodepoworotnik = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnik#index"));
    if rotationPartNodepoworotnik ~= nil then
        self.rotationPartpoworotnik = {};
        self.rotationPartpoworotnik.node = rotationPartNodepoworotnik;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnik#minRot"));
        self.rotationPartpoworotnik.minRot = {};
        self.rotationPartpoworotnik.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnik#maxRot"));
        self.rotationPartpoworotnik.maxRot = {};
        self.rotationPartpoworotnik.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnik.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik#rotTime"), 2)*1000;
        self.rotationPartpoworotnik.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik#touchRotLimit"), 10));
    end;
local rotationPartNodepoworotnik0 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.poworotnik0#index"));
    if rotationPartNodepoworotnik0 ~= nil then
        self.rotationPartpoworotnik0 = {};
        self.rotationPartpoworotnik0.node = rotationPartNodepoworotnik0;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartpoworotnik0#minRot"));
        self.rotationPartpoworotnik0.minRot = {};
        self.rotationPartpoworotnik0.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik0.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik0.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.poworotnik0#maxRot"));
        self.rotationPartpoworotnik0.maxRot = {};
        self.rotationPartpoworotnik0.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartpoworotnik0.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartpoworotnik0.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartpoworotnik0.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik0#rotTime"), 2)*1000;
        self.rotationPartpoworotnik0.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.poworotnik0#touchRotLimit"), 10));
    end;




	local rotationPartNodePedal3 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal3#index"));
    if rotationPartNodePedal3 ~= nil then
        self.rotationPartPedal3 = {};
        self.rotationPartPedal3.node = rotationPartNodePedal3;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal3#minRot"));
        self.rotationPartPedal3.minRot = {};
        self.rotationPartPedal3.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal3.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal3.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal3#maxRot"));
        self.rotationPartPedal3.maxRot = {};
        self.rotationPartPedal3.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal3.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal3.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal3.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal3#rotTime"), 2)*1000;
        self.rotationPartPedal3.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal3#touchRotLimit"), 10));
    end;

	local rotationPartNodePedal2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal2#index"));
    if rotationPartNodePedal2 ~= nil then
        self.rotationPartPedal2 = {};
        self.rotationPartPedal2.node = rotationPartNodePedal2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal2#minRot"));
        self.rotationPartPedal2.minRot = {};
        self.rotationPartPedal2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal2#maxRot"));
        self.rotationPartPedal2.maxRot = {};
        self.rotationPartPedal2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal2#rotTime"), 2)*1000;
        self.rotationPartPedal2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal2#touchRotLimit"), 10));
    end;

local rotationPartNodeDrehzahl1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#index"));
    if rotationPartNodeDrehzahl1 ~= nil then
        self.rotationPartDrehzahl1 = {};
        self.rotationPartDrehzahl1.node = rotationPartNodeDrehzahl1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#minRot"));
        self.rotationPartDrehzahl1.minRot = {};
        self.rotationPartDrehzahl1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#maxRot"));
        self.rotationPartDrehzahl1.maxRot = {};
        self.rotationPartDrehzahl1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartDrehzahl1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#rotTime"), 2)*1000;
        self.rotationPartDrehzahl1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl1#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeDrehzahl2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#index"));
    if rotationPartNodeDrehzahl2 ~= nil then
        self.rotationPartDrehzahl2 = {};
        self.rotationPartDrehzahl2.node = rotationPartNodeDrehzahl2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#minRot"));
        self.rotationPartDrehzahl2.minRot = {};
        self.rotationPartDrehzahl2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#maxRot"));
        self.rotationPartDrehzahl2.maxRot = {};
        self.rotationPartDrehzahl2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartDrehzahl2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartDrehzahl2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartDrehzahl2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#rotTime"), 2)*1000;
        self.rotationPartDrehzahl2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartDrehzahl2#touchRotLimit"), 10));
    end;





      self.tanklight = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tanklight#index"));
	self.tank2light = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tanklight#index2"));
      self.tanklightActive = false;

local rotationPartNodeTanknadel = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartTanknadel#index"));
    if rotationPartNodeTanknadel ~= nil then
        self.rotationPartTanknadel = {};
        self.rotationPartTanknadel.node = rotationPartNodeTanknadel;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#minRot"));
        self.rotationPartTanknadel.minRot = {};
        self.rotationPartTanknadel.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#maxRot"));
        self.rotationPartTanknadel.maxRot = {};
        self.rotationPartTanknadel.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartTanknadel.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#rotTime"), 2)*1000;
        self.rotationPartTanknadel.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeTanknadel2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#index"));
    if rotationPartNodeTanknadel2 ~= nil then
        self.rotationPartTanknadel2 = {};
        self.rotationPartTanknadel2.node = rotationPartNodeTanknadel2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#minRot"));
        self.rotationPartTanknadel2.minRot = {};
        self.rotationPartTanknadel2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#maxRot"));
        self.rotationPartTanknadel2.maxRot = {};
        self.rotationPartTanknadel2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartTanknadel2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartTanknadel2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartTanknadel2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#rotTime"), 2)*1000;
        self.rotationPartTanknadel2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartTanknadel2#touchRotLimit"), 10));
    end;

    fuelwarningSoundFile = Utils.getFilename("sounds/fuelwarning.wav", self.baseDirectory);
    self.fuelwarningSoundId = createSample("fuelwarningSound");
    loadSample(self.fuelwarningSoundId, fuelwarningSoundFile, false);
    self.fuelwarningPlaying = false;







	local rotationPartNodePedal = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartPedal#index"));
    if rotationPartNodePedal ~= nil then
        self.rotationPartPedal = {};
        self.rotationPartPedal.node = rotationPartNodePedal;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal#minRot"));
        self.rotationPartPedal.minRot = {};
        self.rotationPartPedal.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartPedal#maxRot"));
        self.rotationPartPedal.maxRot = {};
        self.rotationPartPedal.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartPedal.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartPedal.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartPedal.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal#rotTime"), 2)*1000;
        self.rotationPartPedal.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartPedal#touchRotLimit"), 10));
    end;

local rotationPartNodeKmh1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartKmh1#index"));
    if rotationPartNodeKmh1 ~= nil then
        self.rotationPartKmh1 = {};
        self.rotationPartKmh1.node = rotationPartNodeKmh1;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh1#minRot"));
        self.rotationPartKmh1.minRot = {};
        self.rotationPartKmh1.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh1.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh1.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh1#maxRot"));
        self.rotationPartKmh1.maxRot = {};
        self.rotationPartKmh1.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh1.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh1.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartKmh1.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh1#rotTime"), 2)*1000;
        self.rotationPartKmh1.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh1#touchRotLimit"), 10));
    end;
	
	local rotationPartNodeKmh2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartKmh2#index"));
    if rotationPartNodeKmh2 ~= nil then
        self.rotationPartKmh2 = {};
        self.rotationPartKmh2.node = rotationPartNodeKmh2;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh2#minRot"));
        self.rotationPartKmh2.minRot = {};
        self.rotationPartKmh2.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh2.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh2.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartKmh2#maxRot"));
        self.rotationPartKmh2.maxRot = {};
        self.rotationPartKmh2.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartKmh2.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartKmh2.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartKmh2.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh2#rotTime"), 2)*1000;
        self.rotationPartKmh2.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartKmh2#touchRotLimit"), 10));
    end;

local rotationPartNodeBrake = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartBrake#index"));
    if rotationPartNodeBrake ~= nil then
        self.rotationPartBrake = {};
        self.rotationPartBrake.node = rotationPartNodeBrake;

        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartBrake#minRot"));
        self.rotationPartBrake.minRot = {};
        self.rotationPartBrake.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartBrake.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartBrake.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartBrake#maxRot"));
        self.rotationPartBrake.maxRot = {};
        self.rotationPartBrake.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartBrake.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartBrake.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotationPartBrake.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartBrake#rotTime"), 2)*1000;
        self.rotationPartBrake.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartBrake#touchRotLimit"), 10));
    end;

	local translationPartNode = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.translationPart#index"));
    if translationPartNode ~= nil then
        self.translationPart = {};
        self.translationPart.node = translationPartNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#minTrans"));
        self.translationPart.minTrans = {};
        self.translationPart.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart#maxTrans"));
        self.translationPart.maxTrans = {};
        self.translationPart.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationPart.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#transTime"), 2)*1000;
        self.translationPart.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart#touchTransLimit"), 10);
    end;
    local translationPartNode2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.translationPart2#index"));
    if translationPartNode2 ~= nil then
        self.translationPart2 = {};
        self.translationPart2.node = translationPartNode2;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart2#minTrans"));
        self.translationPart2.minTrans = {};
        self.translationPart2.minTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart2.minTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart2.minTrans[3] = Utils.getNoNil(z, 0);

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.translationPart2#maxTrans"));
        self.translationPart2.maxTrans = {};
        self.translationPart2.maxTrans[1] = Utils.getNoNil(x, 0);
        self.translationPart2.maxTrans[2] = Utils.getNoNil(y, 0);
        self.translationPart2.maxTrans[3] = Utils.getNoNil(z, 0);

        self.translationPart2.transTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart2#transTime"), 2)*1000;
        self.translationPart2.touchTransLimit = Utils.getNoNil(getXMLString(xmlFile, "vehicle.translationPart2#touchTransLimit"), 10);
    end; 

	local rotationNode6 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation6#index"));
    if rotationNode6 ~= nil then
        self.rotation6 = {};
        self.rotation6.node = rotationNode6;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation6#minRot"));
        self.rotation6.minRot = {};
        self.rotation6.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation6.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation6.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation6#maxRot"));
        self.rotation6.maxRot = {};
        self.rotation6.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation6.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation6.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation6.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation6#rotTime"), 2)*1000;
        self.rotation6.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation6#touchRotLimit"), 10));
    end; 

	local rotationNode7 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation7#index"));
    if rotationNode7 ~= nil then
        self.rotation7 = {};
        self.rotation7.node = rotationNode7;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation7#minRot"));
        self.rotation7.minRot = {};
        self.rotation7.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation7.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation7.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation7#maxRot"));
        self.rotation7.maxRot = {};
        self.rotation7.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation7.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation7.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation7.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation7#rotTime"), 2)*1000;
        self.rotation7.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation7#touchRotLimit"), 10));
    end;       
	
	local rotationNode8 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation8#index"));
    if rotationNode8 ~= nil then
        self.rotation8 = {};
        self.rotation8.node = rotationNode8;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation8#minRot"));
        self.rotation8.minRot = {};
        self.rotation8.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation8.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation8.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation8#maxRot"));
        self.rotation8.maxRot = {};
        self.rotation8.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation8.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation8.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation8.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation8#rotTime"), 2)*1000;
        self.rotation8.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation8#touchRotLimit"), 10));
    end;
	
	local rotationNode9 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotation9#index"));
    if rotationNode9 ~= nil then
        self.rotation9 = {};
        self.rotation9.node = rotationNode9;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation9#minRot"));
        self.rotation9.minRot = {};
        self.rotation9.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation9.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation9.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotation9#maxRot"));
        self.rotation9.maxRot = {};
        self.rotation9.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotation9.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotation9.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

        self.rotation9.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation9#rotTime"), 2)*1000;
        self.rotation9.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotation9#touchRotLimit"), 10));
    end;

    local rotationPartNodeLeft11 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.rotationPartLeft11#index"));
    if rotationPartNodeLeft11 ~= nil then
        self.rotationPartLeft11 = {};
        self.rotationPartLeft11.node = rotationPartNodeLeft11;
        local x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft11#minRot"));
        self.rotationPartLeft11.minRot = {};
        self.rotationPartLeft11.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartLeft11.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartLeft11.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(xmlFile, "vehicle.rotationPartLeft11#maxRot"));
        self.rotationPartLeft11.maxRot = {};
        self.rotationPartLeft11.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.rotationPartLeft11.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.rotationPartLeft11.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.rotationPartLeft11.rotTime = Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft11#rotTime"), 2)*1000;
        self.rotationPartLeft11.touchRotLimit = Utils.degToRad(Utils.getNoNil(getXMLString(xmlFile, "vehicle.rotationPartLeft11#touchRotLimit"), 10));
    end;

end;
      
function Teleskopladers:delete()    
end;

function Teleskopladers:mouseEvent(posX, posY, isDown, isUp, button)
end;
	  
function Teleskopladers:keyEvent(unicode, sym, modifier, isDown)

	local maxDrehzahl = 9000;
	if self.rotationPartDrehzahl1 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl1.node);
		y = ((self.rotationPartDrehzahl1.maxRot[2] - self.rotationPartDrehzahl1.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl1.minRot[2];
		setRotation(self.rotationPartDrehzahl1.node, x, y ,z);
	end;
	if self.rotationPartDrehzahl2 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl2.node);
		y = ((self.rotationPartDrehzahl2.maxRot[2] - self.rotationPartDrehzahl2.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl2.minRot[2];
		setRotation(self.rotationPartDrehzahl2.node, x, y ,z);
	end;
																		
      if self.rotationPartTanknadel ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel.node);
		y = ((self.rotationPartTanknadel.maxRot[2] - self.rotationPartTanknadel.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel.minRot[2];
		setRotation(self.rotationPartTanknadel.node, x, y ,z);
	end;
	
	if self.rotationPartTanknadel2 ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel2.node);
		y = ((self.rotationPartTanknadel2.maxRot[2] - self.rotationPartTanknadel2.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel2.minRot[2];
		setRotation(self.rotationPartTanknadel2.node, x, y ,z);
	end;

	local maxKmh = 80;
	if self.rotationPartKmh1 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh1.node);
		y = ((self.rotationPartKmh1.maxRot[2] - self.rotationPartKmh1.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh1.minRot[2];
		setRotation(self.rotationPartKmh1.node, x, y ,z);
	end;
	if self.rotationPartKmh2 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh2.node);
		y = ((self.rotationPartKmh2.maxRot[2] - self.rotationPartKmh2.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh2.minRot[2];
		setRotation(self.rotationPartKmh2.node, x, y ,z);
	end;



      if isDown and sym == Input.KEY_y then 
		self.wiper1Active = not self.wiper1Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper2Active = not self.wiper2Active;
	  end;
      if isDown and sym == Input.KEY_y then 
		self.wiper3Active = not self.wiper3Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper4Active = not self.wiper4Active;
	  end;
      if isDown and sym == Input.KEY_y then 
		self.wiper5Active = not self.wiper5Active;
	  end; 
      if isDown and sym == Input.KEY_y then 
		self.wiper6Active = not self.wiper6Active;
	  end; 




     if isDown then
		if sym == Input.KEY_t then
			if self.isTurnedOn == false then
				self.isTurnedOn = true;
			else
				self.isTurnedOn = false;
			end;
		end;		
		
	end;



	if sym == Input.KEY_KP_2 then
            self.rotationMaxpoworotnika = not self.rotationMaxpoworotnika;
            self.rotationMaxpoworotnik0 = false;
	
	end;

	if sym == Input.KEY_KP_3 then
            self.rotationMaxpoworotnikk = not self.rotationMaxpoworotnikk;
            self.rotationMaxpoworotnik0 = false;
	
	end;
	
     if sym == Input.KEY_KP_1 then
           self.rotationMaxpoworotnik = not self.rotationMaxpoworotnik;
           self.rotationMaxpoworotnik0 = false;	
	end;	



	
	if self.isEntered then
		if Input.isKeyPressed(Input.KEY_right) then
			self.rotationMaxPedal3 = true;
		else
			self.rotationMaxPedal3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_left) then
			self.rotationMaxPedal2 = true;
		else
			self.rotationMaxPedal2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_up) then
			self.rotationMaxPedal = true;
		else
			self.rotationMaxPedal = false;
		end;
		if Input.isKeyPressed(Input.KEY_down) then
			self.rotationMaxBrake = true;
		else
			self.rotationMaxBrake = false;
		end;
		if self.gang0 then
			self.rotationMaxClutch = true;
		else
			self.rotationMaxClutch = false;
		end;
	end

	if self.isEntered then
		if Input.isKeyPressed(Input.KEY_right) then
			self.rotationMaxPedal3 = true;
		else
			self.rotationMaxPedal3 = false;
		end;
		if Input.isKeyPressed(Input.KEY_left) then
			self.rotationMaxPedal2 = true;
		else
			self.rotationMaxPedal2 = false;
		end;
		if Input.isKeyPressed(Input.KEY_up) then
			self.rotationMaxPedal = true;
		else
			self.rotationMaxPedal = false;
		end;
		if Input.isKeyPressed(Input.KEY_down) then
			self.rotationMaxBrake = true;
		else
			self.rotationMaxBrake = false;
		end;
		if self.gang0 then
			self.rotationMaxClutch = true;
		else
			self.rotationMaxClutch = false;
		end;
	end
	


    if sym == Input.KEY_o then
		self.translationMax = isDown;
	end;
	if sym == Input.KEY_p then
		self.translationMin = isDown;
	end;

    if sym == Input.KEY_o then
		self.translationMax2 = isDown;
	end;
	if sym == Input.KEY_p then
		self.translationMin2 = isDown;
	end;

	if sym == Input.KEY_n then
		self.rotation9Max = isDown;
	end;
	if sym == Input.KEY_m then
		self.rotation9Min = isDown;
	end;
	if sym == Input.KEY_k then
		self.rotation8Max = isDown;
	end;
	if sym == Input.KEY_l then
		self.rotation8Min = isDown;
	end;
	if sym == Input.KEY_h then
		self.rotation7Max = isDown;
	end;
	if sym == Input.KEY_j then
		self.rotation7Min = isDown;
	end;
	if sym == Input.KEY_f then
		self.rotation6Max = isDown;
	end;
	if sym == Input.KEY_g then
		self.rotation6Min = isDown;
	end;



if isDown and sym == Input.KEY_r then
		if self.chuj then
			self.rotationMaxru4ka1 = true;
		else
			self.rotationMaxru4ka1 = true
		end;
	else
		self.rotationMaxru4ka1 = false;
		end;

if isDown and sym == Input.KEY_r then
		if self.chuj then
			self.rotationMaxru4ka2 = true;
		else
			self.rotationMaxru4ka2 = true
		end;
	else
		self.rotationMaxru4ka2 = false;
		end;



      if InputBinding.isPressed(InputBinding.SHIT) then
		self.rotationMaxLeft11 = not self.rotationMaxLeft11;
	end;

end;

function Teleskopladers:update(dt)







	               if self.wiper1Active then
			   if self.delayWischer1 >= 0 then
				self.delayWischer1 = self.delayWischer1 -dt;
			end;
			   if self.delayWischer2 >= 0 then
				self.delayWischer2 = self.delayWischer2 -dt;
			end;
			     if not self.wiper1Max then
				   if self.delayWischer1 < 0 then
					self.delayWischer2 = 1000;
					self.wiper1Max = true;
					self.wiper2Max = true;
					self.wiper3Max = true;
					self.wiper4Max = true;
					self.wiper5Max = true;
					self.wiper6Max = true;
				end;
			end;
			         if self.wiper1Max then
				   if self.delayWischer2 < 0 then
					self.delayWischer1 = 1000;
					self.wiper1Max = false;
					self.wiper2Max = false;
					self.wiper3Max = false;
					self.wiper4Max = false;
					self.wiper5Max = false;
					self.wiper6Max = false;
				end;
			end;
		else
			self.wiper1Max = false;
			self.wiper2Max = false;
			self.wiper3Max = false;
			self.wiper4Max = false;
			self.wiper5Max = false;
			self.wiper6Max = false;
		end;

      if self.wiper1 ~= nil then
        	local x, y, z = getRotation(self.wiper1.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper1.maxRot, self.wiper1.minRot, 3, self.wiper1.rotTime, dt, not self.wiper1Max);
        	setRotation(self.wiper1.node, unpack(newRot));
    	end;
		
	if self.wiper2 ~= nil then
        	local x, y, z = getRotation(self.wiper2.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper2.maxRot, self.wiper2.minRot, 3, self.wiper2.rotTime, dt, not self.wiper2Max);
        	setRotation(self.wiper2.node, unpack(newRot));
    	end;
      if self.wiper3 ~= nil then
        	local x, y, z = getRotation(self.wiper3.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper3.maxRot, self.wiper3.minRot, 3, self.wiper3.rotTime, dt, not self.wiper3Max);
        	setRotation(self.wiper3.node, unpack(newRot));
    	end;
		
	if self.wiper4 ~= nil then
        	local x, y, z = getRotation(self.wiper4.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper4.maxRot, self.wiper4.minRot, 3, self.wiper4.rotTime, dt, not self.wiper4Max);
        	setRotation(self.wiper4.node, unpack(newRot));
    	end;
      if self.wiper5 ~= nil then
        	local x, y, z = getRotation(self.wiper5.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper5.maxRot, self.wiper5.minRot, 3, self.wiper5.rotTime, dt, not self.wiper5Max);
        	setRotation(self.wiper5.node, unpack(newRot));
    	end;
		
	if self.wiper6 ~= nil then
        	local x, y, z = getRotation(self.wiper6.node);
        	local rot = {x,y,z};
        	local newRot = Utils.getMovedLimitedValues(rot, self.wiper6.maxRot, self.wiper6.minRot, 3, self.wiper6.rotTime, dt, not self.wiper6Max);
        	setRotation(self.wiper6.node, unpack(newRot));
    	end;







        if self.isTurnedOn then
        if self.wentelatorNode1 ~= nil then
				rotate(self.wentelatorNode1, self.wentelatorRotationScale * 5 * 1, 0, 0);
			end;	

        end;






      if self.rotationMaxpoworotnikk == false and self.rotationMaxpoworotnik == false and self.rotationMaxpoworotnika == false then
      self.rotationMaxpoworotnik0 = true
      end;	


	if self.rotationMaxpoworotnika == true then
               if self.rotationPartpoworotnika ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnika.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnika.maxRot, self.rotationPartpoworotnika.minRot, 3, self.rotationPartpoworotnika.rotTime, dt, not self.rotationMaxpoworotnika);
		   setRotation(self.rotationPartpoworotnika.node, unpack(newRot));
       end;
         end;		
	if self.rotationMaxpoworotnikk == true then
               if self.rotationPartpoworotnikk ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnikk.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnikk.maxRot, self.rotationPartpoworotnikk.minRot, 3, self.rotationPartpoworotnikk.rotTime, dt, not self.rotationMaxpoworotnikk);
		   setRotation(self.rotationPartpoworotnikk.node, unpack(newRot));
       end;
	   end;
               if self.rotationMaxpoworotnik == true then
               if self.rotationPartpoworotnik ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnik.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnik.maxRot, self.rotationPartpoworotnik.minRot, 3, self.rotationPartpoworotnik.rotTime, dt, not self.rotationMaxpoworotnik);
		   setRotation(self.rotationPartpoworotnik.node, unpack(newRot));
       end;
	   end;

               if self.rotationMaxpoworotnik0 == true then
               if self.rotationPartpoworotnik0 ~= nil then
		   local x, y, z = getRotation(self.rotationPartpoworotnik0.node);
		   local rot = {x,y,z};
		   local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartpoworotnik0.maxRot, self.rotationPartpoworotnik0.minRot, 3, self.rotationPartpoworotnik0.rotTime, dt, not self.rotationMaxpoworotnik0);
		   setRotation(self.rotationPartpoworotnik0.node, unpack(newRot));
       end;
	   end;








	local maxDrehzahl = 2250;
	if self.rotationPartDrehzahl1 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl1.node);
		y = ((self.rotationPartDrehzahl1.maxRot[2] - self.rotationPartDrehzahl1.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl1.minRot[2];
		setRotation(self.rotationPartDrehzahl1.node, x, y ,z);
	end;
	if self.rotationPartDrehzahl2 ~= nil then
		local x, y, z = getRotation(self.rotationPartDrehzahl2.node);
		y = ((self.rotationPartDrehzahl2.maxRot[2] - self.rotationPartDrehzahl2.minRot[2]) / maxDrehzahl) * self.motor.lastMotorRpm + self.rotationPartDrehzahl2.minRot[2];
		setRotation(self.rotationPartDrehzahl2.node, x, y ,z);




if self.starrr == true then

if self.isEntered then
		if self.fuelFillLevel < 50 then
			self.tankwarn = self.tankwarn - dt;
			if self.tankwarn <= 0 then
				playSample(self.fuelwarningSoundId,1,1,0);
				self.tankwarn = 30000;
			end;
			self.tanklightActive = true;
		else
			self.tankwarn = 30000;
			self.tanklightActive = false;
		end;
		setVisibility(self.tanklight,self.tanklightActive);
		setVisibility(self.tank2light,self.tanklightActive);
	end;	
end;
																		
      if self.rotationPartTanknadel ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel.node);
		y = ((self.rotationPartTanknadel.maxRot[2] - self.rotationPartTanknadel.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel.minRot[2];
		setRotation(self.rotationPartTanknadel.node, x, y ,z);
	end;
	
	if self.rotationPartTanknadel2 ~= nil then
		local x, y, z = getRotation(self.rotationPartTanknadel2.node);
		y = ((self.rotationPartTanknadel2.maxRot[2] - self.rotationPartTanknadel2.minRot[2]) / self.fuelCapacity) * self.fuelFillLevel + self.rotationPartTanknadel2.minRot[2];
		setRotation(self.rotationPartTanknadel2.node, x, y ,z);
	end;

if self.isEntered then
		if self.fuelFillLevel < 50 then
			self.tankwarn = self.tankwarn - dt;
			if self.tankwarn <= 0 then
				playSample(self.fuelwarningSoundId,1,1,0);
				self.tankwarn = 30000;
			end;
			self.tanklightActive = true;
		else
			self.tankwarn = 30000;
			self.tanklightActive = false;
		end;
		setVisibility(self.tanklight,self.tanklightActive);
		setVisibility(self.tank2light,self.tanklightActive);
	end;
end;








	local maxKmh = 50;
	if self.rotationPartKmh1 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh1.node);
		y = ((self.rotationPartKmh1.maxRot[2] - self.rotationPartKmh1.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh1.minRot[2];
		setRotation(self.rotationPartKmh1.node, x, y ,z);
	end;
	if self.rotationPartKmh2 ~= nil then
		local x, y, z = getRotation(self.rotationPartKmh2.node);
		y = ((self.rotationPartKmh2.maxRot[2] - self.rotationPartKmh2.minRot[2]) / maxKmh) * self.lastSpeed*3600 + self.rotationPartKmh2.minRot[2];
		setRotation(self.rotationPartKmh2.node, x, y ,z);
	end;

	if self.rotationPartPedal3 ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal3.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal3.maxRot, self.rotationPartPedal3.minRot, 3, self.rotationPartPedal3.rotTime, dt, not self.rotationMaxPedal3);
		setRotation(self.rotationPartPedal3.node, unpack(newRot));
	end;

	if self.rotationPartPedal2 ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal2.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal2.maxRot, self.rotationPartPedal2.minRot, 3, self.rotationPartPedal2.rotTime, dt, not self.rotationMaxPedal2);
		setRotation(self.rotationPartPedal2.node, unpack(newRot));
	end;

	if self.rotationPartPedal ~= nil then
		local x, y, z = getRotation(self.rotationPartPedal.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartPedal.maxRot, self.rotationPartPedal.minRot, 3, self.rotationPartPedal.rotTime, dt, not self.rotationMaxPedal);
		setRotation(self.rotationPartPedal.node, unpack(newRot));
	end;

     if self.rotationPartBrake ~= nil then
		local x, y, z = getRotation(self.rotationPartBrake.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartBrake.maxRot, self.rotationPartBrake.minRot, 3, self.rotationPartBrake.rotTime, dt, not self.rotationMaxBrake);
		setRotation(self.rotationPartBrake.node, unpack(newRot));
	end;

	local doTranslate = self.translationMax or self.translationMin 
	if self.translationPart ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationPart.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationPart.maxTrans, self.translationPart.minTrans, 3, self.translationPart.transTime, dt, not self.translationMax); 
		setTranslation(self.translationPart.node, unpack(newTrans)); 
	end; 
	local doTranslate = self.translationMax2 or self.translationMin2 
	if self.translationPart2 ~= nil and doTranslate then 
		local x, y, z = getTranslation(self.translationPart2.node); 
		local trans = {x,y,z}; 
		local newTrans = Utils.getMovedLimitedValues(trans, self.translationPart2.maxTrans, self.translationPart2.minTrans, 3, self.translationPart2.transTime, dt, not self.translationMax2); 
		setTranslation(self.translationPart2.node, unpack(newTrans)); 
	end;

	local doRotate = self.rotation6Max or self.rotation6Min 
	if self.rotation6 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation6.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation6.maxRot, self.rotation6.minRot, 3, self.rotation6.rotTime, dt, not self.rotation6Max);
        setRotation(self.rotation6.node, unpack(newRot));
    end;

	local doRotate = self.rotation7Max or self.rotation7Min 
	if self.rotation7 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation7.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation7.maxRot, self.rotation7.minRot, 3, self.rotation7.rotTime, dt, not self.rotation7Max);
        setRotation(self.rotation7.node, unpack(newRot));
    end;
	
	local doRotate = self.rotation8Max or self.rotation8Min 
	if self.rotation8 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation8.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation8.maxRot, self.rotation8.minRot, 3, self.rotation8.rotTime, dt, not self.rotation8Max);
        setRotation(self.rotation8.node, unpack(newRot));
    end;
	
	local doRotate = self.rotation9Max or self.rotation9Min 
	if self.rotation9 ~= nil and doRotate then
        local x, y, z = getRotation(self.rotation9.node);
        local rot = {x,y,z};
        local newRot = Utils.getMovedLimitedValues(rot, self.rotation9.maxRot, self.rotation9.minRot, 3, self.rotation9.rotTime, dt, not self.rotation9Max);
        setRotation(self.rotation9.node, unpack(newRot));
    end;





if self.rotationPartru4ka1 ~= nil then
		local x, y, z = getRotation(self.rotationPartru4ka1.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartru4ka1.maxRot, self.rotationPartru4ka1.minRot, 3, self.rotationPartru4ka1.rotTime, dt, not self.rotationMaxru4ka1);
		setRotation(self.rotationPartru4ka1.node, unpack(newRot));

end;

if self.rotationPartru4ka2 ~= nil then
		local x, y, z = getRotation(self.rotationPartru4ka2.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartru4ka2.maxRot, self.rotationPartru4ka2.minRot, 3, self.rotationPartru4ka2.rotTime, dt, not self.rotationMaxru4ka2);
		setRotation(self.rotationPartru4ka2.node, unpack(newRot));

end;




	if self.rotationPartLeft11 ~= nil then
		local x, y, z = getRotation(self.rotationPartLeft11.node);
		local rot = {x,y,z};
		local newRot = Utils.getMovedLimitedValues(rot, self.rotationPartLeft11.maxRot, self.rotationPartLeft11.minRot, 3, self.rotationPartLeft11.rotTime, dt, not self.rotationMaxLeft11);
		setRotation(self.rotationPartLeft11.node, unpack(newRot));
	end;

end;

function Teleskopladers:draw()
end;

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