#Conditional Hooks
$Application: FS2_Open

$On Game Init:
[
    ba.print("Hello World")
    require "droneWeapon.lua"
	require "shipAbilities.lua"
	require "Util.lua"
]



$On Mission End: [
	AbilityTable.energyStored = 150;
	AbilityTable.energyRegenRate = 3 -- Energy Regenerates at x per second
	AbilityTable.energyStoredMax = 150 -- "Fun"
	AbilityTable.gameActive = false
	AbilityTable.casterShip = "CATS!"
]

$On HUD Draw:
[
	if hu.HUDDrawn and AbilityTable.gameActive == true then
		local gauge = hu.getHUDGaugeHandle("Target Monitor")
		local BaseWidth = 0
		local BaseHeight = 0
		BaseWidth, BaseHeight = gauge:getBaseResolution()
		

		gr.setScreenScale(BaseWidth, BaseHeight)
		local Font = gauge:getFont()

		gr.setColor(255,255,255)
		gr.drawString("Energy Stored: "..AbilityTable.energyStored.."/"..AbilityTable.energyStoredMax, 5,5)
		
		
		local y = 5
		for i = 1, 4, 1 do
			local x = 10
		    local string = "Ability Is Off Cooldown"
		    if AbilityTable[i].abilityAllowed then
		        y = y + 10
		        string = "Ability "

		        gr.drawString("Ability ", x, y)
		        x = gr.getStringWidth(string) + x

		        string = AbilityTable[i].abilityName.." "
		        if AbilityTable[i].abilityReady then
		            gr.setColor(0,255,0)
		        else
		            gr.setColor(255,0,0)
		        end
		        gr.drawString(string,x,y)
		        x = x + gr.getStringWidth(string)

		        gr.setColor(255,255,255)
		        if AbilityTable[i].abilityReady then
		            gr.drawString("Is Ready",x,y)
		        else
		            gr.drawString("Is Not Ready",x,y)
		        end
		    end
		end
		

		local prevFont = gr.CurrentFont
        local prevMode = gr.CurrentResizeMode
        gr.CurrentFont = Font
        gr.CurrentResizeMode = GR_RESIZE_FULL
        gr.setScreenScale(BaseWidth, BaseHeight)

		gr.CurrentFont = prevFont
        gr.CurrentResizeMode = prevMode
        gr.resetScreenScale()
	end
]

$Keypress: 1
$On Key Pressed: [
	AbilityTable.keyPress(1)
]

$Keypress: 2
$On Key Pressed: [
	AbilityTable.keyPress(2)
]

$Keypress: 3
$On Key Pressed: [
	AbilityTable.keyPress(3)
]

$Keypress: 4
$On Key Pressed: [
	AbilityTable.keyPress(4)
]

#End
