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

Method update

source/frontend/StarContainerInterface.cpp:262–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260}
261
262void ContainerPane::update(float dt) {
263 Pane::update(dt);
264
265 if (m_script)
266 m_script->update(m_script->updateDt(dt));
267
268 m_itemBag->clearItems();
269 Input& input = Input::singleton();
270
271 if (!m_containerInteractor->containerOpen()) {
272 dismiss();
273
274 } else {
275 auto container = m_containerInteractor->openContainer();
276
277 for (size_t i = 0; i < m_itemBag->size(); ++i)
278 m_itemBag->putItems(i, container->containerItems()[i]);
279
280 if (container->isInteractive()) {
281 if (auto itemGrid = fetchChild<ItemGridWidget>("itemGrid")) {
282 itemGrid->setProgress(container->craftingProgress());
283 itemGrid->updateAllItemSlots();
284 }
285 if (auto itemGrid = fetchChild<ItemGridWidget>("itemGrid2")) {
286 itemGrid->setProgress(container->craftingProgress());
287 itemGrid->updateAllItemSlots();
288 }
289
290 if (auto fuelGauge = fetchChild<FuelWidget>("fuelGauge")) {
291 fuelGauge->setCurrentFuelLevel(m_worldClient->getProperty("ship.fuel", 0).toUInt());
292 fuelGauge->setMaxFuelLevel(m_worldClient->getProperty("ship.maxFuel", 0).toUInt());
293 float totalFuelAmount = 0;
294 for (auto& item : container->containerItems()) {
295 if (item)
296 totalFuelAmount += item->instanceValue("fuelAmount", 0).toUInt() * item->count();
297 }
298 fuelGauge->setPotentialFuelAmount(totalFuelAmount);
299 fuelGauge->setRequestedFuelAmount(0);
300 }
301
302 if (input.bindDown("opensb", "takeAll")) {
303 m_containerInteractor->clearContainer();
304 }
305 }
306 }
307}
308
309}

Callers

nothing calls this directly

Calls 15

singletonClass · 0.85
updateDtMethod · 0.80
clearItemsMethod · 0.80
openContainerMethod · 0.80
craftingProgressMethod · 0.80
updateAllItemSlotsMethod · 0.80
setCurrentFuelLevelMethod · 0.80
toUIntMethod · 0.80
setMaxFuelLevelMethod · 0.80
instanceValueMethod · 0.80

Tested by

no test coverage detected