summaryrefslogtreecommitdiff
path: root/plugins/ruby/item.rb
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/ruby/item.rb')
-rw-r--r--plugins/ruby/item.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/ruby/item.rb b/plugins/ruby/item.rb
index 34b40450..fc840f7a 100644
--- a/plugins/ruby/item.rb
+++ b/plugins/ruby/item.rb
@@ -4,9 +4,14 @@ module DFHack
# arg similar to unit.rb/unit_find; no arg = 'k' menu
def item_find(what=:selected, y=nil, z=nil)
if what == :selected
- if curview._rtti_classname == :viewscreen_itemst
+ case curview._rtti_classname
+ when :viewscreen_itemst
ref = curview.entry_ref[curview.cursor_pos]
ref.item_tg if ref.kind_of?(GeneralRefItem)
+ when :viewscreen_storesst # z/stocks
+ if curview.in_group_mode == 0 and curview.in_right_list == 1
+ curview.items[curview.item_cursor]
+ end
else
case ui.main.mode
when :LookAround
@@ -26,6 +31,8 @@ module DFHack
u = world.units.active[ui_selected_unit]
u.inventory[ui_look_cursor].item if u and u.pos.z == cursor.z and
ui_unit_view_mode.value == :Inventory and u.inventory[ui_look_cursor]
+ else
+ ui.follow_item_tg if ui.follow_item != -1
end
end
elsif what.kind_of?(Integer)