| 42 | } |
| 43 | |
| 44 | void SystemWorldClient::update(float dt) { |
| 45 | if (!m_ship) |
| 46 | return; |
| 47 | |
| 48 | m_ship->clientUpdate(dt); |
| 49 | |
| 50 | auto location = m_ship->systemLocation(); |
| 51 | if (auto uuid = location.maybe<Uuid>()) { |
| 52 | if (auto object = getObject(*uuid)) { |
| 53 | Maybe<CelestialOrbit> orbit; |
| 54 | |
| 55 | if (object->permanent()) |
| 56 | m_universeMap->addMappedObject(CelestialCoordinate(m_location), *uuid, object->name(), object->orbit(), object->parameters()); |
| 57 | else |
| 58 | m_universeMap->addMappedObject(CelestialCoordinate(m_location), *uuid, object->name()); |
| 59 | } |
| 60 | } else if (auto coordinate = location.maybe<CelestialCoordinate>()) { |
| 61 | if (coordinate->isPlanetaryBody() || coordinate->isSatelliteBody()) |
| 62 | m_universeMap->addMappedCoordinate(coordinate->planet()); |
| 63 | } else if (auto orbit = location.maybe<CelestialOrbit>()) { |
| 64 | if (orbit->target.isPlanetaryBody() || orbit->target.isSatelliteBody()) |
| 65 | m_universeMap->addMappedCoordinate(orbit->target.planet()); |
| 66 | } |
| 67 | |
| 68 | for (auto p : m_clientShips) |
| 69 | p.second->clientUpdate(dt); |
| 70 | for (auto p : m_objects) |
| 71 | p.second->clientUpdate(dt); |
| 72 | |
| 73 | if (currentSystem().isNull()) { |
| 74 | m_objects.clear(); |
| 75 | m_clientShips.clear(); |
| 76 | m_ship = {}; |
| 77 | m_location = Vec3I(); |
| 78 | } else if (auto celestialSlave = as<CelestialSlaveDatabase>(m_celestialDatabase)) |
| 79 | celestialSlave->signalSystem(currentSystem()); // keeps the celestial chunk for our current system alive |
| 80 | } |
| 81 | |
| 82 | List<SystemObjectPtr> SystemWorldClient::objects() const { |
| 83 | return m_objects.values(); |
nothing calls this directly
no test coverage detected