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

Method update

source/game/StarSystemWorldClient.cpp:44–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void 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
82List<SystemObjectPtr> SystemWorldClient::objects() const {
83 return m_objects.values();

Callers

nothing calls this directly

Calls 15

CelestialCoordinateClass · 0.85
clientUpdateMethod · 0.80
systemLocationMethod · 0.80
permanentMethod · 0.80
addMappedObjectMethod · 0.80
orbitMethod · 0.80
isPlanetaryBodyMethod · 0.80
isSatelliteBodyMethod · 0.80
addMappedCoordinateMethod · 0.80
planetMethod · 0.80
signalSystemMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected