Jump to content

Retrofitting basic clickability(?)


NickD
 Share

Recommended Posts

Is it at all possible to mod clickability to an existing non-clickable cockpit? e.g. the SU-25t.

 

I'm aware of the arguments regarding complexity of modelling aircraft systems, but this isn't what I'm after - only convenient control of things like e.g. landing gear - which is only used once or twice per flight and when space on the HOTAS is at a severe premium, like when using VR, it'd be nice to be able to look at the obvious lever and press a single button.

 

If the problem is model support e.g. connectors, well the SU-25t has at least one panel with connectors hooked up (the left fire-control panel) that could be used as a simple surrogate, and otherwise it might be possible to add them in afterwards (the model viewer certainly seems to have a section for user-defined connectors).

 

As an exploratory first step, I started trying to at least get the connectors recognised on the SU-25t with an empty device. Here are the files I added to the Cockpit/Scripts folder (after studying the TF-51) to try to get a single test device registered and associated with the button:

 

device_init.lua

print("Reading device_init")

mount_vfs_texture_archives("Bazar/Textures/AvionicsCommon")

attributes = {
"support_for_cws",
}
---------------------------------------------
dofile(LockOn_Options.script_path.."devices.lua")

creators    = {}
creators[devices.TEST] = {"avLuaDevice",LockOn_Options.script_path.."test_device.lua"}
---------------------------------------------
-- defines kneeboard device - if not last, risk overwriting the definitions and the game crashes
dofile(LockOn_Options.common_script_path.."KNEEBOARD/declare_kneeboard_device_left.lua")

 

devices.lua

devices = {}
devices["TEST"]                     = 1

 

command_defs.lua

device_commands =
{
   Button_1  = 3001;
}

 

clickabledata.lua

print("Reading clickabledata")

dofile(LockOn_Options.script_path.."command_defs.lua")
dofile(LockOn_Options.script_path.."devices.lua")

cursor_mode = 
{ 
   CUMODE_CLICKABLE = 0,
   CUMODE_CLICKABLE_AND_CAMERA  = 1,
   CUMODE_CAMERA = 2,
};

clickable_mode_initial_status  = cursor_mode.CUMODE_CLICKABLE_AND_CAMERA
use_pointer_name               = true

-- Taken from some other TF-51D clickabledata
function default_2_position_tumb(hint_, device_, command_, arg_)
   return  {   
               class       = {class_type.TUMB,class_type.TUMB},
               hint        = hint_,
               device      = device_,
               action      = {command_,command_},
               arg         = {arg_,arg_},
               arg_value   = {1,-1}, 
               arg_lim     = {{0,1},{0,1}},
               updatable   = true, 
               use_OBB     = true
           }
end

elements = {}
-- anim 83 = landing lever, range 0-1
elements["PTR-TMB-FIRE-R-PK"] = default_2_position_tumb("Landing Gear Control Handle",devices.TEST, device_commands.Button_1,83)

 

test_device.lua

local dev       = GetSelf()
local update_time_step = 0.1

make_default_activity(update_time_step)

local sensor_data = get_base_data()

function post_initialize()
   print("post_initialize called")
end

function SetCommand(command,value)  
   print("Lua test_device SetCommand")
   print(command)
   print(value)
end

function update()
   print("Custom lua device update")
end

 

All of the print statements get hit in the right place, the cockpit starts in clicky-mode, and the custom device gets time-based updates - but there is no recognition of the clickable area (cursor color or highlighting) and so nothing to even trigger the device SetCommand.

 

Is there something obvious I have missed, or is there some important reason this will never work anyway?


Edited by NickD
Try to fit code block without scroll
  • Like 2
Link to comment
Share on other sites

i dont see any connector points defined.

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill,

X470 Taichi Ultimate, 2x R7970 Lightnings Crossfired @ 1.1/6.0GHz,

3x ASUS VS248HP + Hanns·G HZ201HPB + Oculus HMD,

Thrustmaster Warthog HOTAS + MFDs, CH Fighterstick+Pro Throttle+Pro Pedals

Link to comment
Share on other sites

i dont see any connector points defined.

 

In the code I posted, or the Su-25t cockpit? As far as I could tell, the link to connectors happens in clickabledata.lua and this looked like the right line:

 

elements["PTR-TMB-FIRE-R-PK"] = default_2_position_tumb("Landing Gear Control Handle",devices.TEST, device_commands.Button_1,83)

 

With the table entry being the name of the connector?

 

Edit: And the SU-25t connectors I'm talking about are the ones in the attached screenshot; I don't know how to get modelViewer to show them as volumes rather than points, but they seem to align well to the button sizes.

capture.jpg.98a41372aff0fca61c935e591a62eda0.jpg


Edited by NickD
Link to comment
Share on other sites

In the code I posted, or the Su-25t cockpit? As far as I could tell, the link to connectors happens in clickabledata.lua and this looked like the right line:

 

elements["PTR-TMB-FIRE-R-PK"] = default_2_position_tumb("Landing Gear Control Handle",devices.TEST, device_commands.Button_1,83)

With the table entry being the name of the connector?

 

Edit: And the SU-25t connectors I'm talking about are the ones in the attached screenshot; I don't know how to get modelViewer to show them as volumes rather than points, but they seem to align well to the button sizes.

 

good work! keep on!

Intel i5 2500K + H70 | 2x4GB 2133mhz Gskill sniper | Gigabyte GA-Z68XP-UD3-iSSD | Samsung 850 SSD 256gb| Intel 20GB SSD | WD 500GB | Gigabyte GTX 1070 8GB | Antec 900 | Saitek X52 Pro | 24" Samsung T24C550 @60Hz 2ms | Opentrack 3 led clip

Link to comment
Share on other sites

Flanker and Frog foot Cockpits only have a dozen, 2 dozen max connectors.

 

F-15C and A-10A on the other hand... have dozens...

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill,

X470 Taichi Ultimate, 2x R7970 Lightnings Crossfired @ 1.1/6.0GHz,

3x ASUS VS248HP + Hanns·G HZ201HPB + Oculus HMD,

Thrustmaster Warthog HOTAS + MFDs, CH Fighterstick+Pro Throttle+Pro Pedals

Link to comment
Share on other sites

Far as I can tell, the Su-25T cockpit only has about a dozen connectors in the model.

 

You'll have a hard time making it clickable.

 

Of the right sort of connectors, I think the SU-25t only has six. But still, ignoring the possibility of expanding this, that's still six extra buttons that don't need to be bound on the HOTAS.

 

I'm just trying to work out what's stopping this from working.

 

Are there *any* examples of community aircraft with even partially clickable cockpits? I keep cycling back round to Wunderluft, which, depending on which version you get linked to, has various parts out of date or just never implemented.

Link to comment
Share on other sites

Our A-4 cockpit is fully clickable, but we haven't made the mod available to anyone yet.

 

We used the BGDAM as our initial information when creating our clickable cockpit. I'm not sure what you believe is wrong in the documentation.

 

1) you need the proper connector (preferably animated) in the cockpit .edm

 

2) create the required devices for handling clicks. First, define it in devices.lua:

 

devices["WEAPON_SYSTEM"]			= counter()

 

Note that counter() is just a little iterator so we don't have to hard code the device IDs.

 

3) Then initialize it in device_init.lua:

 

creators[devices.WEAPON_SYSTEM] = {"avSimpleWeaponSystem"   ,LockOn_Options.script_path.."Systems/weapon_system.lua"}

 

4) Assign a device to handle the click in clickabledata.lua:

 

elements["PNT_392"] = default_2_position_tumb("GunPods: Center Enable", devices.WEAPON_SYSTEM, device_commands.gunpod_c, 392)

 

The above has code in the assigned WEAPON_SYSTEM device, executing command gunpod_c, when connector #392 is touched.

 

5) Write the appropriate click handler in your weapon_system.lua

 

--gos

Link to comment
Share on other sites

Of the right sort of connectors, I think the SU-25t only has six. But still, ignoring the possibility of expanding this, that's still six extra buttons that don't need to be bound on the HOTAS.

 

I'm just trying to work out what's stopping this from working.

 

Are there *any* examples of community aircraft with even partially clickable cockpits? I keep cycling back round to Wunderluft, which, depending on which version you get linked to, has various parts out of date or just never implemented.

 

 

Show Dialogs -> Connectors...

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill,

X470 Taichi Ultimate, 2x R7970 Lightnings Crossfired @ 1.1/6.0GHz,

3x ASUS VS248HP + Hanns·G HZ201HPB + Oculus HMD,

Thrustmaster Warthog HOTAS + MFDs, CH Fighterstick+Pro Throttle+Pro Pedals

Link to comment
Share on other sites

Show Dialogs -> Connectors...

Right, but most of those are full-size (e.g. diameter = 1.0m) dummy objects for positioning e.g. to tell the center of the TV, HUD, etc. It seems connectors used for buttons are actually sized so that the whole volume of the box is covering the switch position like in the attached screenshot. Also, I forgot a couple, there is actually eight - a light on the right and the vent/fan switch under the fire panel.

 

You are right about the F-15 though - it looks as though at some point there was an effort to make connectors for every button, but was never followed through with proper clickability.

 

Our A-4 cockpit is fully clickable, but we haven't made the mod available to anyone yet.

 

We used the BGDAM as our initial information when creating our clickable cockpit. I'm not sure what you believe is wrong in the documentation.

 

1) you need the proper connector (preferably animated) in the cockpit .edm

 

2) create the required devices for handling clicks. First, define it in devices.lua:

 

devices["WEAPON_SYSTEM"]			= counter()

 

Note that counter() is just a little iterator so we don't have to hard code the device IDs.

 

3) Then initialize it in device_init.lua:

 

creators[devices.WEAPON_SYSTEM] = {"avSimpleWeaponSystem"   ,LockOn_Options.script_path.."Systems/weapon_system.lua"}

 

4) Assign a device to handle the click in clickabledata.lua:

 

elements["PNT_392"] = default_2_position_tumb("GunPods: Center Enable", devices.WEAPON_SYSTEM, device_commands.gunpod_c, 392)

 

The above has code in the assigned WEAPON_SYSTEM device, executing command gunpod_c, when connector #392 is touched.

 

5) Write the appropriate click handler in your weapon_system.lua

 

--gos

 

Hmm, thanks - this appears to me to be exactly the steps that I am following.

 

I've noticed that the SU-25t/FC3 aircraft tend to have nil for their flight model in make_flyable... perhaps this is a special case that overwrites the clickable data?

 

The F15 actually seems to have it's flight model specified in lua, I'll see if the same process actually works for that aircraft.

toggles.jpg.e4d031e9a05666391e727effdc2b64c3.jpg

Link to comment
Share on other sites

The F15 actually seems to have it's flight model specified in lua, I'll see if the same process actually works for that aircraft.

 

No, exactly the same - the scripts are hit, the custom device gets updated, but no luck with the UI elements.

Edit: Even tried with a separate, unused animation argument - in case the gear lever was reassigned/protected or something. No luck either.


Edited by NickD
Link to comment
Share on other sites

pretty sure the FC3 Jets arent really setup by default to load external scripts.

 

You may have to no only define the old=xx, but also script a /Cockpit/Scripts/mainpanel lua to go along with the clickable data, etc etc, and then define the cockpit scripts folder instead of knee board.

 

not to mention you'd have to know the compiled device name and command from the DLL for FC3 Jets, or define your own, as I said.


Edited by SkateZilla

Windows 10 Pro, Ryzen 2700X @ 4.6Ghz, 32GB DDR4-3200 GSkill,

X470 Taichi Ultimate, 2x R7970 Lightnings Crossfired @ 1.1/6.0GHz,

3x ASUS VS248HP + Hanns·G HZ201HPB + Oculus HMD,

Thrustmaster Warthog HOTAS + MFDs, CH Fighterstick+Pro Throttle+Pro Pedals

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...