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

Method removeObject

source/game/StarSystemWorldServer.cpp:149–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void SystemWorldServer::removeObject(Uuid objectUuid) {
150 if (!m_objects.contains(objectUuid))
151 throw StarException(strf("Cannot remove object with uuid '{}', object doesn't exist.", objectUuid.hex()));
152
153 if (m_objects[objectUuid]->permanent())
154 throw StarException(strf("Cannot remove object with uuid '{}', object is marked permanent", objectUuid.hex()));
155
156 // already removing it
157 if (m_objectDestroyQueue.contains(objectUuid))
158 return;
159
160 // fly away any active ships that are located at the object
161 for (auto p : m_clientShips) {
162 auto ship = m_ships.get(p.second);
163 auto location = ship->systemLocation();
164 if (location == objectUuid || ship->destination() == objectUuid) {
165 ship->setDestination(*systemLocationPosition(objectUuid));
166 if (!ship->flying())
167 m_shipFlights.append(p.first);
168 }
169 }
170
171 m_objectDestroyQueue.append(objectUuid);
172}
173
174bool SystemWorldServer::addObject(SystemObjectPtr object, bool doRangeCheck) {
175 if (doRangeCheck) {

Callers

nothing calls this directly

Calls 11

StarExceptionClass · 0.85
strfFunction · 0.85
hexMethod · 0.80
permanentMethod · 0.80
systemLocationMethod · 0.80
destinationMethod · 0.80
setDestinationMethod · 0.80
containsMethod · 0.45
getMethod · 0.45
flyingMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected