-- ##########################################################
-- #	lowFuelIndicator									#
-- #														#
-- #	author: Webby										#
-- #	Date: 28.06.2012									#
-- #	version: 1.0										#
-- #														#
-- #	BIG THX 2 bazillus, modelleicher and bassaddict		# 
-- #			for helping me with this script!			#
-- #														#
-- #		   DO NOT COPY OR CHANGE THIS SCRIPT!			#
-- #														#
-- #Änderung zur V 1.0			                    		#
-- #Einbau automatisch in alle Fahrzeuge Mods               #
-- #und Standartfahrzeuge.Ohne zusätzliche Änderungen in der#
-- #moddesc. Bluebaby210                                    #
-- ##########################################################

lowFuelIndicator = {};
lowFuelIndicator.modDir = g_currentModDirectory;

function lowFuelIndicator.prerequisitesPresent(specializations)
    return SpecializationUtil.hasSpecialization(Motorized, specializations);
end;

function lowFuelIndicator:load(xmlFile)
	
	self.lowFuelIndicatorHud = Overlay:new("lowFuelIndicatorOverlay", (lowFuelIndicator.modDir.."textures/fuelIndicator.png"), 0.925, 0.55, 0.080, 0.085);
	
	lowFuelSoundFile = Utils.getFilename(lowFuelIndicator.modDir.."scripts/fuelIndicator_bing.wav");
    self.lowFuelSoundId = createSample("LFSound");
    loadSample(self.lowFuelSoundId, lowFuelSoundFile, false);
	self.lowFuelSoundPlaying = false;
	self.playedSound = false;
end;

function lowFuelIndicator:delete()
end;

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

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

function lowFuelIndicator:update(dt)
end;

function lowFuelIndicator:draw()
	if self.fuelFillLevel <= (self.fuelCapacity / 100) * 10 then -- Hier die 20 in eine beliebige andere Zahl ändern! Die 20 steht für 20% Resttankvolumen.
		self.lowFuelIndicatorHud:render();
		if self.playedSound == false then
			playSample(self.lowFuelSoundId,1,1,0);
			self.playedSound = true;
		end;
		else
			self.playedSound = false;
	end;
end;
