| 260 | } |
| 261 | |
| 262 | void 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 | } |
nothing calls this directly
no test coverage detected