Skip to content

Commit

Permalink
Merge pull request #139 from heclak/release/1.3.1
Browse files Browse the repository at this point in the history
Release/1.3.1
  • Loading branch information
heclak authored Jun 17, 2019
2 parents 6cdba95 + 3f45a55 commit 4b03725
Show file tree
Hide file tree
Showing 41 changed files with 342 additions and 97 deletions.
39 changes: 30 additions & 9 deletions A-4E-C/Cockpit/Scripts/Systems/avionics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,16 @@ function SetCommand(command,value)
elseif command == device_commands.intlight_instruments then
lights_instruments_val = value

elseif command == device_commands.intlight_instruments_CHANGE then
local newValue = lights_instruments_val + value
if newValue > 1.0 then
newValue = 1.0
elseif newValue < 0.0 then
newValue = 0.0
end
lights_instruments_val = newValue
dev:performClickableAction(device_commands.intlight_instruments, lights_instruments_val, false) -- pass through to clickable device

elseif command == device_commands.intlight_instruments_AXIS then
-- print_message_to_user("Test value: "..value)
local normalisedValue = ( ( value + 1 ) / 2 ) * 1.0 -- normalised {-1 to 1} to {0 - 1.0}
Expand All @@ -371,6 +381,16 @@ function SetCommand(command,value)
elseif command == device_commands.intlight_console then
lights_console_val = value

elseif command == device_commands.intlight_console_CHANGE then
local newValue = lights_console_val + value
if newValue > 1.0 then
newValue = 1.0
elseif newValue < 0.0 then
newValue = 0.0
end
lights_console_val = newValue
dev:performClickableAction(device_commands.intlight_console, lights_console_val, false) -- pass through to clickable device

elseif command == device_commands.intlight_console_AXIS then
-- print_message_to_user("Test value: "..value)
local normalisedValue = ( ( value + 1 ) / 2 ) * 1.0 -- normalised {-1 to 1} to {0 - 1.0}
Expand All @@ -389,20 +409,21 @@ function SetCommand(command,value)
local whiteflood = value
lights_floodwhite_val = whiteflood
-- print_message_to_user("flood value: "..value)

elseif command == device_commands.intlight_whiteflood_CHANGE then
local newValue = lights_floodwhite_val + value
if newValue > 1.0 then
newValue = 1.0
elseif newValue < 0.0 then
newValue = 0.0
end
lights_floodwhite_val = newValue
dev:performClickableAction(device_commands.intlight_whiteflood, lights_floodwhite_val, false) -- pass through to clickable device

elseif command == device_commands.intlight_whiteflood_AXIS then
local normalisedValue = ( ( value + 1 ) / 2 ) * 1.0 -- normalised {-1 to 1} to {0 - 1.0}
dev:performClickableAction(device_commands.intlight_whiteflood, normalisedValue, false)

elseif command == Keys.IntLightWhiteFlood then
local whiteflood = whiteflood_val + value
if whiteflood > 1 then
whiteflood = 1
elseif whiteflood < 0 then
whiteflood = 0
end
dev:performClickableAction(device_commands.intlight_whiteflood, whiteflood, false) -- pass through to clickable device

elseif command == Keys.AccelReset then
dev:performClickableAction(device_commands.accel_reset, 1, false)
elseif command == device_commands.accel_reset then
Expand Down
40 changes: 31 additions & 9 deletions A-4E-C/Cockpit/Scripts/Systems/carrier.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ dofile(LockOn_Options.script_path.."utils.lua")


dofile(LockOn_Options.script_path.."Systems/mission.lua")
--dofile(LockOn_Options.script_path.."Systems//mission.lua")

local catapult_max_tics = 215
--local catapult_max_length = 75 --stennis catapults should be 118m, but are actualy 100m in game?! Oriskanys should be 75m
Expand Down Expand Up @@ -92,9 +91,32 @@ function post_initialize()

load_tempmission_file()
miz_carriers = decode_mission()
end

local birth = LockOn_Options.init_conditions.birth_place
if birth=="GROUND_HOT" then --"GROUND_COLD","GROUND_HOT","AIR_HOT"
update()
spawn_in_catapult()
end
end

function spawn_in_catapult()
if on_carrier() == true and catapult_status == 0 and wheelchocks_state_param:get() == 0 then
update_carrier_pos()
compare_carriers()
local close_to_cat,closest_cat,angel_to_cat = check_catapult_proximity()
--if check_catapult_proximity() then
if close_to_cat then
catapult_status = 1
cat_hook_tics = 0
else
if closest_cat > 15 then
print_message_to_user("You are not close enough to any catapult")
else
print_message_to_user("position or alignment wrong\nDistance " ..round(closest_cat,1) .."m (max 2m)\nAngel "..round((angel_to_cat),1) .. "(max 3 degrees)" )
end
end
end
end

function SetCommand(command,value)
-- print_message_to_user("carrier: command "..tostring(command).." = "..tostring(value))
Expand All @@ -104,11 +126,11 @@ function SetCommand(command,value)

update_carrier_pos()
compare_carriers()
-- check_catapult()
-- check_catapult_proximity()
-- local tmp_bchsh = compare_angels(math.deg(birth_carrier_heading),math.deg(Sensor_Data_Mod.self_head))
-- if tmp_bchsh < 6 then
local close_to_cat,closest_cat,angel_to_cat = check_catapult()
--if check_catapult() then
local close_to_cat,closest_cat,angel_to_cat = check_catapult_proximity()
--if check_catapult_proximity() then
if close_to_cat then
catapult_status = 1
--print_message_to_user("The catapult is ready!\nYou are hooked in.\nCheck takeoff flaps and trim\nSpool up the engine to max MIL\nSignal FIRE CATAPULT when ready.", 10)
Expand Down Expand Up @@ -186,8 +208,8 @@ function update()
-- compare_carriers()
-- end

--local tmp_cat_dist = check_catapult("dist")
local close_to_cat,tmp_cat_dist,angel_to_cat = check_catapult()
--local tmp_cat_dist = check_catapult_proximity("dist")
local close_to_cat,tmp_cat_dist,angel_to_cat = check_catapult_proximity()
if tmp_cat_dist < last_cat_dist -1 or tmp_cat_dist > last_cat_dist +1 then
last_cat_dist = round(tmp_cat_dist,0)
if last_cat_dist < 1.5 then
Expand Down Expand Up @@ -484,8 +506,8 @@ function compare_angels(a,b)
end


function check_catapult(data)
--local close_to_cat,closest_cat,angel_to_cat = check_catapult()
function check_catapult_proximity(data)
--local close_to_cat,closest_cat,angel_to_cat = check_catapult_proximity()
if not my_carrier and data == "dist" then return 100 end
--local closest_cat = 99
local catpos = {
Expand Down
3 changes: 3 additions & 0 deletions A-4E-C/Cockpit/Scripts/command_defs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -439,4 +439,7 @@ device_commands =
intlight_whiteflood_AXIS = __counter(),
intlight_instruments_AXIS = __counter(),
intlight_console_AXIS = __counter(),
intlight_whiteflood_CHANGE = __counter(),
intlight_instruments_CHANGE = __counter(),
intlight_console_CHANGE = __counter(),
}
1 change: 0 additions & 1 deletion A-4E-C/Cockpit/Scripts/mainpanel_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ draw_pilot = false
external_model_canopy_arg = 38

use_external_views = false
cockpit_local_point = {3.1, 0.63, 0.0} --{3.2, 0.16, 0.0}

day_texture_set_value = 0.0
night_texture_set_value = 0.1
Expand Down
38 changes: 26 additions & 12 deletions A-4E-C/Input/joystick/Joystick - HOTAS Warthog.lua
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,6 @@ keyCommands = {
{down = iCommandPlaneThreatWarnSoundVolumeUp, name = _('RWR/SPO Sound Signals Volume Up'), category = 'Sensors'},

-- Weapons
{down = iCommandPlaneSalvoOnOff, name = _('Salvo Mode'), category = 'Weapons'},
{combos = {{key = 'JOY_BTN2'}}, down = Keys.PickleOn, up = Keys.PickleOff, name = _('Weapon Release'), category = 'Weapons'},
--{down = iCommandChangeGunRateOfFire, name = _('Cannon Rate Of Fire / Cut Of Burst select'), category = 'Weapons'},

Expand All @@ -430,17 +429,24 @@ keyCommands = {
{down = Keys.Station4, name = _('Armament: Station 4 Enable/Disable'), category = _('Weapons')},
{down = Keys.Station5, name = _('Armament: Station 5 Enable/Disable'), category = _('Weapons')},

{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.0, name = _('Function Selector: OFF'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},
{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.1, name = _('Function Selector: ROCKETS'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},
{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.2, name = _('Function Selector: GM UNARM'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},
{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.3, name = _('Function Selector: SPRAY TANK'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},
{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.4, name = _('Function Selector: LABS'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},
{down = device_commands.arm_func_selector, cockpit_device_id = devices.WEAPON_SYSTEM, value_down = 0.5, name = _('Function Selector: BOMBS & GM ARM'), category = {_('Instrument Panel'), _('Armament Panel'), _('Weapons')}},

{combos = {{key = 'JOY_BTN14'}}, down = Keys.ArmsFuncSelectorCCW, name = _('Armament: Function Selector: CCW'), category = _('Weapons')},
{combos = {{key = 'JOY_BTN12'}}, down = Keys.ArmsFuncSelectorCW, name = _('Armament: Function Selector: CW'), category = _('Weapons')},

{combos = {{key = 'JOY_BTN13'}}, down = Keys.GunsReadyToggle, name = _('Armament: Guns READY/SAFE Toggle'), category = _('Weapons')},
{combos = {{key = 'JOY_BTN11'}}, down = Keys.MasterArmToggle, name = _('Armament: Master Arm Toggle'), category = _('Weapons')},

{down = Keys.AWRSMultiplierToggle, name = _('AWRS: Toggle multiplier'), category = _('Weapons')},
{down = Keys.AWRSQtySelIncrease, name = _('AWRS: Quantity Select Increase'), category = _('Weapons')},
{down = Keys.AWRSQtySelDecrease, name = _('AWRS: Quantity Select Decrease'), category = _('Weapons')},
{down = Keys.AWRSModeSelCCW, name = _('AWRS: Mode Select CCW'), category = _('Weapons')},
{down = Keys.AWRSModeSelCW, name = _('AWRS: Mode Select CW'), category = _('Weapons')},
{down = Keys.AWRSMultiplierToggle, name = _('AWRS: Toggle multiplier'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},
{down = Keys.AWRSQtySelIncrease, name = _('AWRS: Quantity Select Increase'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},
{down = Keys.AWRSQtySelDecrease, name = _('AWRS: Quantity Select Decrease'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},
{down = Keys.AWRSModeSelCCW, name = _('AWRS: Mode Select CCW'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},
{down = Keys.AWRSModeSelCW, name = _('AWRS: Mode Select CW'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},

{down = Keys.GunpodCharge, name = _('GunPods: OFF/CHARGE/CLEAR Toggle'), category = _('Weapons')},
{down = Keys.GunpodLeft, name = _('GunPods: Left Enable/Disable'), category = _('Weapons')},
Expand Down Expand Up @@ -498,6 +504,14 @@ keyCommands = {
{down = Keys.RadarRangeLongShort, value_down = 1, up = Keys.RadarRangeLongShort, value_up = 0, name = _('*Radar Range: Long ELSE Short'), category = _('Radar')},
{down = Keys.RadarAoAComp, value_down = 1, up = Keys.RadarAoAComp, value_up = 0, name = _('*Radar AoA Compensation: ON ELSE OFF'), category = _('Radar')},

-- Interior Lights Panel
{down = device_commands.intlight_whiteflood_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = 0.1, name = _('Interior Lights: White Floodlight Increase'), category = {_('Right Console'), _('INT LTS Panel')}},
{down = device_commands.intlight_whiteflood_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = -0.1, name = _('Interior Lights: White Floodlight Decrease'), category = {_('Right Console'), _('INT LTS Panel')}},
{down = device_commands.intlight_instruments_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = 0.1, name = _('Interior Lights: Instrument Lights Increase'), category = {_('Right Console'), _('INT LTS Panel')}},
{down = device_commands.intlight_instruments_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = -0.1, name = _('Interior Lights: Instrument Lights Decrease'), category = {_('Right Console'), _('INT LTS Panel')}},
{down = device_commands.intlight_console_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = 0.1, name = _('Interior Lights: Console Lights Increase'), category = {_('Right Console'), _('INT LTS Panel')}},
{down = device_commands.intlight_console_CHANGE, cockpit_device_id = devices.AVIONICS, value_down = -0.1, name = _('Interior Lights: Console Lights Decrease'), category = {_('Right Console'), _('INT LTS Panel')}},

-- lighting keys
{down = Keys.ExtLightMaster, value_down = 1, name = _('Master Exterior Lights: ON'), category = _('Systems')},
{down = Keys.ExtLightMaster, value_down = 0, name = _('Master Exterior Lights: OFF'), category = _('Systems')},
Expand Down Expand Up @@ -605,13 +619,13 @@ axisCommands = {
{action = iCommandViewVertTransAbs , name = _('Absolute Vertical Shift Camera View')},
{action = iCommandViewLongitudeTransAbs , name = _('Absolute Longitude Shift Camera View')},

{action = device_commands.radar_angle_axis, cockpit_device_id = devices.RADAR, name = _('Radar Angle Slew')},
{action = device_commands.radar_angle_axis_abs, cockpit_device_id = devices.RADAR, name = _('Radar Angle Absolute')},
{action = device_commands.intlight_instruments_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: Instrument')},
{action = device_commands.intlight_console_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: Console')},
{action = device_commands.intlight_whiteflood_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: White Flood')},
{action = device_commands.radar_angle_axis, cockpit_device_id = devices.RADAR, name = _('Radar Angle Slew')},
{action = device_commands.radar_angle_axis_abs, cockpit_device_id = devices.RADAR, name = _('Radar Angle Absolute')},
{action = device_commands.intlight_instruments_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: Instrument'), category = {_('Right Console'), _('INT LTS Panel')}},
{action = device_commands.intlight_console_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: Console'), category = {_('Right Console'), _('INT LTS Panel')}},
{action = device_commands.intlight_whiteflood_AXIS, cockpit_device_id = devices.AVIONICS, name = _('Lighting: White Flood'), category = {_('Right Console'), _('INT LTS Panel')}},

{action = device_commands.AWRS_drop_interval_AXIS, cockpit_device_id = devices.WEAPON_SYSTEM, name = _('AWRS: Drop Interval')},
{action = device_commands.AWRS_drop_interval_AXIS, cockpit_device_id = devices.WEAPON_SYSTEM, name = _('AWRS: Drop Interval'), category = {_('Instrument Panel'), _('AWE-1'), _('Weapons')}},

-- from base_joystick_binding.lua...

Expand Down
Loading

0 comments on commit 4b03725

Please sign in to comment.