diff options
author | Degranon <boba09@list.ru> | 2025-02-01 01:18:12 +0100 |
---|---|---|
committer | Degranon <boba09@list.ru> | 2025-02-01 01:18:12 +0100 |
commit | 5aa02ed749c3eb3411f6621ca45ac59d9428392c (patch) | |
tree | 01068222b290b83e134f73731b0f0a0a20b238e9 | |
parent | 988b13ba2d25beac7249ef9797011130c25d6ea8 (diff) |
Change your position on warp to the same planet
-rw-r--r-- | source/game/StarUniverseClient.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/game/StarUniverseClient.cpp b/source/game/StarUniverseClient.cpp index 12d72ee..279d63d 100644 --- a/source/game/StarUniverseClient.cpp +++ b/source/game/StarUniverseClient.cpp @@ -416,6 +416,19 @@ void UniverseClient::warpPlayer(WarpAction const& warpAction, bool animate, Stri return; m_mainPlayer->stopLounging(); + + // Check if the warp target is within the same world + if (warpAction.is<WarpToWorld>()) { + if (auto warpToWorld = warpAction.ptr<WarpToWorld>()) { + if (warpToWorld->world.empty() || warpToWorld->world == playerWorld()) { + if (auto pos = warpToWorld->target.ptr<SpawnTargetPosition>()) { + m_mainPlayer->movementController()->setPosition(*pos + Vec2F{0, 2}); // Add a little space to up + return; + } + } + } + } + if (animate) { m_mainPlayer->teleportOut(animationType, deploy); m_warping = warpAction; |