fix: stand-up-on-move and nameplate position tracking

Camera controller / sitting:
- Any movement key (WASD/QE/Space) pressed while sitting now clears the
  sitting flag immediately, matching WoW's sit-to-stand-on-move behaviour
- Added StandUpCallback: when the player stands up via local input the
  callback fires setStandState(0) → CMSG_STAND_STATE_CHANGE(STAND) so
  the server releases the sit lock and restores normal movement
- Fixes character getting stuck in sit state after accidentally
  right-clicking a chair GO in Goldshire Inn (or similar)

Nameplates:
- Use getRenderPositionForGuid() (renderer visual position) as primary
  source for nameplate anchor, falling back to entity X/Y/Z only when
  no render instance exists yet; keeps health bars in sync with the
  rendered model instead of the parallel entity interpolator
This commit is contained in:
Kelsi 2026-03-10 19:49:33 -07:00
parent 48d15fc653
commit 564a286282
4 changed files with 34 additions and 8 deletions

View file

@ -90,6 +90,11 @@ public:
// Movement callback for sending opcodes to server
using MovementCallback = std::function<void(uint32_t opcode)>;
void setMovementCallback(MovementCallback cb) { movementCallback = std::move(cb); }
// Callback invoked when the player stands up via local input (space/X/movement key
// while server-sitting), so the caller can send CMSG_STAND_STATE_CHANGE(0).
using StandUpCallback = std::function<void()>;
void setStandUpCallback(StandUpCallback cb) { standUpCallback_ = std::move(cb); }
void setUseWoWSpeed(bool use) { useWoWSpeed = use; }
void setRunSpeedOverride(float speed) { runSpeedOverride_ = speed; }
void setWalkSpeedOverride(float speed) { walkSpeedOverride_ = speed; }
@ -265,6 +270,7 @@ private:
// Movement callback
MovementCallback movementCallback;
StandUpCallback standUpCallback_;
// Movement speeds
bool useWoWSpeed = false;