Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/client/StarClientApplication.cpp12
-rw-r--r--source/frontend/StarMainInterface.cpp8
-rw-r--r--source/frontend/StarMainInterface.hpp1
-rw-r--r--source/game/StarPlayer.cpp2
4 files changed, 16 insertions, 7 deletions
diff --git a/source/client/StarClientApplication.cpp b/source/client/StarClientApplication.cpp
index ef78dd7..3370802 100644
--- a/source/client/StarClientApplication.cpp
+++ b/source/client/StarClientApplication.cpp
@@ -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())
diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp
index d98d888..0d0cb5f 100644
--- a/source/frontend/StarMainInterface.cpp
+++ b/source/frontend/StarMainInterface.cpp
@@ -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());
diff --git a/source/frontend/StarMainInterface.hpp b/source/frontend/StarMainInterface.hpp
index 96e4fbd..0f1487e 100644
--- a/source/frontend/StarMainInterface.hpp
+++ b/source/frontend/StarMainInterface.hpp
@@ -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);
diff --git a/source/game/StarPlayer.cpp b/source/game/StarPlayer.cpp
index e57400a..e9f0daf 100644
--- a/source/game/StarPlayer.cpp
+++ b/source/game/StarPlayer.cpp
@@ -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);