MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / warpPlayer

Method warpPlayer

source/game/StarUniverseClient.cpp:440–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440void UniverseClient::warpPlayer(WarpAction const& warpAction, bool animate, String const& animationType, bool deploy) {
441 // don't interrupt teleportation in progress
442 if (m_warping || m_respawning)
443 return;
444
445 m_mainPlayer->stopLounging();
446
447 // Check if the warp target is within the same world
448 if (auto warpToWorld = warpAction.ptr<WarpToWorld>()) {
449 if (warpToWorld->world.empty() || warpToWorld->world == playerWorld()) {
450 if (auto pos = warpToWorld->target.ptr<SpawnTargetPosition>()) {
451 m_mainPlayer->moveTo(*pos);
452 return;
453 }
454 }
455 }
456
457 if (animate) {
458 m_mainPlayer->teleportOut(animationType, deploy);
459 m_warping = warpAction;
460 m_warpDelay.reset();
461 }
462
463 m_pendingWarp = warpAction;
464}
465
466void UniverseClient::flyShip(Vec3I const& system, SystemLocation const& destination, Json const& settings) {
467 m_connection->pushSingle(make_shared<FlyShipPacket>(system, destination, settings));

Callers

nothing calls this directly

Calls 5

stopLoungingMethod · 0.80
moveToMethod · 0.80
emptyMethod · 0.45
teleportOutMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected