fix late aimPosition

This commit is contained in:
Kae 2024-03-15 16:26:12 +11:00
parent 658fab846e
commit 696abcca71
4 changed files with 16 additions and 7 deletions

View File

@ -874,6 +874,12 @@ void ClientApplication::updateRunning(float dt) {
else
m_player->setMoveVector(Vec2F());
m_voice->setInput(m_input->bindHeld("opensb", "pushToTalk"));
DataStreamBuffer voiceData;
voiceData.setByteOrder(ByteOrder::LittleEndian);
//voiceData.writeBytes(VoiceBroadcastPrefix.utf8Bytes()); transmitting with SE compat for now
bool needstoSendVoice = m_voice->send(voiceData, 5000);
auto checkDisconnection = [this]() {
if (!m_universeClient->isConnected()) {
m_cinematicOverlay->stop();
@ -893,11 +899,7 @@ void ClientApplication::updateRunning(float dt) {
if (checkDisconnection())
return;
m_voice->setInput(m_input->bindHeld("opensb", "pushToTalk"));
DataStreamBuffer voiceData;
voiceData.setByteOrder(ByteOrder::LittleEndian);
//voiceData.writeBytes(VoiceBroadcastPrefix.utf8Bytes()); transmitting with SE compat for now
bool needstoSendVoice = m_voice->send(voiceData, 5000);
m_mainInterface->preUpdate(dt);
m_universeClient->update(dt);
if (checkDisconnection())

View File

@ -505,6 +505,12 @@ void MainInterface::handleInteractAction(InteractAction interactAction) {
}
}
void MainInterface::preUpdate(float dt) {
auto player = m_client->mainPlayer();
if (!m_client->paused())
player->aim(cursorWorldPosition());
}
void MainInterface::update(float dt) {
m_paneManager.update(dt);
m_cursor.update(dt);
@ -516,8 +522,6 @@ void MainInterface::update(float dt) {
auto player = m_client->mainPlayer();
auto cursorWorldPos = cursorWorldPosition();
if (!m_client->paused())
player->aim(cursorWorldPos);
if (player->wireToolInUse()) {
m_paneManager.displayRegisteredPane(MainInterfacePanes::WireInterface);
player->setWireConnector(m_wireInterface.get());

View File

@ -89,6 +89,7 @@ public:
void handleInteractAction(InteractAction interactAction);
void preUpdate(float dt);
// Handles incoming client messages, aims main player, etc.
void update(float dt);

View File

@ -900,7 +900,9 @@ void Player::update(float dt, uint64_t) {
m_tools->effects(*m_effectEmitter);
auto aimRelative = world()->geometry().diff(m_aimPosition, position()); // dumb, but due to how things are ordered
m_movementController->tickMaster(dt);
m_aimPosition = position() + aimRelative; // it's gonna have to be like this for now
m_techController->tickMaster(dt);