--
-- K744R4
-- Specialization for K744R4
--
-- @author      Aluha74rus
-- @version     v1.0
-- @date          16/01/18
--

K744R4 = {};

function K744R4.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations) and SpecializationUtil.hasSpecialization(Steerable, specializations) and  SpecializationUtil.hasSpecialization(Drivable, specializations);
end;

function K744R4:load(savegame)    
    if self.isClient then
        self.tahometrHud = VehicleHudUtils.loadHud(self, self.xmlFile, "tahometr");
    end;
    
    self.temperaturZeiger = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.Temperatura#Index"));
    self.temperaturZeigerMaxRot = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.K744R4.Temperatura#maxRotation"));
    self.tempCnt = 0;
    
    self.podMonitor = Utils.indexToObject(self.components, "0>1|12|1");    
    self.pust = Utils.indexToObject(self.components, "0>1|3|4");    
    self.pust1 = Utils.indexToObject(self.components, "0>1|3|8|0|1");    
    self.pust2 = Utils.indexToObject(self.components, "0>3|27|0|9");    
    self.pust3 = Utils.indexToObject(self.components, "0>3|27|0|10");        
    self.pust4 = Utils.indexToObject(self.components, "0>1|1|2|12");    
    
    self.oneSD = Utils.indexToObject(self.components, "0>3|27|0|0");    
    self.twoSD = Utils.indexToObject(self.components, "0>3|27|0|1");    
    self.threeSD = Utils.indexToObject(self.components, "0>3|27|0|2");    
    self.fourSD = Utils.indexToObject(self.components, "0>3|27|0|3");    
    self.TD = Utils.indexToObject(self.components, "0>3|27|0|7");
    self.ND = Utils.indexToObject(self.components, "0>3|27|0|10|0");    
    self.HD = Utils.indexToObject(self.components, "0>3|27|0|5");
    self.LD = Utils.indexToObject(self.components, "0>3|27|0|6");
    
    self.oneS = Utils.indexToObject(self.components, "0>1|3|0");    
    self.twoS = Utils.indexToObject(self.components, "0>1|3|1");    
    self.threeS = Utils.indexToObject(self.components, "0>1|3|2");    
    self.fourS = Utils.indexToObject(self.components, "0>1|3|3");    
    self.T = Utils.indexToObject(self.components, "0>1|3|5");
    self.N = Utils.indexToObject(self.components, "0>1|3|4|0");    
    self.H = Utils.indexToObject(self.components, "0>1|3|8|1|0");
    self.L = Utils.indexToObject(self.components, "0>1|3|8|1|1");
    self.F = Utils.indexToObject(self.components, "0>1|3|8|0|0");
    self.R = Utils.indexToObject(self.components, "0>1|3|8|0|2");
    self.FR = Utils.indexToObject(self.components, "0>1|3|8|0|1|0");
    self.PodMassa = Utils.indexToObject(self.components, "0>1|1|2|2|0");
    self.Komp = Utils.indexToObject(self.components, "0>1|1|2|7");
    self.KlawishaMassa = getXMLString(self.xmlFile, "vehicle.KlawishaMassa#animationName");
    self.Monitor = getXMLString(self.xmlFile, "vehicle.Monitor#animationName");
    self.Monitor1 = getXMLString(self.xmlFile, "vehicle.MonitorDisp#animationName");
    self.Zagiganie = getXMLString(self.xmlFile, "vehicle.Zagiganie#animationName");
    self.gearShifter = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.gearShifter#index"));
    self.klawishaLH = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.klawishaLH#index"));
    self.KlawishaFR = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.Klawisha#KlawishaFR"));
    self.dd = {}
    self.dd.f = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.forward#index"));
    self.dd.fa = false;
    self.dd.b = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.backward#index"));
    self.dd.ba = false;
    setVisibility( self.dd.f, false );
    setVisibility( self.dd.b, false );    
    
    local blinkerhebelNode = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.Poworotniki#index"));
    if blinkerhebelNode ~= nil then
        self.blinkerhebel = {};
        self.blinkerhebel.node = blinkerhebelNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.Poworotniki#minRot"));
        self.blinkerhebel.minRot = {};
        self.blinkerhebel.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.blinkerhebel.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.blinkerhebel.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));

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

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

        self.blinkerhebel.rotTime = Utils.getNoNil(getXMLString(self.xmlFile, "vehicle.K744R4.Poworotniki#rotTime"), 1)*1000;
        self.blinkerhebel.lastDir = 1;
    end;

    local gaspedalNode = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.gaspedal#index"));
    if gaspedalNode ~= nil then
        self.gaspedal = {};
        self.gaspedal.node = gaspedalNode;
        self.gaspedal.maxSpeed = getXMLInt(self.xmlFile, "vehicle.K744R4.gaspedal#maxSpeed");
        local x1,y1,z1 = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.gaspedal#minRot"));
        local x2,y2,z2 = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.gaspedal#maxRot"));
        self.gaspedal.rotMin = {math.rad(Utils.getNoNil(x1,0)),math.rad(Utils.getNoNil(y1,0)),math.rad(Utils.getNoNil(z1,0))};
        self.gaspedal.rotMax = {math.rad(Utils.getNoNil(x2,0)),math.rad(Utils.getNoNil(y2,0)),math.rad(Utils.getNoNil(z2,0))};
    end;
    
    local pedalsceplenieNode = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.pedalsceplenie#index"));
    if pedalsceplenieNode ~= nil then
        self.pedalsceplenie = {};
        self.pedalsceplenie.node = pedalsceplenieNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.pedalsceplenie#minRot"));
        self.pedalsceplenie.minRot = {};
        self.pedalsceplenie.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.pedalsceplenie.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.pedalsceplenie.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.pedalsceplenie#maxRot"));
        self.pedalsceplenie.maxRot = {};
        self.pedalsceplenie.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.pedalsceplenie.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.pedalsceplenie.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.pedalsceplenie.rotTime = Utils.getNoNil(getXMLString(self.xmlFile, "vehicle.K744R4.pedalsceplenie#rotTime"), 2)*1000;
    end;
    
    local pedaltormozNode = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.K744R4.pedaltormoz#index"));
    if pedaltormozNode ~= nil then
        self.pedaltormoz = {};
        self.pedaltormoz.node = pedaltormozNode;
        local x, y, z = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.pedaltormoz#minRot"));
        self.pedaltormoz.minRot = {};
        self.pedaltormoz.minRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.pedaltormoz.minRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.pedaltormoz.minRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        x, y, z = Utils.getVectorFromString(getXMLString(self.xmlFile, "vehicle.K744R4.pedaltormoz#maxRot"));
        self.pedaltormoz.maxRot = {};
        self.pedaltormoz.maxRot[1] = Utils.degToRad(Utils.getNoNil(x, 0));
        self.pedaltormoz.maxRot[2] = Utils.degToRad(Utils.getNoNil(y, 0));
        self.pedaltormoz.maxRot[3] = Utils.degToRad(Utils.getNoNil(z, 0));
        self.pedaltormoz.rotTime = Utils.getNoNil(getXMLString(self.xmlFile, "vehicle.K744R4.pedaltormoz#rotTime"), 2)*1000;
    end;
    
end;

function K744R4:delete()
    
end;

function K744R4:readStream(streamId, connection)
end;

function K744R4:writeStream(streamId, connection)
end;

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

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

function K744R4:update(dt)    
    if self.movingDirection > 0 and self.lastSpeed*3600 > 3 and self.dd.fa == false then
        self.dd.fa = true;
        setRotation(self.KlawishaFR, Utils.degToRad(7), 0, 0);
        setVisibility(self.dd.f, true);
        setVisibility(self.F, true);
    elseif self.dd.fa == true and (self.lastSpeed*3600 < 3 or self.movingDirection < 0) then
        self.dd.fa = false;
        setVisibility(self.F, false);
        setRotation(self.KlawishaFR, 0, 0, 0);
        setVisibility(self.dd.f, false);    
    end;
    if self.movingDirection < 0 and self.lastSpeed*3600 > 3 and self.dd.ba == false then
        self.dd.ba = true;
        setRotation(self.KlawishaFR, Utils.degToRad(-7), 0, 0);
        setVisibility(self.dd.b, true);
        setVisibility(self.R, true);
    elseif self.dd.ba == true and (self.lastSpeed*3600 < 3 or self.movingDirection > 0) then
        self.dd.ba = false;
        setVisibility(self.R, false);
        setRotation(self.KlawishaFR, 0, 0, 0);
        setVisibility(self.dd.b, false);    
    end;
    
    local MonitorEnableTimeStartDelay = 0;
    local MonitorEnableTime = (self.motorStartTime - self.motorStartDuration) + MonitorEnableTimeStartDelay;
    local Duration = 2840;
    local DisableTime = MonitorEnableTime + Duration;
    
    local Monitor1EnableTimeStartDelay = 2400;
    local Monitor1EnableTime = (self.motorStartTime - self.motorStartDuration) + Monitor1EnableTimeStartDelay;
    local Duration = 300;
    local DisableTime = Monitor1EnableTime + Duration;

    local ZagiganieEnableTimeStartDelay = 750;
    local ZagiganieEnableTime = (self.motorStartTime - self.motorStartDuration) + ZagiganieEnableTimeStartDelay;
    local Duration = 2040;
    local DisableTime = ZagiganieEnableTime + Duration;
    
    local KlawishaMassaEnableTimeStartDelay = 200;
    local KlawishaMassaEnableTime = (self.motorStartTime - self.motorStartDuration) + KlawishaMassaEnableTimeStartDelay;
    if self.isClient then
        if self.Monitor ~= nil and self.playAnimation ~= nil then
            if (g_currentMission.time <= DisableTime and g_currentMission.time >= MonitorEnableTime  and self.isMotorStarted) then
                self:playAnimation(self.Monitor, 1, nil, true);
            else
                self:playAnimation(self.Monitor, -1, nil, true);
            end;
        end;
        if self.Monitor1 ~= nil and self.playAnimation ~= nil then
            if (g_currentMission.time <= DisableTime and g_currentMission.time >= Monitor1EnableTime  and self.isMotorStarted) then
                self:playAnimation(self.Monitor1, 1, nil, true);
            else
                self:playAnimation(self.Monitor1, -1, nil, true);
            end;
        end;
        if self.Zagiganie ~= nil and self.playAnimation ~= nil then
            if (g_currentMission.time <= DisableTime and g_currentMission.time >= ZagiganieEnableTime  and self.isMotorStarted) then
                self:playAnimation(self.Zagiganie, 1, nil, true);
            else
                self:playAnimation(self.Zagiganie, -1, nil, true);
            end;
        end;
        if self.KlawishaMassa ~= nil and self.playAnimation ~= nil then
            if (g_currentMission.time <= KlawishaMassaEnableTime  and self.isMotorStarted) then
                self:playAnimation(self.KlawishaMassa, 1, nil, true);
            else
                self:playAnimation(self.KlawishaMassa, -1, nil, true);
            end;
        end;    
    end;
    if self.isMotorStarted then
        if self.pedalsceplenie ~= nil then
            local x, y, z = getRotation(self.pedalsceplenie.node);
            local rot = {x,y,z};
            local newRot = Utils.getMovedLimitedValues(rot, self.pedalsceplenie.maxRot, self.pedalsceplenie.minRot, 3, self.pedalsceplenie.rotTime, dt, self.brakeLightsVisibility);
            setRotation(self.pedalsceplenie.node, unpack(newRot));
        end;
        if self.pedaltormoz ~= nil then
            local x, y, z = getRotation(self.pedaltormoz.node);
            local rot = {x,y,z};
            local newRot = Utils.getMovedLimitedValues(rot, self.pedaltormoz.maxRot, self.pedaltormoz.minRot, 3, self.pedaltormoz.rotTime, dt, self.brakeLightsVisibility);
            setRotation(self.pedaltormoz.node, unpack(newRot));
        end;
        if self.tempCnt < 3000 then
            setRotation(self.temperaturZeiger, 0, Utils.degToRad((self.temperaturZeigerMaxRot/10000)*self.tempCnt), 0);
            self.tempCnt = self.tempCnt + 0.5;
        elseif self.tempCnt > 3000 and self.tempCnt < 6000 then
            setRotation(self.temperaturZeiger, 0, Utils.degToRad((self.temperaturZeigerMaxRot/10000)*self.tempCnt), 0);
            self.tempCnt = math.min(self.tempCnt + 0.2, 10000);            
        else
            setRotation(self.temperaturZeiger, 0, Utils.degToRad((self.temperaturZeigerMaxRot/10000)*self.tempCnt), 0);
            self.tempCnt = math.min(self.tempCnt + 0.05, 10000);
        end;
        setVisibility(self.PodMassa, true);
        setVisibility(self.Komp, true);
        setVisibility(self.pust, true);
        setVisibility(self.pust1, true);
        setVisibility(self.pust2, true);
        setVisibility(self.pust3, true);
        setVisibility(self.pust4, true);
        setVisibility(self.podMonitor, true);
    else
        setVisibility(self.PodMassa, false);
        setVisibility(self.Komp, false);
        setVisibility(self.pust, false);
        setVisibility(self.pust1, false);
        setVisibility(self.pust2, false);
        setVisibility(self.pust3, false);
        setVisibility(self.pust4, false);
        setVisibility(self.podMonitor, false);
    end;
        
    if self.isMotorStarted then
        local speed = self.lastSpeed*3600;
        if self.gearShifter ~= nil  then    
            if speed < 0.1 then
                setRotation(self.gearShifter, Utils.degToRad(0),   Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, true);
                setVisibility(self.FR, true);
                setVisibility(self.T, false);
                setVisibility(self.oneS, false);
                setVisibility(self.twoS, false);
                setVisibility(self.threeS, false);
                setVisibility(self.fourS, false);
                
                setVisibility(self.ND, true);
                setVisibility(self.TD, false);
                setVisibility(self.oneSD, false);
                setVisibility(self.twoSD, false);
                setVisibility(self.threeSD, false);
                setVisibility(self.fourSD, false);
            else
            if speed >= 0.1 and speed < 0.3 then
                setRotation(self.gearShifter, Utils.degToRad(-20), Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, false);
                setVisibility(self.FR, false);
                setVisibility(self.T, true);
                setVisibility(self.oneS, false);
                setVisibility(self.twoS, false);
                setVisibility(self.threeS, false);
                setVisibility(self.fourS, false);
                
                setVisibility(self.ND, false);
                setVisibility(self.TD, true);
                setVisibility(self.oneSD, false);
                setVisibility(self.twoSD, false);
                setVisibility(self.threeSD, false);
                setVisibility(self.fourSD, false);
            elseif speed >= 0.3 and speed < 8 then
                setRotation(self.gearShifter, Utils.degToRad(10), Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, false);
                setVisibility(self.FR, false);
                setVisibility(self.T, false);
                setVisibility(self.oneS, true);
                setVisibility(self.twoS, false);
                setVisibility(self.threeS, false);
                setVisibility(self.fourS, false);
                
                setVisibility(self.ND, false);
                setVisibility(self.TD, false);
                setVisibility(self.oneSD, true);
                setVisibility(self.twoSD, false);
                setVisibility(self.threeSD, false);
                setVisibility(self.fourSD, false);
            elseif speed >= 8 and speed < 22 then
                setRotation(self.gearShifter, Utils.degToRad(20), Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, false);
                setVisibility(self.FR, false);
                setVisibility(self.T, false);
                setVisibility(self.oneS, false);
                setVisibility(self.twoS, true);
                setVisibility(self.threeS, false);
                setVisibility(self.fourS, false);
                
                setVisibility(self.ND, false);
                setVisibility(self.TD, false);
                setVisibility(self.oneSD, false);
                setVisibility(self.twoSD, true);
                setVisibility(self.threeSD, false);
                setVisibility(self.fourSD, false);
            elseif speed >= 22 and speed < 35 then
                setRotation(self.gearShifter, Utils.degToRad(30),  Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, false);
                setVisibility(self.FR, false);
                setVisibility(self.T, false);
                setVisibility(self.oneS, false);
                setVisibility(self.twoS, false);
                setVisibility(self.threeS, true);
                setVisibility(self.fourS, false);
                
                setVisibility(self.ND, false);
                setVisibility(self.TD, false);
                setVisibility(self.oneSD, false);
                setVisibility(self.twoSD, false);
                setVisibility(self.threeSD, true);
                setVisibility(self.fourSD, false);
            elseif speed >= 35 and speed < 45 then
                setRotation(self.gearShifter, Utils.degToRad(40),  Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.N, false);
                setVisibility(self.FR, false);
                setVisibility(self.T, false);
                setVisibility(self.oneS, false);
                setVisibility(self.twoS, false);
                setVisibility(self.threeS, false);
                setVisibility(self.fourS, true);
                
                setVisibility(self.ND, false);
                setVisibility(self.TD, false);
                setVisibility(self.oneSD, false);
                setVisibility(self.twoSD, false);
                setVisibility(self.threeSD, false);
                setVisibility(self.fourSD, true);
            end;
        end;
        if self.klawishaLH ~= nil then 
            if speed < 0.1 then
                setRotation(self.klawishaLH, Utils.degToRad(12),   Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.L, false);
                setVisibility(self.H, false);
                setVisibility(self.LD, false);
                setVisibility(self.HD, false);
            elseif speed >= 0.1 and speed < 15 then
                setRotation(self.klawishaLH, Utils.degToRad(20), Utils.degToRad(0), Utils.degToRad(0));
                setVisibility(self.L, true);
                setVisibility(self.H, false);
                setVisibility(self.LD, true);
                setVisibility(self.HD, false);
            elseif speed >= 15 and speed < 45 then
                setVisibility(self.L, false);
                setVisibility(self.H, true);
                setVisibility(self.LD, false);
                setVisibility(self.HD, true);
                setRotation(self.klawishaLH, Utils.degToRad(6), Utils.degToRad(0), Utils.degToRad(0));
            end;
        end;  
    end;
    end;
    
    if self:getIsActive() then
        if self.vehicleCharacter.isCharacterLoaded then
            for ikChainId, target in pairs(self.vehicleCharacter.ikChainTargets) do
                IKUtil.setTarget(self.vehicleCharacter.ikChains, ikChainId, target);
            end;
            self.vehicleCharacter:setCharacterDirty();
        end
    end
end;

function K744R4:attachImplement(implement)
end;

function K744R4:detachImplement(implementIndex)
end;

function K744R4:updateTick(dt)
    if self.isClient then
        if self:getIsMotorStarted() then
            if self.tahometrHud ~= nil then
                VehicleHudUtils.setHudValue(self, self.tahometrHud, self.motor:getEqualizedMotorRpm(), self.motor:getMaxRpm());
            end
        end
    end
    if self:getIsActive() then
        if self.turnLightState ~= nil then
            if self.blinkerhebel ~= nil then
                local dir = 0;
                local hasRotChanged = false;
                local destRot = self.blinkerhebel.minRot;
                
                if self.turnLightState == 1 then
                    destRot = self.blinkerhebel.leftRot;
                    dir = 1;
                elseif self.turnLightState == 2 then
                    destRot = self.blinkerhebel.rightRot;
                    dir = -1;
                end
                
                if self.blinkerhebel.lastDir ~= dir then
                    self.blinkerhebel.lastDir = dir;
                    self.blinkerhebel.rotatingTime = 0;
                end
                
                if self.blinkerhebel.rotatingTime ~= nil then
                    self.blinkerhebel.rotatingTime = self.blinkerhebel.rotatingTime + dt;
                    local t = math.min(1.0, self.blinkerhebel.rotatingTime / self.blinkerhebel.rotTime);
                    if t == 1 then
                        self.blinkerhebel.rotatingTime = nil;
                    end
                    local rot = {getRotation(self.blinkerhebel.node)};
                    
                    local rx1,ry1,rz1,rw1 = mathEulerToQuaternion(unpack(rot));
                    local rx2,ry2,rz2,rw2 = mathEulerToQuaternion(unpack(destRot));
                    
                    local qx,qy,qz,qw = Utils.nlerpQuaternionShortestPath(rx1,ry1,rz1,rw1, rx2,ry2,rz2,rw2, t);
                    setQuaternion(self.blinkerhebel.node, qx,qy,qz,qw);
                end
            end;
        end;
        if self.camIndex == 2 then
            if self.gaspedal ~= nil then
                local percent = (self.lastSpeed*self.speedDisplayScale*3600) / self.gaspedal.maxSpeed;
                local minRot = self.gaspedal.rotMin;
                local maxRot = self.gaspedal.rotMax;

                local x = minRot[1] + (maxRot[1] - minRot[1]) * percent;
                local y = minRot[2] + (maxRot[2] - minRot[2]) * percent;
                local z = minRot[3] + (maxRot[3] - minRot[3]) * percent;
                setRotation(self.gaspedal.node, x, y, z);
            end;
        else
            setRotation(self.gaspedal.node, unpack(self.gaspedal.rotMin));
        end;
    end;
end;

function K744R4:draw()
end;
