TX65 = {};

function TX65.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Combine, specializations);
end;

function TX65:load(xmlFile)
	self.Majaky = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tx65Controls.majaky#node"));
	self.Rucka = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tx65Controls.rucka#node"));
	self.Sypani = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tx65Controls.sypani#node"));
	self.TX65Kombajn = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.tx65Controls.kombajn#node"));
	self.sype = false;
	self.krok = false;
	self.pocetKroku = 0;
end;

function TX65:delete()
end;

function TX65:readStream(streamId, connection)
end;

function TX65:writeStream(streamId, connection)
end;

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

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

function TX65:update(dt)
	if self:getIsActive() then
		if self.beaconLightsActive then
			setVisibility(self.Majaky,true);
		else
			setVisibility(self.Majaky,false);
		end;
		if self.handbrake then
			setVisibility(self.Rucka,true);
		else
			setVisibility(self.Rucka,false);
		end;
		if InputBinding.hasEvent(InputBinding.EMPTY_GRAIN) then
			if not self.sype then
				setVisibility(self.Sypani,true);
			else
				setVisibility(self.Sypani,false);
				self.pocetKroku = 0;
				setTranslation(self.TX65Kombajn, 0, 0, 0);
			end;
			self.sype = not self.sype;
		end;
	end;
	
	if self.sype then
		if self.pocetKroku == 0 then
			setTranslation(self.TX65Kombajn, -0.002, 0.002, 0);
			self.pocetKroku = 1;
		elseif self.pocetKroku == 1 then
			setTranslation(self.TX65Kombajn, -0.004, 0.004, 0);
			self.pocetKroku = 2;
		elseif self.pocetKroku == 2 then
			setTranslation(self.TX65Kombajn, -0.002, 0.002, 0);
			self.pocetKroku = 3;
		elseif self.pocetKroku == 3 then
			setTranslation(self.TX65Kombajn, 0, 0, 0);
			self.pocetKroku = 4;
		elseif self.pocetKroku == 4 then
			setTranslation(self.TX65Kombajn, 0.002, -0.002, 0);
			self.pocetKroku = 5;
		elseif self.pocetKroku == 5 then
			setTranslation(self.TX65Kombajn, 0.004, -0.004, 0);
			self.pocetKroku = 6;
		elseif self.pocetKroku == 6 then
			setTranslation(self.TX65Kombajn, 0.002, -0.002, 0);
			self.pocetKroku = 7;
		elseif self.pocetKroku == 7 then
			setTranslation(self.TX65Kombajn, 0, 0, 0);
			self.pocetKroku = 0;
		end;
	end;
end;

function TX65:updateTick(dt)
end;

function TX65:draw()	
end;