local metadata = {
"## Interface:FS17 1.4.4",
"## Title: startUp",
"## Notes: See lua notes.",
"## Author: GTX MODS",
"## Version: 1.0",
"## Date: 28.03.2017",
"## Web: http://www.gtxmods.com/"
}

--[[

Credits:
startUp.lua by GTX MODS

History:
V 1.0 @ 28.03.2017 - Initial Release by GTX MODS

Free to use and edit but please keep credits and update Version Number and descriptions. If edited, send us a copy we would love to see it > http://www.gtxmods.com/contact-us/ 

Can be used for the following:

1. dayLights    -  Set Visibility of DayTime Lights on start up.
2. hudDisplay1  -  Can be used to display Indoor Huds on start up with no delay. (e.g. Digital Screens)
3. hudDisplay2  -  Can be used to display Indoor Huds on start up with no delay. (e.g. Digital Numbers)
4. logoDisplay & screenDisplay  -  Used togethor to display a logo and then revert to a standard screen display. Logo hang time can be adjusted in xml.  (1000 = 1 sec)

EXAMPLE FOR XML:
<startUp logoDisplayTime= "3000">
    <dayLights index= "0|0"/>
    <hudDisplay1 index= "0|0"/>
    <hudDisplay2 index= "0|0"/>
    <logoDisplay index= "0|0"/>
    <screenDisplay index= "0|0"/>
</startUp>

]]

startUp = {};

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

function startUp:load(savegame)
    self.startUp = {};
    
    local node = "vehicle.startUp.";
    self.startUp.LT = Utils.getNoNil(getXMLFloat(self.xmlFile, "vehicle.startUp#logoDisplayTime"),3000);
    self.startUp.WT = 1;
    self.logoDisplay = Utils.indexToObject(self.components, getXMLString(self.xmlFile, node.."logoDisplay#index"));
    self.screenDisplay = Utils.indexToObject(self.components, getXMLString(self.xmlFile, node.."screenDisplay#index"));
    self.dayLights = Utils.indexToObject(self.components, getXMLString(self.xmlFile, node.."dayLights#index"));    
    self.hudDisplay1 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, node.."hudDisplay1#index"));
    self.hudDisplay2 = Utils.indexToObject(self.components, getXMLString(self.xmlFile, node.."hudDisplay2#index"));    
end;    
    
function startUp:update(dt)
    if self.dayLights ~= nil then
        if self.isMotorStarted    
            then setVisibility(self.dayLights, true);
            else setVisibility(self.dayLights, false);
        end
    end;
    if self.hudDisplay1 ~= nil then
        if self.isMotorStarted    
            then setVisibility(self.hudDisplay1, true);
            else setVisibility(self.hudDisplay1, false);
        end
    end;
    if self.hudDisplay2 ~= nil then
        if self.isMotorStarted    
            then setVisibility(self.hudDisplay2, true);
            else setVisibility(self.hudDisplay2, false);
        end
    end;
    if self.logoDisplay ~= nil then if self.screenDisplay ~= nil then
        if self.isMotorStarted then 
        if self.startUp.WT < self.startUp.LT 
            then setVisibility(self.logoDisplay, true); setVisibility(self.screenDisplay, false);
        end;
        if self.startUp.WT < (self.startUp.LT + self.startUp.LT) and self.startUp.WT > self.startUp.LT
            then setVisibility(self.logoDisplay, false); setVisibility(self.screenDisplay, true);
        end;
            self.startUp.WT = self.startUp.WT + dt;
                else self.startUp.WT = 1; setVisibility(self.logoDisplay, false); setVisibility(self.screenDisplay, false);
            end;
        end;
    end;
end;
    
function startUp:keyEvent(unicode, sym, modifier, isDown)
end;

function startUp:draw()
end;

function startUp:delete()
end;

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