Skip to content

Commit

Permalink
fix: crash when bomb releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
luizrenault committed Mar 18, 2023
1 parent b26ccc2 commit 6f1c44d
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 1,523 deletions.
7 changes: 3 additions & 4 deletions Cockpit/Scripts/Systems/externalanimations.lua
Expand Up @@ -125,18 +125,17 @@ function update()
EICAS_RPM:set(propRPM)
local propStep = propRPM / 60 * update_time_step
propState = (propState + propStep)%1
set_aircraft_draw_argument_value(370,propState)

--keeps prop animation between 0 and 1
if propRPM < 800 then
propState = (propState + propStep)%1
set_aircraft_draw_argument_value(475,0)
set_aircraft_draw_argument_value(1475,0)
set_aircraft_draw_argument_value(DRAW_FAN,propState)
set_aircraft_draw_argument_value(413,1)
else
propState = (propState + propStep/100)%1
set_aircraft_draw_argument_value(413,0)
set_aircraft_draw_argument_value(475,-1)
set_aircraft_draw_argument_value(475,1)
set_aircraft_draw_argument_value(1475,1)
set_aircraft_draw_argument_value(DRAW_FAN,propState)
end

Expand Down
22 changes: 9 additions & 13 deletions Cockpit/Scripts/Systems/ils.lua
Expand Up @@ -2,9 +2,6 @@ dofile(LockOn_Options.common_script_path.."devices_defs.lua")
dofile(LockOn_Options.script_path.."devices.lua")
dofile(LockOn_Options.script_path.."command_defs.lua")

package.cpath = package.cpath..";".. LockOn_Options.script_path.. "..\\..\\bin\\?.dll"
require('avSimplestWeaponSystem')

local dev = GetSelf()

local update_time_step = 0.05
Expand All @@ -22,30 +19,29 @@ local ADHSI_ILS_FREQ = get_param_handle("ADHSI_ILS_FREQ")
local ils_freq = 0;

function update()
local glideslopeValid = avSimplestILS.isGlideslopeValid()
local localizerValid = avSimplestILS.isLocalizerValid()
local glideslopeDeviation = avSimplestILS.getGlideslopeDeviation()
local localizerDeviation = avSimplestILS.getLocalizerDeviation()
local ilsOn = avSimplestILS.getElecPower()
local glideslopeValid = dev:isGlideslopeValid()
local localizerValid = dev:isLocalizerValid()
local glideslopeDeviation = dev:getGlideslopeDeviation()
local localizerDeviation = dev:getLocalizerDeviation()
local ilsOn = dev:getElecPower()
NAV_ILS_GS_VALID:set(glideslopeValid and 1 or 0)
NAV_ILS_GS_DEV:set(glideslopeDeviation)
NAV_ILS_LOC_VALID:set(localizerValid and 1 or 0)
NAV_ILS_LOC_DEV:set(localizerDeviation)
local ils_freq_new = ADHSI_ILS_FREQ:get()
if ils_freq ~= ils_freq_new then
ils_freq = ils_freq_new
avSimplestILS.setFrequencyMHz(math.floor(ils_freq))
avSimplestILS.setFrequencyKHz(math.floor((ils_freq%1)*1000))
dev:setFrequencyMHz(math.floor(ils_freq))
dev:setFrequencyKHz(math.floor((ils_freq%1)*1000))
end

-- print_message_to_user("avILS On: ".. tostring(ilsOn) .." GV: " .. tostring(glideslopeValid) .. " LV: " .. tostring(localizerValid))
-- print_message_to_user("avILS GD: " .. glideslopeDeviation .. " LD: " .. localizerDeviation)
-- print_message_to_user("avILS GF: " .. avSimplestILS.getGlideslopeFrequency() .. " LF: " .. avSimplestILS.getLocalizerFrequency())
-- print_message_to_user("avILS GF: " .. dev:getGlideslopeFrequency() .. " LF: " .. dev:getLocalizerFrequency())
end

function post_initialize()
avSimplestILS.Setup(devices.ILS, devices.ELECTRIC_SYSTEM)
avSimplestILS.setElecPower(true)
dev:setElecPower(true)
end

function SetCommand(command,value)
Expand Down

0 comments on commit 6f1c44d

Please sign in to comment.