Skip to content

Conversation

@yousefsassy
Copy link
Contributor

This PR implements the behavior described in #2246, making the cursor change to progress when:

. It is the player's turn

. The hovered creature is the currently active creature

. No ability is selected

In creature.ts:

Attached onInputOver and onInputOut handlers to the creature’s sprite
When hovering the active unit with no selected ability:

Set cursor: progress on both document.body and

Enabled a cursorFrozen flag in the UI to track override state

const sprite = this.creatureSprite.sprite;
sprite.inputEnabled = true;

sprite.events.onInputOver.add(() => {
  const selectedAbilityIndex = game.UI.selectedAbility;

  if (
    game.activeCreature === this &&
    this.player === game.activePlayer &&
    selectedAbilityIndex === -1
  ) {
    console.log('[✅] Progress cursor conditions met for:', this.name);
    document.body.style.cursor = 'progress';
    const canvas = document.querySelector('canvas');
    if (canvas) canvas.style.cursor = 'progress';

    game.UI.cursorFrozen = true;
  } else {
    console.log('[❌] Conditions not met for:', this.name);
  }
}, this);

sprite.events.onInputOut.add(() => {
  document.body.style.cursor = 'default';
  const canvas = document.querySelector('canvas');
  if (canvas) canvas.style.cursor = 'default';

  game.UI.cursorFrozen = false;
});

In interface.js:

Added a global mousemove listener that maintains the progress cursor when cursorFrozen is true.
document.addEventListener('mousemove', () => {
  if (ui.cursorFrozen) {
    const canvas = document.querySelector('canvas');
    if (canvas) canvas.style.cursor = 'progress';
    document.body.style.cursor = 'progress';
  }
});

PS : the audio updated files somehow appeared when i created my branch as i didnt touch anything related to the audio i think it belongs to the latest merge that you did i only modifed interface.js and creature.ts

@vercel
Copy link

vercel bot commented Apr 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
ancientbeast ✅ Ready (Inspect) Visit Preview Apr 13, 2025 0:58am

@DreadKnight
Copy link
Member

@yousefsassy I've tested this and causes some issues and regressions:

  • hard to click innactive unit, need to sort of click the health indicator
  • no unit name shout + name shown when clicking the active unit

Will mark as draft for now. Don't worry about the audio stuff being touched, as I see, there's some linting going on.

@DreadKnight DreadKnight marked this pull request as draft April 22, 2025 03:32
@yousefsassy
Copy link
Contributor Author

@DreadKnight got it will check it out again and solve those issues but besides that everything works well ?

@DreadKnight
Copy link
Member

@DreadKnight got it will check it out again and solve those issues but besides that everything works well ?

@yousefsassy Seemed so, at least those were the problems that sticked out first thing. Will test some once they're fixed and we'll see what's next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants