From 2695c6103383996fedfd12098cf3f28c5fc43fe2 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Fri, 30 Dec 2016 23:38:18 -0700 Subject: Initial commit Initial commit. Contains digger head, sand digger, builder, controller, pusher, structure node, light, inventory, and digtron core crafting item. --- node_misc.lua | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 node_misc.lua (limited to 'node_misc.lua') diff --git a/node_misc.lua b/node_misc.lua new file mode 100644 index 0000000..3168a46 --- /dev/null +++ b/node_misc.lua @@ -0,0 +1,79 @@ +-- A do-nothing "structural" node, to ensure all digtron nodes that are supposed to be connected to each other can be connected to each other. +minetest.register_node("digtron:structure", { + description = "Digger Structure", + groups = {cracky = 3, stone = 1, digtron = 1}, + drop = 'digtron:structure', + tiles = {"digtron_plate.png"}, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {0.3125, 0.3125, -0.5, 0.5, 0.5, 0.5}, + {0.3125, -0.5, -0.5, 0.5, -0.3125, 0.5}, + {-0.5, 0.3125, -0.5, -0.3125, 0.5, 0.5}, + {-0.5, -0.5, -0.5, -0.3125, -0.3125, 0.5}, + {-0.3125, 0.3125, 0.3125, 0.3125, 0.5, 0.5}, + {-0.3125, -0.5, 0.3125, 0.3125, -0.3125, 0.5}, + {-0.5, -0.3125, 0.3125, -0.3125, 0.3125, 0.5}, + {0.3125, -0.3125, 0.3125, 0.5, 0.3125, 0.5}, + {-0.5, -0.3125, -0.5, -0.3125, 0.3125, -0.3125}, + {0.3125, -0.3125, -0.5, 0.5, 0.3125, -0.3125}, + {-0.3125, 0.3125, -0.5, 0.3125, 0.5, -0.3125}, + {-0.3125, -0.5, -0.5, 0.3125, -0.3125, -0.3125}, + } + }, +}) + +-- A modest light source that will move with the digtron, handy for working in a tunnel you aren't bothering to install permanent lights in. +minetest.register_node("digtron:light", { + description = "Digger Light", + groups = {cracky = 3, stone = 1, digtron = 1}, + drop = 'digtron:light', + tiles = {"digtron_light.png"}, + drawtype = "nodebox", + paramtype = "light", + light_source = 10, + paramtype2 = "wallmounted", + node_box = { + type = "wallmounted", + wall_top = {-0.25, 0.3125, -0.25, 0.25, 0.5, 0.25}, + wall_bottom = {-0.25, -0.3125, -0.25, 0.25, -0.5, 0.25}, + wall_side = {-0.5, -0.25, -0.25, -0.1875, 0.25, 0.25}, + }, +}) + +-- 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 = "Digtron Inventory Hopper", + groups = {cracky = 3, stone = 1, digtron = 2}, + drop = 'digtron:inventory', + paramtype2= 'facedir', + tiles = {"digtron_inventory.png"}, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + ) + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end, + + can_dig = function(pos,player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + return inv:is_empty("main") + end, +}) \ No newline at end of file -- cgit v1.2.3