space-game: cloak key toggles client shader independently of server stealth command #1035

Closed
opened 2026-08-13 05:05:02 +00:00 by spikerj · 1 comment
Owner

In space-game.component.ts, the cloak/stealth keybinding (c) flips clientCloakActive and applies/removes the local cloak shader, then always calls toggleStealth() which sends !currentStealthActive (last-known server stealth).

currentStealthActive is only updated from the stealthStates signal — not from the keypress. A second press before the server ack therefore:

  • visually uncloaks the local ship (clientCloakActive = false, shader removed)
  • still sends toggleStealth(true) to the server

Caught by Wave 7 coverage tests: pressing c twice with currentStealthActive === false applies then removes the hull cloak, but GameServerService.toggleStealth is invoked with true both times.

Expected: the server command should follow the client-intended cloak state (or currentStealthActive should be updated locally on keypress) so a second press requests stealth off.

In `space-game.component.ts`, the cloak/stealth keybinding (`c`) flips `clientCloakActive` and applies/removes the local cloak shader, then always calls `toggleStealth()` which sends `!currentStealthActive` (last-known **server** stealth). `currentStealthActive` is only updated from the `stealthStates` signal — not from the keypress. A second press before the server ack therefore: - visually uncloaks the local ship (`clientCloakActive = false`, shader removed) - still sends `toggleStealth(true)` to the server Caught by Wave 7 coverage tests: pressing `c` twice with `currentStealthActive === false` applies then removes the hull cloak, but `GameServerService.toggleStealth` is invoked with `true` both times. Expected: the server command should follow the client-intended cloak state (or `currentStealthActive` should be updated locally on keypress) so a second press requests stealth **off**.
Author
Owner

Fixed in spikersoft-angular PR #823 (a0f0ccd9). Closing.

Fixed in `spikersoft-angular` [PR #823](https://git.spikersoft.com/spikerj/spikersoft-angular/pulls/823) (`a0f0ccd9`). Closing.
Sign in to join this conversation.