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

Method clientFlyShip

source/game/StarUniverseServer.cpp:305–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void UniverseServer::clientFlyShip(ConnectionId clientId, Vec3I const& system, SystemLocation const& location, Json const& settings) {
306 RecursiveMutexLocker locker(m_mainLock);
307 ReadLocker clientsLocker(m_clientsLock);
308
309 if (m_pendingFlights.contains(clientId) || m_queuedFlights.contains(clientId))
310 return;
311
312 auto clientContext = m_clients.get(clientId);
313 if (!clientContext)
314 return;
315
316 if (system == Vec3I()) {
317 m_pendingFlights.set(clientId, make_tuple(Vec3I(), SystemLocation(), settings)); // find starter world
318 return;
319 }
320
321 auto clientSystem = clientContext->systemWorld();
322 bool sameSystem = clientSystem && clientSystem->location() == system;
323 bool sameLocation = clientSystem && clientSystem->clientShipLocation(clientId) == location;
324 if (m_pendingArrivals.contains(clientId) && sameSystem && location && !sameLocation) {
325 // for continuing flight within a system, set the new destination immediately
326 clientSystem->setClientDestination(clientId, location);
327 return;
328 }
329
330 // don't switch systems while already flying
331 if (!m_pendingArrivals.contains(clientId) || sameSystem)
332 m_pendingFlights.set(clientId, make_tuple(system, location, settings));
333}
334
335WorldId UniverseServer::clientWorld(ConnectionId clientId) const {
336 RecursiveMutexLocker locker(m_mainLock);

Callers

nothing calls this directly

Calls 7

systemWorldMethod · 0.80
containsMethod · 0.45
getMethod · 0.45
setMethod · 0.45
locationMethod · 0.45
clientShipLocationMethod · 0.45
setClientDestinationMethod · 0.45

Tested by

no test coverage detected