diff --git a/Scripts/DCS-BIOS/lib/modules/Module.lua b/Scripts/DCS-BIOS/lib/modules/Module.lua index b13fe5fe3..723883d6d 100644 --- a/Scripts/DCS-BIOS/lib/modules/Module.lua +++ b/Scripts/DCS-BIOS/lib/modules/Module.lua @@ -379,6 +379,30 @@ end --- @param description string additional information about the control --- @return Control control the control which was added to the module function Module:defineInputOnlyPushButton(identifier, device_id, command, category, description) + return self:defineInputOnlyPushButtonWithValues(identifier, device_id, command, 1, 0, category, description) +end + +--- Adds a push button with no outputs that only sends 1, with no subsequent 0 +--- @param identifier string the unique identifier for the control +--- @param device_id integer the dcs device id +--- @param command integer the dcs command to move the switch up or down +--- @param category string the category in which the control should appear +--- @param description string additional information about the control +--- @return Control control the control which was added to the module +function Module:defineInputOnlyPushButtonNoOff(identifier, device_id, command, category, description) + return self:defineInputOnlyPushButtonWithValues(identifier, device_id, command, 1, nil, category, description) +end + +--- Adds a push button with no outputs and specific input values +--- @param identifier string the unique identifier for the control +--- @param device_id integer the dcs device id +--- @param command integer the dcs command to move the switch up or down +--- @param on_press integer? the value to send on press, if any +--- @param on_release integer? the value to send on release, if any +--- @param category string the category in which the control should appear +--- @param description string additional information about the control +--- @return Control control the control which was added to the module +function Module:defineInputOnlyPushButtonWithValues(identifier, device_id, command, on_press, on_release, category, description) local control = Control:new(category, ControlType.action, identifier, description, { ActionInput:new(ActionArgument.toggle, "Triggers the action"), }, {}) @@ -388,8 +412,12 @@ function Module:defineInputOnlyPushButton(identifier, device_id, command, catego self:addInputProcessor(identifier, function(action) local dev = GetDevice(device_id) if dev and action == ActionArgument.toggle then - dev:performClickableAction(command, 1) - dev:performClickableAction(command, 0) + if on_press then + dev:performClickableAction(command, on_press) + end + if on_release then + dev:performClickableAction(command, on_release) + end end end) diff --git a/Scripts/DCS-BIOS/lib/modules/aircraft_modules/F-14.lua b/Scripts/DCS-BIOS/lib/modules/aircraft_modules/F-14.lua index c082ba46c..a11139814 100644 --- a/Scripts/DCS-BIOS/lib/modules/aircraft_modules/F-14.lua +++ b/Scripts/DCS-BIOS/lib/modules/aircraft_modules/F-14.lua @@ -7,6 +7,10 @@ local F_14 = Module:new("F-14", 0x1200, { "F-14B", "F-14A-135-GR" }) --v4.6b by WarLord,ArturDCS,Matchstick and Bullitt +local devices = { + JESTERAI = 62, +} + -- remove Arg# Stick 33 ----------------------------------------- Extra Functions @@ -1493,4 +1497,65 @@ end, 5, "Airframe", "Right afterburner zone") F_14:definePushButton("RIO_MASTER_CAUTION_RESET", 35, 3057, 9229, "Weapons Panel", "RIO Master Caution Reset") +-- Jester +local PILOT_JESTER_WHEEL = "PLT Jester Wheel" + +F_14:defineInputOnlyPushButtonWithValues("PLT_JESTER_MENU_TOGGLE", devices.JESTERAI, 3550, 1, -1, PILOT_JESTER_WHEEL, "Toggle Menu") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_1", devices.JESTERAI, 3551, PILOT_JESTER_WHEEL, "Command 1") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_2", devices.JESTERAI, 3552, PILOT_JESTER_WHEEL, "Command 2") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_3", devices.JESTERAI, 3553, PILOT_JESTER_WHEEL, "Command 3") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_4", devices.JESTERAI, 3554, PILOT_JESTER_WHEEL, "Command 4") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_5", devices.JESTERAI, 3555, PILOT_JESTER_WHEEL, "Command 5") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_6", devices.JESTERAI, 3556, PILOT_JESTER_WHEEL, "Command 6") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_7", devices.JESTERAI, 3557, PILOT_JESTER_WHEEL, "Command 7") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_8", devices.JESTERAI, 3558, PILOT_JESTER_WHEEL, "Command 8") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_CHECK", devices.JESTERAI, 3669, PILOT_JESTER_WHEEL, "Check") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_LC", devices.JESTERAI, 3670, PILOT_JESTER_WHEEL, "Loud and Clear") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_MENU_CLOSE", devices.JESTERAI, 3725, PILOT_JESTER_WHEEL, "Close Menu") + +local PILOT_JESTER_NAV_COMMANDS = "PLT Jester Nav Commands" + +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_SP_1", devices.JESTERAI, 3566, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint SP 1") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_SP_2", devices.JESTERAI, 3567, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint SP 2") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_SP_3", devices.JESTERAI, 3568, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint SP 3") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_FIXED_POINT", devices.JESTERAI, 3569, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint Fixed Point") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_IP", devices.JESTERAI, 3570, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint Initial Point") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_TARGET", devices.JESTERAI, 3571, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint Surface Target") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_HOME", devices.JESTERAI, 3572, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint Home Base") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_NAV_MAN", devices.JESTERAI, 3573, PILOT_JESTER_NAV_COMMANDS, "Set Steerpoint Man") + +local PILOT_JESTER_RADAR_COMMANDS = "PLT Jester Radar Commands" + +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_VSL_HIGH", devices.JESTERAI, 3574, PILOT_JESTER_RADAR_COMMANDS, "VSL High") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_VSL_LOW", devices.JESTERAI, 3575, PILOT_JESTER_RADAR_COMMANDS, "VSL Low") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_STT_MODE", devices.JESTERAI, 3576, PILOT_JESTER_RADAR_COMMANDS, "Toggle PD-STT or P-STT") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_BREAK_LOCK", devices.JESTERAI, 3577, PILOT_JESTER_RADAR_COMMANDS, "Break Lock") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_AUTO", devices.JESTERAI, 3578, PILOT_JESTER_RADAR_COMMANDS, "Range Auto") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_25", devices.JESTERAI, 3579, PILOT_JESTER_RADAR_COMMANDS, "Range 25") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_50", devices.JESTERAI, 3580, PILOT_JESTER_RADAR_COMMANDS, "Range 50") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_100", devices.JESTERAI, 3581, PILOT_JESTER_RADAR_COMMANDS, "Range 100") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_200", devices.JESTERAI, 3582, PILOT_JESTER_RADAR_COMMANDS, "Range 200") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RANGE_400", devices.JESTERAI, 3583, PILOT_JESTER_RADAR_COMMANDS, "Range 400") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_LOCK_AHEAD", devices.JESTERAI, 3584, PILOT_JESTER_RADAR_COMMANDS, "STT Lock Ahead") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_LOCK_AHEAD_ENEMY", devices.JESTERAI, 3585, PILOT_JESTER_RADAR_COMMANDS, "STT Lock Enemy Ahead") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_LOCK_AHEAD_FRIENDLY", devices.JESTERAI, 3586, PILOT_JESTER_RADAR_COMMANDS, "STT Lock Friendly Ahead") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_GROUND_STABILIZE", devices.JESTERAI, 3587, PILOT_JESTER_RADAR_COMMANDS, "Ground Stabilize") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_AIRCRAFT_STABILIZE", devices.JESTERAI, 3588, PILOT_JESTER_RADAR_COMMANDS, "Aircraft Stabilize") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RADAR_TWS", devices.JESTERAI, 3589, PILOT_JESTER_RADAR_COMMANDS, "TWS Mode") +F_14:defineInputOnlyPushButtonNoOff("PLT_JESTER_COMMAND_RADAR_RWS", devices.JESTERAI, 3590, PILOT_JESTER_RADAR_COMMANDS, "RWS Mode") + +-- Iceman +local RIO_ICEMAN_WHEEL = "RIO Iceman Wheel" + +F_14:defineInputOnlyPushButtonWithValues("RIO_ICEMAN_MENU_TOGGLE", devices.JESTERAI, 3550, 1, -1, RIO_ICEMAN_WHEEL, "Toggle Menu") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_1", devices.JESTERAI, 3551, RIO_ICEMAN_WHEEL, "Command 1") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_2", devices.JESTERAI, 3552, RIO_ICEMAN_WHEEL, "Command 2") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_3", devices.JESTERAI, 3553, RIO_ICEMAN_WHEEL, "Command 3") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_4", devices.JESTERAI, 3554, RIO_ICEMAN_WHEEL, "Command 4") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_5", devices.JESTERAI, 3555, RIO_ICEMAN_WHEEL, "Command 5") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_6", devices.JESTERAI, 3556, RIO_ICEMAN_WHEEL, "Command 6") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_7", devices.JESTERAI, 3557, RIO_ICEMAN_WHEEL, "Command 7") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_COMMAND_8", devices.JESTERAI, 3558, RIO_ICEMAN_WHEEL, "Command 8") +F_14:defineInputOnlyPushButtonNoOff("RIO_ICEMAN_MENU_CLOSE", devices.JESTERAI, 3725, RIO_ICEMAN_WHEEL, "Close Menu") + return F_14