-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flatten vehicle menus, make appliances menu top level #60868
Merged
dseguin
merged 17 commits into
CleverRaven:master
from
irwiss:flatten-veh-controls-menu
Sep 14, 2022
Merged
Flatten vehicle menus, make appliances menu top level #60868
dseguin
merged 17 commits into
CleverRaven:master
from
irwiss:flatten-veh-controls-menu
Sep 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1f41ad3
to
f41b3af
Compare
f41b3af
to
340cb2b
Compare
Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details. Click to expand
This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to |
340cb2b
to
5b7096f
Compare
5b7096f
to
0da2351
Compare
0da2351
to
d36dbca
Compare
9fb481d
to
3b64bc9
Compare
3b64bc9
to
1d1f8b2
Compare
1d1f8b2
to
c7e5422
Compare
c7e5422
to
f2e198a
Compare
dseguin
approved these changes
Sep 12, 2022
This was referenced Sep 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
astyled
astyled PR, label is assigned by github actions
BasicBuildPassed
This PR builds correctly, label assigned by github actions
<Bugfix>
This is a fix for a bug (or closes open issue)
[C++]
Changes (can be) made in C++. Previously named `Code`
Code: Tests
Measurement, self-control, statistics, balancing.
Code: Tooling
Tooling that is not part of the main game but is part of the repo.
[JSON]
Changes (can be) made in JSON
json-styled
JSON lint passed, label assigned by github actions
Vehicles
Vehicles, parts, mechanics & interactions
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
Fixes #24802 - Makes electronics controls top level, and toggling electronics doesn't close menu.
Allows rebinding of vehicle menu keys
Makes appliances menu top level, rather than sub menu of vehicle interact_with; moved 'plug appliance' option inside the appliance menu, and any interact_with items should also appear in menu built by veh_app_interact::populate_app_actions.
Stops closing menu when toggling electronics, remember/forget vehicle position, enable/disable cruise control, camera systems enable/disable and opening/closing doors and curtains.
I've wanted to clean up vehicle::interact_with back in #44940 but then got busy IRL so I dropped it, got to complete it now.
There's 2 very similar menus; vehicle examine menu (triggered with
e
) and controls menu (triggered with^
), they're super similar but slightly different: Controls menu has half baked (closes after every action) top level electronics menu (and electronics sub menu too which doesn't close after every action) but not handbrake or horn. Examine menu has handbrake but not top level electronics. There's more differences but it's just inconsistent; this patch makes both trigger the same (and single) menu.Describe the solution
Refactoring the stuff in vehicle_use menus is awkward as it uses uilists with enums or int based indexing, which splits every menu item to 2 (or even 3 in case it needs theft check skip) separate places you need to touch.
This patch makes a helper class veh_menu in veh_utils.h/cpp for syntax sugar and wrapping over uilist functionality related to vehicles - registering hotkeys, theft check, part location callback, invalidating map cache and vehicle::refresh() are all called inside of it, it also stores the delegates in std::function so they can be passed around; for example to be used in appliances UI.
This also allows extracting entries from vehicle::interact_with into veh_app_interact::populate_app_actions enabling appliance to be a top level menu.
Trivial menu example can be seen in autopilot commit
After converting menus to use the helper class I merged the use_controls menu into interact_with menu.
Some hotkeys had overlaps, I moved what (in my opinion) is less important to less convenient keys:
h
toH
a
toC
s
toJ
e
tos
c
to nothingh
(only relevant if vehicle locked, not interfering with headlights toggle)But they can be rebound by players now so most inconvenience can be resolved in
?
menuDescribe alternatives you've considered
Testing
Unfortunately manually tested as it's mostly a UI change;
e
on appliance - appliance menu should appear directly (without vehicle menu first)^
near vehicle controls - menu should appear^
on vehicle controls - should take controls^
on vehicle controls while already in control - should show menue
on vehicle controls while already in control - should show menue
or^
with most choices involving electronics/battery disabled and extra options for hotwiring/triggering alarm ( a bit tricky to test as vehicles that are both locked and have security system intact are rare, I worked around it by making horn action set is_locked = true ).Remember/forget vehicle position, enable/disable cruise control, electronics toggles (including camera system), closing/opening individual doors/curtains in "Toggle doors" menu should not close the menu but let you continue toggling on/off and seeing the light/vision changes live.
Additional context
Appliances menu made top level instead of transitioning through vehicles examine menu
https://user-images.githubusercontent.com/6560075/189246050-68a448ba-24ea-4de5-9749-a35e3566f6d7.mp4
Vehicle menus don't close when activating electronics and similar options
https://user-images.githubusercontent.com/6560075/189245891-f7038b40-7879-4bd1-a454-b25de2b2169c.mp4