| 1615 | } |
| 1616 | |
| 1617 | Json WorldEntityCallbacks::containerItemAt(World* world, EntityId entityId, size_t offset) { |
| 1618 | if (auto container = world->get<ContainerObject>(entityId)) { |
| 1619 | auto itemDb = Root::singleton().itemDatabase(); |
| 1620 | auto items = container->itemBag()->items(); |
| 1621 | if (offset < items.size()) { |
| 1622 | return itemDb->toJson(items.at(offset)); |
| 1623 | } |
| 1624 | } |
| 1625 | |
| 1626 | return Json(); |
| 1627 | } |
| 1628 | |
| 1629 | Maybe<bool> WorldEntityCallbacks::containerConsume(World* world, EntityId entityId, Json const& items) { |
| 1630 | if (auto container = world->get<ContainerObject>(entityId)) { |