
dofile(LockOn_Options.script_path .. "command_defs.lua")
local dev = GetSelf()
local update_time_step = 0.02
make_default_activity(update_time_step)
local sensor_data = get_base_data()
update = function()
-- upvalues: sensor_data
local aoa = sensor_data:getAngleOfAttack()
local speed = sensor_data:getSelfVelocity()
local sas = sensor_data:getSelfAirspeed()
local tas = sensor_data:getTrueAirSpeed()
local ias = sensor_data:getIndicatedAirSpeed()
local mach = sensor_data:getMachNumber()
local vv = sensor_data:getVerticalVelocity()
local gforce = sensor_data:getVerticalAcceleration()
local balt = sensor_data:getBarometricAltitude()
local ralt = sensor_data:getRadarAltitude()
local pitch = sensor_data:getStickRollPosition() / 100--Parkposition
local roll = sensor_data:getStickPitchPosition() / 100--Parkposition
local rudder = sensor_data:getRudderPosition() / 100--Parkposition
local throttle = sensor_data:getThrottleLeftPosition()
local gear = sensor_data:getLandingGearHandlePos()
local speedbrake = sensor_data:getSpeedBrakePos()
local rpm = sensor_data:getEngineLeftRPM()
local flaps = sensor_data:getFlapsPos()
local cpy_state = sensor_data:getCanopyState()
local cpy_pos = sensor_data:getCanopyPos()
local wown = sensor_data:getWOW_NoseLandingGear()
local wowl = sensor_data:getWOW_LeftMainLandingGear()
local wowr = sensor_data:getWOW_RightMainLandingGear()
local gun_fire = get_aircraft_draw_argument_value()--350
local wing_fold = get_aircraft_draw_argument_value()--8
local nlg_dump = get_aircraft_draw_argument_value()--1
local FOLDED_WING = get_aircraft_draw_argument_value(8)--404/405
local flaps_R = get_aircraft_draw_argument_value(9)--1003 / 1002
local Slats_R = get_aircraft_draw_argument_value(275)--1021
local Slats_L = get_aircraft_draw_argument_value(274)--1022
--local Sweep_R = get_aircraft_draw_argument_value(7)--405 AI Onli
--local Sweep_L = get_aircraft_draw_argument_value(7)--404 AI Onli

--local test = get_cockpit_draw_argument_value(0)



------------------------------------------------------
-- Katapultstart TASTE ( U )
-- Lua ==> launch_bar_connected_arg_value	= 0.85,
------------------------------------------------------
local FRONT_GEAR = get_aircraft_draw_argument_value(0)
local Launch_Bar = 0
  if FRONT_GEAR > 0 then
	Launch_Bar = 1
  end
  if Launch_Bar == 1 then
    set_aircraft_draw_argument_value(85, 0.81)
end
------------------------------------------------------------
local FOLDED = 0
	if flaps_R > 0 and FOLDED_WING < 0 then
		FOLDED = 1
	end
	if FOLDED_WING > 0 then
		FOLDED = 2
	end
	if FOLDED == 1 and mach < 2.0 then
		set_aircraft_draw_argument_value(7, mach * 0 )
		set_aircraft_draw_argument_value(1021, Slats_R ) --275
		set_aircraft_draw_argument_value(1022, Slats_L ) --274
	end
	if FOLDED == 0 and mach <= 0.45 then
		set_aircraft_draw_argument_value(7, mach * 0 )
		set_aircraft_draw_argument_value(1021, Slats_R ) --275
		set_aircraft_draw_argument_value(1022, Slats_L ) --274
	end
	if FOLDED == 0 and mach > 0.45 then
		set_aircraft_draw_argument_value(7,  20/9*mach - 1 )
		set_aircraft_draw_argument_value(1021, 0 ) --275
		set_aircraft_draw_argument_value(1022, 0 ) --274
	end
	if FOLDED == 2 then
		--set_aircraft_draw_argument_value(507, FOLDED_WING ) --8
		--set_aircraft_draw_argument_value(508, FOLDED_WING ) --8
		--set_aircraft_draw_argument_value(404, FOLDED_WING ) --8
  		--set_aircraft_draw_argument_value(405, FOLDED_WING ) --8
  		set_aircraft_draw_argument_value(1021, 0 ) --275
		set_aircraft_draw_argument_value(1022, 0 ) --274
	end
	
------------------------------------------------------
--[[
if mach < 0.45  then -- 0.85
  set_aircraft_draw_argument_value(7, mach * 0 )--1.00
end

if mach >= 0.45  then -- 0.85
  set_aircraft_draw_argument_value(7, 20/9*mach - 1 )--1.00		mach * 1.12
end
]]
------------------------------------------------------

end


need_to_be_closed = false

