--
-- 
-- Autor: Siwus
--

Plandeka = {};

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

function Plandeka:load(xmlFile)
	self.PlaneNodeO = Utils.indexToObject(self.components, getXMLString(xmlFile,"vehicle.Plandeka#indexOpen"));
	self.PlaneNodeC = Utils.indexToObject(self.components, getXMLString(xmlFile,"vehicle.Plandeka#indexClose"));
	self.isOpen = true;
	setVisibility(self.PlaneNodeO, not self.isOpen);
	setVisibility(self.PlaneNodeC, self.isOpen);
end;

function Plandeka:delete()
end;

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

function Plandeka:keyEvent(unicode, sym, modifier, isDown)
	if isDown and sym == Input.KEY_z then
		self.isOpen = not self.isOpen;
	end;
end;

function Plandeka:update(dt)	
	if self:getIsActive() and self:getIsActiveForInput() then
		setVisibility(self.PlaneNodeO, not self.isOpen);
		setVisibility(self.PlaneNodeC, self.isOpen);
	end;
end;


function Plandeka:draw()
	if self.isOpen then
		g_currentMission:addExtraPrintText(string.format("Ukryj konsole: Z"));
	else
		g_currentMission:addExtraPrintText(string.format("Pokaż konsole: Z"));
	end;
end;


function Plandeka:onAttach(attacherVehicle)
end;


function Plandeka:onDetach()
end;


function Plandeka:onLeave()
end;


function Plandeka:onDeactivate()
end;


function Plandeka:onDeactivateSounds()
end;
