diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-02-01 20:32:58 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-02-01 20:32:58 -0700 |
commit | f63e7b7a9be93b69c033fe62d17669e0eab5033c (patch) | |
tree | de88dea1e8fb9226903a9941e9d5792d6a534a83 /node_controllers.lua | |
parent | 43b10262fcb89c90eceb8dff253f541cb4dc67f3 (diff) |
add "help" buttons to various formspecs when doc is installed
Diffstat (limited to 'node_controllers.lua')
-rw-r--r-- | node_controllers.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/node_controllers.lua b/node_controllers.lua index c51b48f..2a3c629 100644 --- a/node_controllers.lua +++ b/node_controllers.lua @@ -75,7 +75,7 @@ local auto_formspec = "size[8,6.2]" .. default.gui_bg .. default.gui_bg_img .. default.gui_slots .. - "container[2.5,0]" .. + "container[2.0,0]" .. "field[0.0,0.8;1,0.1;cycles;Cycles;${cycles}]" .. "tooltip[cycles;When triggered, this controller will try to run for the given number of cycles.\nThe cycle count will decrement as it runs, so if it gets halted by a problem\nyou can fix the problem and restart.]" .. "button_exit[0.7,0.5;1,0.1;set;Set]" .. @@ -97,7 +97,12 @@ local auto_formspec = "size[8,6.2]" .. "listring[current_player;main]" .. "listring[current_name;stop]" - +if minetest.get_modpath("doc") then + auto_formspec = auto_formspec .. + "button_exit[7.0,0.5;1,0.1;help;Help]" .. + "tooltip[help;Show documentation about this block]" +end + -- Needed to make this global so that it could recurse into minetest.after digtron.auto_cycle = function(pos) local node = minetest.get_node(pos) @@ -263,7 +268,11 @@ minetest.register_node("digtron:auto_controller", { markerpos[controlling_coordinate] = x_pos + slope minetest.add_entity(markerpos, "digtron:marker_vertical") end - end + end + + if fields.help and minetest.get_modpath("doc") then --check for mod in case someone disabled it after this digger was built + doc.show_entry(sender:get_player_name(), "nodes", "digtron:auto_controller") + end end, on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) |