--
-- Fendt936
--
--
--

Fendt936 = {};

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

function Fendt936:load(savegame)
    self.dd = {}
    self.dd.f = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.driveDir.forward#index"));
    self.dd.fa = false;
    self.dd.b = Utils.indexToObject(self.components, getXMLString(self.xmlFile, "vehicle.driveDir.backward#index"));
    self.dd.ba = false;
    setVisibility( self.dd.f, false );
    setVisibility( self.dd.b, false );
    print(" FENDT 900 VARIO by Jukka ");
end;

function Fendt936:delete()

end

function Fendt936:readStream(streamId, connection)
end;

function Fendt936:writeStream(streamId, connection)
end;

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

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

function Fendt936:update(dt)    
    if self.movingDirection > 0 and self.lastSpeed*3600 > 3 and self.dd.fa == false then
        self.dd.fa = true;
        setVisibility(self.dd.f, true);
    elseif self.dd.fa == true and (self.lastSpeed*3600 < 3 or self.movingDirection < 0) then
        self.dd.fa = false;
        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;
        setVisibility(self.dd.b, true);
    elseif self.dd.ba == true and (self.lastSpeed*3600 < 3 or self.movingDirection > 0) then
        self.dd.ba = false;
        setVisibility(self.dd.b, false);    
    end;
    
end;

function Fendt936:updateTick(dt)
    
end;

function Fendt936:onLeave()
end;

function Fendt936:draw()
end;
