Held item stays on the wrong side when the character turns around #69

Open
opened 2026-11-12 06:14:34 +00:00 by claude · 1 comment
Member

Reported by Eric after play-testing v0.2.0 (Season VI thread, post 6):

There is also a small issue that held items do not move when the player turns around.

Expected: the held item is always in front of the avatar, on the side it faces, and the avatar faces what the player is using an item on.

Notes from the code: the avatar only changes facing while A or D is held, so aiming at a block behind the avatar and digging leaves the avatar and its item pointing the other way. The held item's flip on a walk turn is done by re-sending its attachment offset; that path can't be seen headless and needs a check in the client.

Reported by Eric after play-testing v0.2.0 ([Season VI thread, post 6](https://discourse.eom.dev/t/luanti-season-vi/820/6)): > There is also a small issue that held items do not move when the player turns around. Expected: the held item is always in front of the avatar, on the side it faces, and the avatar faces what the player is using an item on. Notes from the code: the avatar only changes facing while A or D is held, so aiming at a block behind the avatar and digging leaves the avatar and its item pointing the other way. The held item's flip on a walk turn is done by re-sending its attachment offset; that path can't be seen headless and needs a check in the client.
claude added this to the v0.3 World & Biomes milestone 2026-11-12 06:14:34 +00:00
claude added the
type
bug
priority
medium
area/camera-controls
labels 2026-11-12 06:14:35 +00:00
Author
Member

Partly addressed in cd63a90. Left open until Eric confirms in the client.

What I found

  • On a walk turn (A/D), the server does flip the held item: a new selftest case checks that its attachment offset changes side and its yaw goes to 180. I also read the 5.10 client source (GenericCAO::setAttachment / updateAttachments): a repeated set_attach with new offsets is applied every time, so I couldn't find a reason for that path to fail.
  • The case that was really broken: the avatar only turned while A or D was held. Standing still and digging or placing behind the avatar left the sprite and the item pointing the wrong way.

What changed

  • While dig or place is held, the avatar faces the aimed x (strata.aim_x, strata.aim_facing). The aim wins over the walk direction, as in other 2D sandbox games.

Tests: 2 new cases; 79/79 pass.

@eric, when you next try it: does the item now follow when you (a) walk left then right, and (b) dig a block behind you? If (a) still fails, please say whether the sprite itself flips and the item doesn't.

Partly addressed in cd63a90. **Left open until Eric confirms in the client.** **What I found** - On a walk turn (A/D), the server does flip the held item: a new selftest case checks that its attachment offset changes side and its yaw goes to 180. I also read the 5.10 client source (`GenericCAO::setAttachment` / `updateAttachments`): a repeated `set_attach` with new offsets is applied every time, so I couldn't find a reason for that path to fail. - The case that was really broken: the avatar only turned while A or D was held. Standing still and digging or placing behind the avatar left the sprite and the item pointing the wrong way. **What changed** - While dig or place is held, the avatar faces the aimed x (`strata.aim_x`, `strata.aim_facing`). The aim wins over the walk direction, as in other 2D sandbox games. **Tests:** 2 new cases; 79/79 pass. @eric, when you next try it: does the item now follow when you (a) walk left then right, and (b) dig a block behind you? If (a) still fails, please say whether the sprite itself flips and the item doesn't.
Sign in to join this conversation.