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

Method shiftItemFromInventory

source/frontend/StarBaseScriptPane.cpp:133–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133Maybe<ItemPtr> BaseScriptPane::shiftItemFromInventory(ItemPtr const& input) {
134 auto result = m_script.invoke<Json>("shiftItemFromInventory", input->descriptor().toJson());
135 if (!result || result->isNull())
136 return {};
137
138 auto itemDatabase = Root::singleton().itemDatabase();
139
140 if (result->type() == Json::Type::Bool) {
141 if (result->toBool())
142 return itemDatabase->item({});
143 return {};
144 }
145
146 return itemDatabase->item(ItemDescriptor(result.value()));
147}
148
149GuiReaderPtr BaseScriptPane::reader() {
150 return m_reader;

Callers 1

InventoryPaneMethod · 0.45

Calls 10

singletonClass · 0.85
ItemDescriptorClass · 0.85
itemDatabaseMethod · 0.80
toBoolMethod · 0.80
toJsonMethod · 0.45
descriptorMethod · 0.45
isNullMethod · 0.45
typeMethod · 0.45
itemMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected