--[[Autor: Patar
    Idee : the Death
    Helfer: sven777b (nur für die funktion des abrufens der capazität und des Fülstandes aller anhänger
    Modell: Ferddy.com

		danke an Freddy für das super mode, danke an sven für die hilfe, immer wenn ich ihn brauche, und danke an meinen Bruder für die Idee ;) 
	
	
	- edit @ date: 			13/03/13
	- add lamp number 26: 	Ifko[nator]
	]]--


greenstar = {};

function greenstar.prerequisitesPresent(specializations)
    return true;
end;
function greenstar:load(xmlFile)
	local lampscount = Utils.getNoNil(getXMLInt(xmlFile, "vehicle.lamps#count"), 0);
	self.lamps = {};
	if lampscount ~= 0 then
		for i=1, lampscount do
			local lampnumber = string.format("vehicle.lamps.lamp%d", i);	
			self.lamps[i] = Utils.indexToObject(self.components, getXMLString(xmlFile, lampnumber .. "#index"));	
		end;	
	end;
end;
function greenstar:delete()
end;
function greenstar:mouseEvent(posX, posY, isDown, isUp, button)
end;
function greenstar:keyEvent(unicode, sym, modifier, isDown)
end;
function greenstar:update(dt)
	local f,c = self:getAttachedTrailersFillLevelAndCapacity();
if f and c ~= nil then
	local prozent = f/c*100;
	if prozent >= 2 then
		setVisibility(self.lamps[1], true)
	else
		setVisibility(self.lamps[1], false)
	end;
	if prozent >= 4 then
		setVisibility(self.lamps[2], true)
	else
		setVisibility(self.lamps[2], false)
	end;
	if prozent >= 8 then
		setVisibility(self.lamps[3], true)
	else
		setVisibility(self.lamps[3], false)
	end;
	if prozent >= 12 then
		setVisibility(self.lamps[4], true)
	else
		setVisibility(self.lamps[4], false)
	end;
	if prozent >= 16 then
		setVisibility(self.lamps[5], true)
	else
		setVisibility(self.lamps[5], false)
	end;
	if prozent >= 20 then
		setVisibility(self.lamps[6], true)
	else
		setVisibility(self.lamps[6], false)
	end;
	if prozent >= 24 then
		setVisibility(self.lamps[7], true)
	else
		setVisibility(self.lamps[7], false)
	end;
	if prozent >= 28 then
		setVisibility(self.lamps[8], true)
	else
		setVisibility(self.lamps[8], false)
	end;
	if prozent >= 32 then
		setVisibility(self.lamps[9], true)
	else
		setVisibility(self.lamps[9], false)
	end;
	if prozent >= 36 then
		setVisibility(self.lamps[10], true)
	else
		setVisibility(self.lamps[10], false)
	end
	if prozent >= 40 then
		setVisibility(self.lamps[11], true)
	else
		setVisibility(self.lamps[11], false)
	end;
	if prozent >= 44 then
		setVisibility(self.lamps[12], true)
	else
		setVisibility(self.lamps[12], false)
	end;
	if prozent >= 48 then
		setVisibility(self.lamps[13], true)
	else
		setVisibility(self.lamps[13], false)
	end;
	if prozent >= 52 then
		setVisibility(self.lamps[14], true)
	else
		setVisibility(self.lamps[14], false)
	end;
	if prozent >= 56 then
		setVisibility(self.lamps[15], true)
	else
		setVisibility(self.lamps[15], false)
	end;
	if prozent >= 60 then
		setVisibility(self.lamps[16], true)
	else
		setVisibility(self.lamps[16], false)
	end;
	if prozent >= 64 then
		setVisibility(self.lamps[17], true)
	else
		setVisibility(self.lamps[17], false)
	end;
	if prozent >= 68 then
		setVisibility(self.lamps[18], true)
	else
		setVisibility(self.lamps[18], false)
	end;
	if prozent >= 72 then
		setVisibility(self.lamps[19], true)
	else
		setVisibility(self.lamps[19], false)
	end;
	if prozent >= 76 then
		setVisibility(self.lamps[20], true)
	else
		setVisibility(self.lamps[20], false)
	end;
	if prozent >= 80 then
		setVisibility(self.lamps[21], true)
	else
		setVisibility(self.lamps[21], false)
	end;
	if prozent >= 84 then
		setVisibility(self.lamps[22], true)
	else
		setVisibility(self.lamps[22], false)
	end;
	if prozent >= 88 then
		setVisibility(self.lamps[23], true)
	else
		setVisibility(self.lamps[23], false)
	end;
	if prozent >= 92 then
		setVisibility(self.lamps[24], true)
	else
		setVisibility(self.lamps[24], false)
	end;
	if prozent >= 96 then
		setVisibility(self.lamps[25], true)
	else
		setVisibility(self.lamps[25], false)
	end;
	if prozent >= 100 then
		setVisibility(self.lamps[26], true)
	else
		setVisibility(self.lamps[26], false)
	end;
end;
end;
function greenstar:draw()
end;
function greenstar:detachImplement(implement)
	for i = 1,26 do
		setVisibility(self.lamps[i], false)
	end;
end;