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

Method containerItems

source/game/scripting/StarWorldLuaBindings.cpp:1605–1615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)) {

Callers 2

ContainerPaneMethod · 0.45
updateMethod · 0.45

Calls 7

singletonClass · 0.85
JsonClass · 0.85
itemDatabaseMethod · 0.80
itemsMethod · 0.80
itemBagMethod · 0.80
appendMethod · 0.45
toJsonMethod · 0.45

Tested by

no test coverage detected