| 1603 | } |
| 1604 | |
| 1605 | Json WorldEntityCallbacks::containerItems(World* world, EntityId entityId) { |
| 1606 | if (auto container = world->get<ContainerObject>(entityId)) { |
| 1607 | JsonArray res; |
| 1608 | auto itemDb = Root::singleton().itemDatabase(); |
| 1609 | for (auto const& item : container->itemBag()->items()) |
| 1610 | res.append(itemDb->toJson(item)); |
| 1611 | return res; |
| 1612 | } |
| 1613 | |
| 1614 | return Json(); |
| 1615 | } |
| 1616 | |
| 1617 | Json WorldEntityCallbacks::containerItemAt(World* world, EntityId entityId, size_t offset) { |
| 1618 | if (auto container = world->get<ContainerObject>(entityId)) { |