flybywiresim / discord-bot-utils

Utilities Discord Bot created for the FlyByWire Discord server.
https://flybywiresim.com/
GNU Affero General Public License v3.0
5 stars 7 forks source link

feat: locate cmd #51

Closed ExampleWasTaken closed 5 months ago

ExampleWasTaken commented 5 months ago

Description

This PR adds a /locate command. The command allows users to search for systems, switches and panels on the flight deck. The bot will respond with a screenshot of where the panel is located on the flight deck and links to the relevant documentation.

The command supports any amount of aircraft (see below).


Syntax

/locate <aircraft> <target>

aircraft: Subcommand target: The system, switch, panel to locate. (can include spaces)


Autocomplete

The target field uses dynamic autocompletion.

The following conditions have to be met for a possible target-identifier to be suggested to the user:

With the current implementation, each search operation completes in an average of 0.12 ms, as measured across 100 searches. This means that network speed is the primary bottleneck affecting response time between user input and result presentation. New aircraft will not influence this time. It's linear to the amount of identifiers per aircraft.

Additional Information

Requires #52


File sizes


A380X

This command is fully ready to support the A380X, as well as any other aircraft. To enable A380X compatibility, simply follow these steps:

  1. Add A380X panels.
  2. Uncomment the relevant code in locate.ts.

Code Review

As this PR is a direct child of #52, its diff will (until #52 is merged) contain files not planned to be commited by this PR.

Test Results

The images below are a selection showing an example for every type of image.

Overhead: image

Glareshied/Front Panel: image

Central Front Panel: image

FWD Pedestal: image

AFT Pedestal NOTE: This uses an outdated image that is still cached by Discord. See here for the current image! image

Discord Username

examplewastaken

frankkopp commented 5 months ago

Please instead of recreating docs pages/screenshots please simply link to the existing docs pages. Really not a good idea to duplicate this.

ExampleWasTaken commented 5 months ago

There might be a bug related to how spaces are handled in the target query. Will investigate.

FIXED

benw202 commented 5 months ago

One thought: Colorblind people with tritanopia, or blue-yellow color blindness, may see yellow as violet or light gray.

Do we want to worry about having a yellow border around a blue/gray background? I guess there's other problems to consider with flying our aircraft for certain color blind people, but wanted to bring it up as a concept. (an alternative: Bright Magenta (#FF00FF) according to some research ).

I don't think this is a must, but wanted throw it out there.

Overall like the code and setup. Good job. Make sure to first merge #52 and then update this command with a rebase before merging this :)

Good point on this with the colours!

ExampleWasTaken commented 5 months ago

One thought: Colorblind people with tritanopia, or blue-yellow color blindness, may see yellow as violet or light gray.

Do we want to worry about having a yellow border around a blue/gray background? I guess there's other problems to consider with flying our aircraft for certain color blind people, but wanted to bring it up as a concept. (an alternative: Bright Magenta (#FF00FF) according to some research ).

I don't think this is a must, but wanted throw it out there.

Overall like the code and setup. Good job. Make sure to first merge #52 and then update this command with a rebase before merging this :)

Very good point! I thought about color blindness when choosing the color but didn't consider that the cockpit is mostly blue-ish. Magenta seems like a much better color. I will change that.

ExampleWasTaken commented 5 months ago

I ran both colors through a color blindness simulator (I am not color blind so I have no real reference) and got the following results:

The color blindness types I tested against were:

The simulators I used (multiple to prevent possible biases):

Results

Yellow is more or less distinguishable with all types.

Magenta is not distinguishable at all with Achromatopsia and has poor contrast with the panel color with:

Conclusion

Based on these results I suggest using yellow as the indicator color.

Example images

Magenta with Achromatopsia: monochromacy

Yellow with Achromatopsia: yellow_monochromacy

benw202 commented 5 months ago

@ExampleWasTaken #52 Has been merged. Please update this PR :)