Multiple vehicle control menu selections without exiting

Currently the vehicle control menu lets you select one option, and then you have to re-engage the controls to do something else. So if you want to turn on the stereo, fridge, recharger, and headlights when you get in your car, that’s 4 additional key-strokes (or about 12-16 if you’re using a remove vehicle controller).

People have proposed staying in the menu, but there’s some problems:

  • uimenu as far as I can tell doesn’t have an option to update existing entries, so you have to recreate the menu for each pass
  • some options (like shooting turrets or honking the horns) need to update the world state, and that doesn’t happen while you’re inside the vehicle_controls function

I’m not sure of the best way to resolve this.

One way that makes sense to me would be to inject a virtual keypress after performing ationsmenu.ret in vehicle::use_controls(), so the game world state updates everything and then automatically returns to use_controls(). But I’m not sure how to do that or if that’s even appropriate. Any suggestions on how to do this?

the issue is the times you need to do mass control changes to your vehicle are limited. what about people that want to do one option and then just go? they now have to do an extra stroke to exit the menu. basically this problem is so edge case it’s effectively not a problem

Seriously? Get into the vehicle. Start engine. Turn on fridge. Turn on stereo. possibly turn on recharger. possibly turn on headlights. Possibly turn on floodlights. Possibly engage door controls to open curtains. That’s 2-6 interactions with the vehicle menu, or even more until the "open/close all shutters PR gets merged.
Start driving for a while. See loot location on side of road.
Pull handbrake. Turn off stereo. Possibly turn off headlights and/or floodlights. Turn off engine. Go get loot. Another 2-5+ loops through the menu.
Get back into vehicle. Restart engine. Turn stereo back on. Possibly turn on headlights or floodlights. Start driving. Another 1-3+ loops through the menu.
Get back to base. Don’t expect to be using vehicle for a while, so shut it down. Turn off fridge. Turn off stereo. Turn off recharger. Possibly turn off headlights or floodlights. Engage door controls to close all curtains. Turn off engine. Another 3-8+ loops through the menu.

There’s two separate feature requests for this feature on github, one with multiple upvotes. It’s not really an edge case, it’s a QoL issue for a number of players.

I think we can pretty easy approach a best case here. I suspect the menu entries that signal that the player doesn’t want to interact with the menu anymore and the entries that don’t are fairly distinct.

For example toggling headlights, interacting with guns, and turning appliances on and off are pretty likely to be followed up by similar commands, but “start driving”, “stop driving” and “release the wheel” are pretty strong indications that the player is done with the menu.

I think theres a fairly simple solution to both problems you outline @mlangsdorf, the gun aiming menu already does something like what you outline, but it pushes an action to return to the menu onto the action stack instead of synthesizing a keypress.

If you wrap the invocation of the menu in a loop that checks for the player running out of moves, you can repeatedly call the whole thing and take action on selections until the player exits. If they run out of moves with selections pending, you push the “enter the driving menu” onto the stack and exit from the function, then the next turn the action fires and sends you back to the menu.

I don’t know much about coding, but when it comes to lights, appliances, etc. would it be reasonable to do like one does with engines currently? As in make a box with a check of on or off and you could just toggle it all from there? Seems to me the structure for that already exists in the engine. Again I don’t know anything about coding so someone smarter than me can weigh in on the viability of that.

That’s actually pretty clever, Trigon. Most of the electric items are already well isolated in the code, and the engine toggle box is a good format for that. It starts to address Tarburst98’s concerns (if you don’t want to toggle electrical systems, you don’t get caught in the loop) and it’s fairly quick. It also doesn’t require me comprehending the mess that is the targeting code and finding the bit that pushes the action to the stack.

Specifically, I’m thinking about adding a “Adjust multiple electronics” option to the vehicle control menu WITHOUT removing the existing electric options. So if you just want to turn on your headlights, you can hit ^, h, and move on with your life. The adjust multiple is only if you really want to get several things.

Would it be possible to embed the “Adjust Multiple Electronics” options directly into the vehicle control menu, rather than as a sub-menu? Something like:

  • d: Start Driving
  • f: Turn off fridge
  • w: Turn off water purifier
  • m: Turn on stereo
  • h: Turn on headlights
  • A: Turn on multiple electronics
    • 1 : stereo (checkbox selected)
    • 2: headlights (checkbox NOT selected)
  • B: Turn off multiple electronics
    • 3: fridge (checkbox selected)
    • 4: water purifier (checkbox selected)

    …where the numbers 1-4 flip whether or not the mass-switch-flip affects it or not, and are based on their current on/off status?

    At that point, I’d almost like to see if the menu could be a slightly cleaner UI, with columns or colored text based on their current powered status.

  • It would be possible, I suppose, but I don’t intend to write that version right now because its a lot more work. I’m sticking with the version I proposed after Trigon’s suggestion.

    The vehicle UI code is a mess and I will leave it to people better at C++ coding than me to untangle it.

    I feel so very helpful.

    1 Like

    Why both a turn on and a turn off multiple electonics entries?
    You could have just one entry, with a bunch of checkboxes and an accept button. Checked means it will be activated after the menu closes if it wasn’t already, unchecked means it will be deactivated when the menu closes if it wasn’t already.

    Oh yeah, this is such a pain Using my turrets through the remote control bionic is so annoying I’ll go out of my way and risk getting a bunch of vehicle parts bashed up just to avoid using it. (Then there’s the turret range bug that means it frequently doesn’t even shoot, but that’s a whole different problem)

    I was thinking that it would be useful to display the current state of them explicitly.

    But you don’t need to.

    Say, you have the headlights on, and the stereo off. With one menu, when you enter “Adjust multiple electronics”, you’d see:

    1 [x] headlights
    2 [ ] stereo

    Just like the engines menu, you’d know just by opening it what electronics are on and what are off.

    My first thought was to tackle the problem similarly to strategy games, namely the (hold shift to quene orders) bit, although that doesn’t work nearly as well with high hotkey number stuff like Cata, still seems like a potential option though, using shift as an in menu (alt) while interacting with vehichle systems.

    so basically… hold (shift) to keep vehichle interaction menu open. which could also be interpreted as (letter_lowercase) = toggle option and exit menu
    (letter_uppercase) = toogle option and keep menu open.

    My design based on Trigon’s suggestion was merged. People are welcome to criticize it, suggest improvements, or go rewrite the vehicle controls UI themselves, as they please.

    I am looking at doing that rewrite, at least enough to encapsulate the controls in their own class/file for slightly saner manipulation, but I’m not sure when I’ll get it done or even started.

    Wow. That was fast. Geeze

    I know, I’m very happy that I managed to code it correctly and get it accepted.