diff options
Diffstat (limited to 'nodes')
-rw-r--r-- | nodes/node_builders.lua | 1 | ||||
-rw-r--r-- | nodes/node_controllers.lua | 2 | ||||
-rw-r--r-- | nodes/node_crate.lua | 1 | ||||
-rw-r--r-- | nodes/node_diggers.lua | 17 | ||||
-rw-r--r-- | nodes/node_storage.lua | 96 |
5 files changed, 65 insertions, 52 deletions
diff --git a/nodes/node_builders.lua b/nodes/node_builders.lua index fa8bb0a..fac1d4b 100644 --- a/nodes/node_builders.lua +++ b/nodes/node_builders.lua @@ -45,6 +45,7 @@ minetest.register_node("digtron:builder", { description = S("Digtron Builder Module"), _doc_items_longdesc = digtron.doc.builder_longdesc, _doc_items_usagehelp = digtron.doc.builder_usagehelp, + _digtron_formspec = builder_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 4}, drop = "digtron:builder", sounds = digtron.metal_sounds, diff --git a/nodes/node_controllers.lua b/nodes/node_controllers.lua index 76bb40b..a7eda2e 100644 --- a/nodes/node_controllers.lua +++ b/nodes/node_controllers.lua @@ -172,6 +172,7 @@ minetest.register_node("digtron:auto_controller", { description = S("Digtron Automatic Control Module"), _doc_items_longdesc = digtron.doc.auto_controller_longdesc, _doc_items_usagehelp = digtron.doc.auto_controller_usagehelp, + _digtron_formspec = auto_formspec, groups = {cracky = 3, oddly_breakable_by_hand = 3, digtron = 1}, drop = "digtron:auto_controller", sounds = digtron.metal_sounds, @@ -289,7 +290,6 @@ minetest.register_node("digtron:auto_controller", { on_timer = function(pos, elapsed) minetest.get_meta(pos):set_string("waiting", nil) end, - }) --------------------------------------------------------------------------------------------------------------- diff --git a/nodes/node_crate.lua b/nodes/node_crate.lua index 017023d..7e30207 100644 --- a/nodes/node_crate.lua +++ b/nodes/node_crate.lua @@ -80,6 +80,7 @@ minetest.register_node("digtron:loaded_crate", { description = S("Digtron Crate (Loaded)"), _doc_items_longdesc = digtron.doc.loaded_crate_longdesc, _doc_items_usagehelp = digtron.doc.loaded_crate_usagehelp, + _digtron_formspec = loaded_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, not_in_creative_inventory=1, digtron_protected=1}, stack_max = 1, sounds = default.node_sound_wood_defaults(), diff --git a/nodes/node_diggers.lua b/nodes/node_diggers.lua index c12b46c..78d5200 100644 --- a/nodes/node_diggers.lua +++ b/nodes/node_diggers.lua @@ -36,17 +36,17 @@ local intermittent_formspec = "button_exit[2.2,0.5;1,0.1;set;" .. S("Save") .. "]" .. "tooltip[set;" .. S("Saves settings") .. "]" -local intermittent_on_construct = function(pos) - local formspec = intermittent_formspec - if minetest.get_modpath("doc") then - formspec = "size[4.5,1]" .. formspec .. +if minetest.get_modpath("doc") then + intermittent_formspec = "size[4.5,1]" .. intermittent_formspec .. "button_exit[3.2,0.5;1,0.1;help;" .. S("Help") .. "]" .. "tooltip[help;" .. S("Show documentation about this block") .. "]" else - formspec = "size[3.5,1]" .. formspec + intermittent_formspec = "size[3.5,1]" .. intermittent_formspec end + +local intermittent_on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", formspec) + meta:set_string("formspec", intermittent_formspec) meta:set_int("period", 1) meta:set_int("offset", 0) end @@ -72,6 +72,7 @@ minetest.register_node("digtron:digger", { description = S("Digtron Digger Head"), _doc_items_longdesc = digtron.doc.digger_longdesc, _doc_items_usagehelp = digtron.doc.digger_usagehelp, + _digtron_formspec = intermittent_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3}, drop = "digtron:digger", sounds = digtron.metal_sounds, @@ -125,6 +126,7 @@ minetest.register_node("digtron:intermittent_digger", { description = S("Digtron Intermittent Digger Head"), _doc_items_longdesc = digtron.doc.intermittent_digger_longdesc, _doc_items_usagehelp = digtron.doc.intermittent_digger_usagehelp, + _digtron_formspec = intermittent_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3}, drop = "digtron:intermittent_digger", sounds = digtron.metal_sounds, @@ -250,6 +252,7 @@ minetest.register_node("digtron:intermittent_soft_digger", { description = S("Digtron Intermittent Soft Material Digger Head"), _doc_items_longdesc = digtron.doc.intermittent_soft_digger_longdesc, _doc_items_usagehelp = digtron.doc.intermittent_soft_digger_usagehelp, + _digtron_formspec = intermittent_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 3}, drop = "digtron:intermittent_soft_digger", sounds = digtron.metal_sounds, @@ -283,7 +286,7 @@ minetest.register_node("digtron:intermittent_soft_digger", { on_construct = intermittent_on_construct, on_receive_fields = intermittent_on_receive_fields, - + execute_dig = function(pos, protected_nodes, nodes_dug, controlling_coordinate, lateral_dig) if lateral_dig == true then return 0, {} diff --git a/nodes/node_storage.lua b/nodes/node_storage.lua index 826aa20..56d19aa 100644 --- a/nodes/node_storage.lua +++ b/nodes/node_storage.lua @@ -2,12 +2,27 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") + +local inventory_formspec = + "size[8,9.3]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "label[0,0;" .. S("Inventory items") .. "]" .. + "list[current_name;main;0,0.6;8,4;]" .. + "list[current_player;main;0,5.15;8,1;]" .. + "list[current_player;main;0,6.38;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,5.15) + -- Storage buffer. Builder nodes draw from this inventory and digger nodes deposit into it. -- Note that inventories are digtron group 2. minetest.register_node("digtron:inventory", { description = S("Digtron Inventory Storage"), _doc_items_longdesc = digtron.doc.inventory_longdesc, _doc_items_usagehelp = digtron.doc.inventory_usagehelp, + _digtron_formspec = inventory_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 2, tubedevice = 1, tubedevice_receiver = 1}, drop = "digtron:inventory", sounds = digtron.metal_sounds, @@ -26,19 +41,7 @@ minetest.register_node("digtron:inventory", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9.3]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. - "label[0,0;" .. S("Inventory items") .. "]" .. - "list[current_name;main;0,0.6;8,4;]" .. - "list[current_player;main;0,5.15;8,1;]" .. - "list[current_player;main;0,6.38;8,3;8]" .. - "listring[current_name;main]" .. - "listring[current_player;main]" .. - default.get_hotbar_bg(0,5.15) - ) + meta:set_string("formspec", inventory_formspec) local inv = meta:get_inventory() inv:set_size("main", 8*4) end, @@ -48,7 +51,7 @@ minetest.register_node("digtron:inventory", { local inv = meta:get_inventory() return inv:is_empty("main") end, - + -- Pipeworks compatibility ---------------------------------------------------------------- @@ -71,12 +74,26 @@ minetest.register_node("digtron:inventory", { after_dig_node = (function() if minetest.get_modpath("pipeworks") then return pipeworks.after_dig end end)() }) +local fuelstore_formspec = + "size[8,9.3]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "label[0,0;" .. S("Fuel items") .. "]" .. + "list[current_name;fuel;0,0.6;8,4;]" .. + "list[current_player;main;0,5.15;8,1;]" .. + "list[current_player;main;0,6.38;8,3;8]" .. + "listring[current_name;fuel]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,5.15) + -- Fuel storage. Controller node draws fuel from here. -- Note that fuel stores are digtron group 5. minetest.register_node("digtron:fuelstore", { description = S("Digtron Fuel Storage"), _doc_items_longdesc = digtron.doc.fuelstore_longdesc, _doc_items_usagehelp = digtron.doc.fuelstore_usagehelp, + _digtron_formspec = fuelstore_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 5, tubedevice = 1, tubedevice_receiver = 1}, drop = "digtron:fuelstore", sounds = digtron.metal_sounds, @@ -95,19 +112,7 @@ minetest.register_node("digtron:fuelstore", { on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9.3]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. - "label[0,0;" .. S("Fuel items") .. "]" .. - "list[current_name;fuel;0,0.6;8,4;]" .. - "list[current_player;main;0,5.15;8,1;]" .. - "list[current_player;main;0,6.38;8,3;8]" .. - "listring[current_name;fuel]" .. - "listring[current_player;main]" .. - default.get_hotbar_bg(0,5.15) - ) + meta:set_string("formspec", fuelstore_formspec) local inv = meta:get_inventory() inv:set_size("fuel", 8*4) end, @@ -129,7 +134,7 @@ minetest.register_node("digtron:fuelstore", { local inv = meta:get_inventory() return inv:is_empty("fuel") end, - + -- Pipeworks compatibility ---------------------------------------------------------------- @@ -158,11 +163,28 @@ minetest.register_node("digtron:fuelstore", { after_dig_node = (function() if minetest.get_modpath("pipeworks")then return pipeworks.after_dig end end)() }) +local combined_storage_formspec = + "size[8,9.9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "label[0,0;" .. S("Inventory items") .. "]" .. + "list[current_name;main;0,0.6;8,3;]" .. + "label[0,3.5;" .. S("Fuel items") .. "]" .. + "list[current_name;fuel;0,4.1;8,1;]" .. + "list[current_player;main;0,5.75;8,1;]" .. + "list[current_player;main;0,6.98;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,5.75) + + -- Combined storage. Group 6 has both an inventory and a fuel store minetest.register_node("digtron:combined_storage", { description = S("Digtron Combined Storage"), _doc_items_longdesc = digtron.doc.combined_storage_longdesc, _doc_items_usagehelp = digtron.doc.combined_storage_usagehelp, + _digtron_formspec = combined_storage_formspec, groups = {cracky = 3, oddly_breakable_by_hand=3, digtron = 6, tubedevice = 1, tubedevice_receiver = 1}, drop = "digtron:combined_storage", sounds = digtron.metal_sounds, @@ -179,21 +201,7 @@ minetest.register_node("digtron:combined_storage", { }, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", - "size[8,9.9]" .. - default.gui_bg .. - default.gui_bg_img .. - default.gui_slots .. - "label[0,0;" .. S("Inventory items") .. "]" .. - "list[current_name;main;0,0.6;8,3;]" .. - "label[0,3.5;" .. S("Fuel items") .. "]" .. - "list[current_name;fuel;0,4.1;8,1;]" .. - "list[current_player;main;0,5.75;8,1;]" .. - "list[current_player;main;0,6.98;8,3;8]" .. - "listring[current_name;main]" .. - "listring[current_player;main]" .. - default.get_hotbar_bg(0,5.75) - ) + meta:set_string("formspec", combined_storage_formspec) local inv = meta:get_inventory() inv:set_size("main", 8*3) inv:set_size("fuel", 8*1) @@ -230,7 +238,7 @@ minetest.register_node("digtron:combined_storage", { local inv = meta:get_inventory() return inv:is_empty("fuel") and inv:is_empty("main") end, - + -- Pipeworks compatibility ---------------------------------------------------------------- tube = (function() if minetest.get_modpath("pipeworks") then return { |