Skip to content
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

Creature Dash: arrow keys don't move the "active" grid element #2477

Open
andretchen0 opened this issue Aug 8, 2023 · 3 comments
Open

Creature Dash: arrow keys don't move the "active" grid element #2477

andretchen0 opened this issue Aug 8, 2023 · 3 comments
Labels
coding This issue requires some programming easy Good place to start if you're a new developer input Deals with hotkeys, interaction & accessibility visuals Various things that easily catch the eye

Comments

@andretchen0
Copy link
Contributor

Below, "Uncle Fungus" is the "active" grid element.

Screenshot 2023-08-08 at 14 49 06 copy

Using arrow keys does not move the "active" element in the grid, leading to a mismatch like this:

Screenshot 2023-08-08 at 14 53 26

Here, the "active" grid element is "Uncle Fungus", but "Scavenger" is shown on the left.

To Reproduce

  1. Start a new game
  2. Click on the Priest's summon ability
  3. In the creature dash, hover over a creature thumbnail – it will become "active"
  4. Use arrow keys – the creature shown on the right of the screen will change, but the "active" grid element will not

Expected behavior

The "active" grid element should match what's shown on the right side of the screen.

@DreadKnight DreadKnight added coding This issue requires some programming visuals Various things that easily catch the eye easy Good place to start if you're a new developer input Deals with hotkeys, interaction & accessibility labels Aug 8, 2023
@DreadKnight DreadKnight added this to dash view in interface tweaks Aug 8, 2023
@DreadKnight
Copy link
Member

I'm aware of this one, no open issue for it already though afaik. I was thinking that this wasn't easily fixable at the time.

@andretchen0
Copy link
Contributor Author

I was thinking that this wasn't easily fixable at the time.

The whole thing is in need of a rethink/refactor, I think. To give you an idea:

The Creature Grid / Dash isn't isolated, either as a module or otherwise. It's a collection of attributes and methods in interface.js and there's a fair amount of leakage. E.g., the Dash system works by setting an attribute on interface that's picked up during button presses, to then be sent to the Priest's materialize method.

And here's how the priest ability says "choose a creature to summon":

	// Ask the creature to summon
	G.UI.materializeToggled = true;
	G.UI.toggleDash('randomize');

... so it's got to muck around with UI internals, despite not having a direct reference to UI. And then it doesn't even get a direct reference back. Some part of interface has to in turn muck around in the ability like so:

	activeCreature.abilities[3].materialize(this.lastViewedCreature);

Not pointing fingers, but just to walk you through what's going on: here are the assumptions behind and code brittleness introduced with just that single line:

  • activeCreature has to have a field called abilities.
  • That field has to be an array that has at least 4 slots.
  • The 3 slot in the array has to have a materialize method.

And that doesn't include how it is that interface decides that this activeCreature is a creature who can summon.

The whole thing could be a lot less brittle and a lot less complicated if it were called like this:

	// Ask the creature to summon
	G.chooseCreatureTypeFrom(this.creature.getSummonableCreatureTypes()).then(type => this.materialize(type));
  • No special interface code to figure out if the current creature can summon and is currently summoning.
  • No knowledge of interface at all in the ability.

@andretchen0 andretchen0 self-assigned this Aug 13, 2023
@andretchen0
Copy link
Contributor Author

I have a coded solution. I'll wait on feedback from this discussion before finalizing and opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coding This issue requires some programming easy Good place to start if you're a new developer input Deals with hotkeys, interaction & accessibility visuals Various things that easily catch the eye
Projects
Development

No branches or pull requests

2 participants