mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix shootline not being updated if press and release happen in the same step (#14606)
This commit is contained in:
parent
70bddcf318
commit
d7f9da49eb
2 changed files with 6 additions and 1 deletions
|
@ -703,6 +703,7 @@ void TouchScreenGUI::translateEvent(const SEvent &event)
|
|||
m_move_pos = touch_pos;
|
||||
// DON'T reset m_tap_state here, otherwise many short taps
|
||||
// will be ignored if you tap very fast.
|
||||
m_had_move_id = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -821,13 +822,14 @@ void TouchScreenGUI::step(float dtime)
|
|||
// Note that the shootline isn't used if touch_use_crosshair is enabled.
|
||||
// Only updating when m_has_move_id means that the shootline will stay at
|
||||
// it's last in-world position when the player doesn't need it.
|
||||
if (!m_draw_crosshair && m_has_move_id) {
|
||||
if (!m_draw_crosshair && (m_has_move_id || m_had_move_id)) {
|
||||
v2s32 pointer_pos = getPointerPos();
|
||||
m_shootline = m_device
|
||||
->getSceneManager()
|
||||
->getSceneCollisionManager()
|
||||
->getRayFromScreenCoordinates(pointer_pos);
|
||||
}
|
||||
m_had_move_id = false;
|
||||
}
|
||||
|
||||
void TouchScreenGUI::resetHotbarRects()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue