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

Method createTooltip

source/frontend/StarScriptPane.cpp:57–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57PanePtr ScriptPane::createTooltip(Vec2I const& screenPosition) {
58 auto result = m_script.invoke<Json>("createTooltip", screenPosition);
59 if (result && !result.value().isNull()) {
60 if (result->type() == Json::Type::String) {
61 return SimpleTooltipBuilder::buildTooltip(result->toString());
62 } else {
63 PanePtr tooltip = make_shared<Pane>();
64 m_reader->construct(*result, tooltip.get());
65 return tooltip;
66 }
67 } else {
68 ItemPtr item;
69 if (auto child = getChildAt(screenPosition)) {
70 if (auto itemSlot = as<ItemSlotWidget>(child))
71 item = itemSlot->item();
72 if (auto itemGrid = as<ItemGridWidget>(child))
73 item = itemGrid->itemAt(screenPosition);
74 }
75 if (item)
76 return ItemTooltipBuilder::buildItemTooltip(item, m_client->mainPlayer());
77 return {};
78 }
79}
80
81LuaCallbacks ScriptPane::makePaneCallbacks() {
82 LuaCallbacks callbacks = BaseScriptPane::makePaneCallbacks();

Callers

nothing calls this directly

Calls 9

mainPlayerMethod · 0.80
isNullMethod · 0.45
valueMethod · 0.45
typeMethod · 0.45
toStringMethod · 0.45
constructMethod · 0.45
getMethod · 0.45
itemMethod · 0.45
itemAtMethod · 0.45

Tested by

no test coverage detected