Dungeon crawler: server-mode HP/MP potions never dispatch when a stack is equipped #1038

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

DungeonCrawlerComponent.dispatchPotionUseToServer (used by useHPPotion / useMPPotion when useServerAuthority is true) looks up the bag slot with:

const targetId = equipped?.id ?? (kind === "hp" ? "healthPotion" : "manaPotion");
const slot = this.inventory.findIndex((it) => it?.itemId === targetId);

Two failures:

  1. When a potion is equipped, targetId is the instance uuid (equipped.id) compared against itemId ("healthPotion") — never matches.
  2. equipItem already removed the stack from the bag, so even a correct id/itemId lookup would miss.

Result: pressing 1/2 in server mode with an equipped potion never calls gameServer.useItem. Characterized in dungeon-crawler.inventory-maze.spec.ts (wave 7 a1 tick 2).

Expected: send the equipped potion's inventory slot (or re-find by itemId / keep a server slot index) so the server can consume the stack.

`DungeonCrawlerComponent.dispatchPotionUseToServer` (used by `useHPPotion` / `useMPPotion` when `useServerAuthority` is true) looks up the bag slot with: ```ts const targetId = equipped?.id ?? (kind === "hp" ? "healthPotion" : "manaPotion"); const slot = this.inventory.findIndex((it) => it?.itemId === targetId); ``` Two failures: 1. When a potion is equipped, `targetId` is the **instance uuid** (`equipped.id`) compared against `itemId` (`"healthPotion"`) — never matches. 2. `equipItem` already removed the stack from the bag, so even a correct `id`/`itemId` lookup would miss. Result: pressing 1/2 in server mode with an equipped potion never calls `gameServer.useItem`. Characterized in `dungeon-crawler.inventory-maze.spec.ts` (wave 7 a1 tick 2). Expected: send the equipped potion's inventory slot (or re-find by `itemId` / keep a server slot index) so the server can consume the stack.
Author
Owner

Already present on spikersoft-angular master (48e93a23e). dispatchPotionUseToServer matches equipped.itemId (not the instance uuid) against bag slots. Closing.

Already present on `spikersoft-angular` `master` (`48e93a23e`). `dispatchPotionUseToServer` matches `equipped.itemId` (not the instance uuid) against bag slots. Closing.
Sign in to join this conversation.