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

Method createTooltip

source/frontend/StarBaseScriptPane.cpp:101–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99bool BaseScriptPane::interactive() const { return m_interactive; }
100
101PanePtr BaseScriptPane::createTooltip(Vec2I const& screenPosition) {
102 auto result = m_script.invoke<Json>("createTooltip", screenPosition);
103 if (result && !result.value().isNull()) {
104 if (result->type() == Json::Type::String) {
105 return SimpleTooltipBuilder::buildTooltip(result->toString());
106 } else {
107 PanePtr tooltip = make_shared<Pane>();
108 m_reader->construct(*result, tooltip.get());
109 return tooltip;
110 }
111 } else {
112 ItemPtr item;
113 if (auto child = getChildAt(screenPosition)) {
114 if (auto itemSlot = as<ItemSlotWidget>(child))
115 item = itemSlot->item();
116 if (auto itemGrid = as<ItemGridWidget>(child))
117 item = itemGrid->itemAt(screenPosition);
118 }
119 if (item)
120 return ItemTooltipBuilder::buildItemTooltip(item);
121 return {};
122 }
123}
124
125Maybe<String> BaseScriptPane::cursorOverride(Vec2I const& screenPosition) {
126 auto result = m_script.invoke<Maybe<String>>("cursorOverride", screenPosition);

Callers

nothing calls this directly

Calls 8

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