Skip to content

Commit

Permalink
fix landing lights
Browse files Browse the repository at this point in the history
  • Loading branch information
zodiac1214 committed Apr 12, 2024
1 parent de0d0fa commit 6f5ba7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions xa-cabin/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@ function HELPERS.is_door_open()
return XA_CABIN_PLANE_CONFIG.DOOR["Func"](XA_CABIN_DATAREFS.DOOR[0], false)
end

function HELPERS.is_rwy_ligths_on()
if XA_CABIN_DATAREFS.RWY_LIGHTS == nil then
XA_CABIN_DATAREFS.RWY_LIGHTS = dataref_table(XA_CABIN_PLANE_CONFIG.RWY_LIGHTS.dataref_str)
function HELPERS.is_landing_ligths_on()
if XA_CABIN_DATAREFS.LANDING_LIGHTS == nil then
XA_CABIN_DATAREFS.LANDING_LIGHTS = dataref_table(XA_CABIN_PLANE_CONFIG.LANDING_LIGHTS.dataref_str)
local funcCode = [[
return function(x, debug)
if debug then
LOGGER.write_log('Dataref: ' .. x)
LOGGER.write_log('Debug: ' .. tostring(debug))
end
return x]] .. XA_CABIN_PLANE_CONFIG.RWY_LIGHTS.operator .. XA_CABIN_PLANE_CONFIG.RWY_LIGHTS.threshold .. [[
return x]] .. XA_CABIN_PLANE_CONFIG.LANDING_LIGHTS.operator .. XA_CABIN_PLANE_CONFIG.LANDING_LIGHTS.threshold .. [[
end
]]
XA_CABIN_PLANE_CONFIG.RWY_LIGHTS["Func"] = load(funcCode)()
XA_CABIN_PLANE_CONFIG.LANDING_LIGHTS["Func"] = load(funcCode)()
end
return XA_CABIN_PLANE_CONFIG.RWY_LIGHTS["Func"](XA_CABIN_DATAREFS.RWY_LIGHTS[0], false)
return XA_CABIN_PLANE_CONFIG.LANDING_LIGHTS["Func"](XA_CABIN_DATAREFS.LANDING_LIGHTS[0], false)
end

return HELPERS
2 changes: 1 addition & 1 deletion xa-cabin/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ function STATE.update_cabin_state()
end

if XA_CABIN_STATES.cabin_state.current_state == "safety_demonstration" then
if HELPERS.is_rwy_ligths_on() and XA_CABIN_STATES.flight_state.taxi_out then
if HELPERS.is_landing_ligths_on() and XA_CABIN_STATES.flight_state.taxi_out then
change_cabin_state("takeoff")
end
return
Expand Down

0 comments on commit 6f5ba7d

Please sign in to comment.