-- $LastChangedDate: 2010-05-25 21:26:05 -0400 (Tue, 25 May 2010) $
-- LEGAL: COPYRIGHT (C) 2010 JIM E. BROOKS WWW.PALOMINO3D.ORG
--
-- **PROGRAM-SPECIFIC** library of Lua objects to interface with simulator.
--
-- This extends and supplements what C++ exports to Lua.
-- See module.txt for documentation and pitfalls.
-- Notes: Use Vec3() instead of tables (XX=0).

--------------
-- Aircraft --
--------------

-- Aircraft::eType enums.
sim.Aircraft.type_Spitfire     = 0
sim.Aircraft.type_Corsair      = 1
sim.Aircraft.type_P51          = 2
sim.Aircraft.type_F82          = 3
sim.Aircraft.type_F86          = 4
sim.Aircraft.type_A4           = 5
sim.Aircraft.type_F14          = 6
sim.Aircraft.type_F15          = 7
sim.Aircraft.type_F16          = 8
sim.Aircraft.type_F18          = 9
sim.Aircraft.type_SR71         = 10
sim.Aircraft.type_Mirage2000   = 11
sim.Aircraft.type_SU37         = 12
sim.Aircraft.type_SpaceShuttle = 13
-- (special case aircraft that cannot be selected by user)
sim.Aircraft.type_Sikorsky     = 100

-- Map cmdline args to C++ enums.
sim.Aircraft.typeArgMap = {
    ["-spitfire"]   = sim.Aircraft.type_Spitfire,
    ["-corsair"]    = sim.Aircraft.type_Corsair,
    ["-f4u"]        = sim.Aircraft.type_Corsair,  -- alias
    ["-p51"]        = sim.Aircraft.type_P51,
    ["-f82"]        = sim.Aircraft.type_F82,
    ["-f86"]        = sim.Aircraft.type_F86,
    ["-a4"]         = sim.Aircraft.type_A4,
    ["-f14"]        = sim.Aircraft.type_F14,
    ["-f15"]        = sim.Aircraft.type_F15,
    ["-f16"]        = sim.Aircraft.type_F16,
    ["-f18"]        = sim.Aircraft.type_F18,
    ["-sr71"]       = sim.Aircraft.type_SR71,
    ["-mirage"]     = sim.Aircraft.type_Mirage2000,
    ["-su37"]       = sim.Aircraft.type_SU37,
    ["-shuttle"]    = sim.Aircraft.type_SpaceShuttle,
}

sim.Aircraft.longNameTypeMap = {
    ["Spitfire"]          = sim.Aircraft.type_Spitfire,
    ["F4U Corsair"]       = sim.Aircraft.type_Corsair,
    ["P-51 Mustang"]      = sim.Aircraft.type_P51,
    ["F-82 Twin Mustang"] = sim.Aircraft.type_F82,
    ["F-86 Sabre"]        = sim.Aircraft.type_F86,
    ["A-4 Skyhawk"]       = sim.Aircraft.type_A4,
    ["F-14 Tomcat"]       = sim.Aircraft.type_F14,
    ["F-15 Eagle"]        = sim.Aircraft.type_F15,
    ["F-16 Falcon"]       = sim.Aircraft.type_F16,
    ["F-18 Hornet"]       = sim.Aircraft.type_F18,
    ["SR-71 Blackbird"]   = sim.Aircraft.type_SR71,
    ["Mirage 2000"]       = sim.Aircraft.type_Mirage2000,
    ["SU-37 Flanker"]     = sim.Aircraft.type_SU37,
    ["Space Shuttle"]     = sim.Aircraft.type_SpaceShuttle,
}

sim.Aircraft.names = {
    [sim.Aircraft.type_Spitfire]     = "Spitfire",
    [sim.Aircraft.type_Corsair]      = "F4U",
    [sim.Aircraft.type_P51]          = "P51",
    [sim.Aircraft.type_F82]          = "F82",
    [sim.Aircraft.type_F86]          = "F86",
    [sim.Aircraft.type_A4]           = "A4",
    [sim.Aircraft.type_F14]          = "F14",
    [sim.Aircraft.type_F15]          = "F15",
    [sim.Aircraft.type_F16]          = "F16",
    [sim.Aircraft.type_F18]          = "F18",
    [sim.Aircraft.type_SR71]         = "SR71",
    [sim.Aircraft.type_Mirage2000]   = "Mirage",
    [sim.Aircraft.type_SU37]         = "SU37",
    [sim.Aircraft.type_SpaceShuttle] = "Space Shuttle",
}

-------------
-- Carrier --
-------------

-- Parking slots for aircraft on carrier.
-- In meters, relative to carrier.
sim.Carrier.slots = {
    Vec3( -3.0, -197.0, 21.75 ),  -- takeoff slot 1 (rear deck)
    Vec3(  3.0, -177.0, 21.75 ),  -- takeoff slot 2 (rear deck)
    Vec3(  7.0,  -27.5, 21.75 ),  -- takeoff slot 3 (front deck)
    Vec3( 14.0, -120.0, 21.75 ),
    Vec3( 12.0, -100.0, 21.75 ),
    Vec3(  7.0,  -80.0, 21.75 ),
    Vec3(  4.0,  -60.0, 21.75 ),
}
sim.Carrier.takeoffSlotCount = 3
