From: Maciej Kasatkin Date: Sun, 21 Oct 2012 17:29:56 +0000 (+0200) Subject: Added constructors, added dye grinding recipes X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=67425aa3b408c91f993f2253b03859be2df6195a;p=zefram%2Fminetest%2Ftechnic.git Added constructors, added dye grinding recipes --- diff --git a/constructor.lua b/constructor.lua new file mode 100644 index 0000000..1e58408 --- /dev/null +++ b/constructor.lua @@ -0,0 +1,297 @@ + +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk1_off 1', + recipe = {'technic:nodebreaker_off', 'technic:deployer_off'}, + +}) +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk2_off 1', + recipe = {'technic:constructor_mk1_off', 'technic:constructor_mk1_off'}, + +}) + +minetest.register_craft({ + type = "shapeless", + output = 'technic:constructor_mk3_off 1', + recipe = {'technic:constructor_mk2_off', 'technic:constructor_mk2_off'}, + +}) + +minetest.register_node("technic:constructor_mk1_off", { + description = "Constructor MK1", + tile_images = {"technic_constructor_mk1_top_off.png","technic_constructor_mk1_bottom_off.png","technic_constructor_mk1_side2_off.png","technic_constructor_mk1_side1_off.png", + "technic_constructor_back.png","technic_constructor_front_off.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[8,9;]".. + "label[0,0;Constructor MK1]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK1") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + return inv:is_empty("slot1") + end, +}) + +minetest.register_node("technic:constructor_mk1_on", { + description = "Constructor MK1", + tile_images = {"technic_constructor_mk1_top_on.png","technic_constructor_mk1_bottom_on.png","technic_constructor_mk1_side2_on.png","technic_constructor_mk1_side1_on.png", + "technic_constructor_back.png","technic_constructor_front_on.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + local pos1={} + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + if node.param2==3 then pos1.x=pos1.x+1 end + if node.param2==2 then pos1.z=pos1.z+1 end + if node.param2==1 then pos1.x=pos1.x-1 end + if node.param2==0 then pos1.z=pos1.z-1 end + + if node.name == "technic:constructor_mk1_off" then + hacky_swap_node(pos,"technic:constructor_mk1_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + end + +end) + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk1_on" then + hacky_swap_node(pos,"technic:constructor_mk1_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk1_on", "technic:constructor_mk1_off") + +minetest.register_node("technic:constructor_mk2_off", { + description = "Constructor MK2", + tile_images = {"technic_constructor_mk2_top_off.png","technic_constructor_mk2_bottom_off.png","technic_constructor_mk2_side2_off.png","technic_constructor_mk2_side1_off.png", + "technic_constructor_back.png","technic_constructor_front_off.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[8,9;]".. + "label[0,0;Constructor MK2]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "label[5,1;Slot 2]".. + "list[current_name;slot2;6,1;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK2") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + inv:set_size("slot2", 1) + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false then return false end + return true + end, +}) + +minetest.register_node("technic:constructor_mk2_on", { + description = "Constructor MK2", + tile_images = {"technic_constructor_mk2_top_on.png","technic_constructor_mk2_bottom_on.png","technic_constructor_mk2_side2_on.png","technic_constructor_mk2_side1_on.png", + "technic_constructor_back.png","technic_constructor_front_on.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + local pos1={} + local pos2={} + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + pos2.x=pos.x + pos2.y=pos.y + pos2.z=pos.z + if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 end + if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 end + if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 end + if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 end + + if node.name == "technic:constructor_mk2_off" then + hacky_swap_node(pos,"technic:constructor_mk2_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + local node1=minetest.env:get_node(pos2) + deploy_node (inv,"slot2",pos2,node1,node) + end + +end) + + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk2_on" then + hacky_swap_node(pos,"technic:constructor_mk2_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk2_on", "technic:constructor_mk2_off") + +minetest.register_node("technic:constructor_mk3_off", { + description = "Constructor MK3", + tile_images = {"technic_constructor_mk3_top_off.png","technic_constructor_mk3_bottom_off.png","technic_constructor_mk3_side2_off.png","technic_constructor_mk3_side1_off.png", + "technic_constructor_back.png","technic_constructor_front_off.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2}, + sounds = default.node_sound_stone_defaults(), + on_construct = function(pos) + local meta = minetest.env:get_meta(pos) + meta:set_string("formspec", + "invsize[8,9;]".. + "label[0,0;Constructor MK2]".. + "label[5,0;Slot 1]".. + "list[current_name;slot1;6,0;1,1;]".. + "label[5,1;Slot 2]".. + "list[current_name;slot2;6,1;1,1;]".. + "label[5,2;Slot 3]".. + "list[current_name;slot3;6,2;1,1;]".. + "label[5,3;Slot 4]".. + "list[current_name;slot4;6,3;1,1;]".. + "list[current_player;main;0,5;8,4;]") + meta:set_string("infotext", "Constructor MK3") + local inv = meta:get_inventory() + inv:set_size("slot1", 1) + inv:set_size("slot2", 1) + inv:set_size("slot3", 1) + inv:set_size("slot4", 1) + + end, + + can_dig = function(pos,player) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + if inv:is_empty("slot1")==false or inv:is_empty("slot2")==false or inv:is_empty("slot3")==false or inv:is_empty("slot4")==false then return false end + return true + end, +}) + +minetest.register_node("technic:constructor_mk3_on", { + description = "Constructor MK3", + tile_images = {"technic_constructor_mk3_top_on.png","technic_constructor_mk3_bottom_on.png","technic_constructor_mk3_side2_on.png","technic_constructor_mk3_side1_on.png", + "technic_constructor_back.png","technic_constructor_front_on.png"}, + is_ground_content = true, + paramtype2 = "facedir", + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,not_in_creative_inventory=1}, + sounds = default.node_sound_stone_defaults(), +}) + +mesecon:register_on_signal_on(function(pos, node) + local meta = minetest.env:get_meta(pos) + local inv = meta:get_inventory() + + local pos1={} + local pos2={} + local pos3={} + local pos4={} + + pos1.x=pos.x + pos1.y=pos.y + pos1.z=pos.z + + pos2.x=pos.x + pos2.y=pos.y + pos2.z=pos.z + + pos3.x=pos.x + pos3.y=pos.y + pos3.z=pos.z + + pos4.x=pos.x + pos4.y=pos.y + pos4.z=pos.z + + if node.param2==3 then pos1.x=pos1.x+1 pos2.x=pos2.x+2 pos3.x=pos3.x+3 pos4.x=pos4.x+4 end + if node.param2==2 then pos1.z=pos1.z+1 pos2.z=pos2.z+2 pos3.z=pos3.z+3 pos4.z=pos4.z+4 end + if node.param2==1 then pos1.x=pos1.x-1 pos2.x=pos2.x-2 pos3.x=pos3.x-3 pos4.x=pos4.x-4 end + if node.param2==0 then pos1.z=pos1.z-1 pos2.z=pos2.z-2 pos3.z=pos3.z-3 pos4.z=pos4.z-4 end + + if node.name == "technic:constructor_mk3_off" then + hacky_swap_node(pos,"technic:constructor_mk3_on") + nodeupdate(pos) + local node1=minetest.env:get_node(pos1) + deploy_node (inv,"slot1",pos1,node1,node) + local node1=minetest.env:get_node(pos2) + deploy_node (inv,"slot2",pos2,node1,node) + local node1=minetest.env:get_node(pos3) + deploy_node (inv,"slot3",pos3,node1,node) + local node1=minetest.env:get_node(pos4) + deploy_node (inv,"slot4",pos4,node1,node) + end + +end) + + +mesecon:register_on_signal_off(function(pos, node) + if node.name == "technic:constructor_mk3_on" then + hacky_swap_node(pos,"technic:constructor_mk3_off") + nodeupdate(pos) + end +end) + +mesecon:register_effector("technic:constructor_mk3_on", "technic:constructor_mk3_off") + + +deploy_node =function (inv, slot_name, pos1, node1, node) +if node1.name == "air" then + if not inv:is_empty(slot_name) then + stack1=inv:get_list(slot_name) + node_to_be_placed={name=stack1[1]:get_name(), param1=0, param2=node.param2} + minetest.env:set_node(pos1,node_to_be_placed) + stack1[1]:take_item() + inv:set_stack(slot_name, 1, stack1[1]) + return + end + return + end + if node1.name == "ignore" or + node1.name == "default:lava_source" or + node1.name == "default:lava_flowing" or + node1.name == "default:water_source" or + node1.name == "default:water_flowing" + then return end + if inv:room_for_item(slot_name,node1) then + inv:add_item(slot_name,node1) + minetest.env:remove_node(pos1) + end + +end \ No newline at end of file diff --git a/grinder.lua b/grinder.lua index a27dece..d60dbbb 100644 --- a/grinder.lua +++ b/grinder.lua @@ -289,6 +289,7 @@ minetest.register_abm({ grind_time=4 meta:set_float("grind_time",grind_time) meta:set_float("src_time", 0) + return end end diff --git a/init.lua b/init.lua index c72509e..19b1843 100644 --- a/init.lua +++ b/init.lua @@ -42,6 +42,7 @@ dofile(minetest.get_modpath("technic").."/screwdriver.lua") dofile(minetest.get_modpath("technic").."/sonic_screwdriver.lua") dofile(minetest.get_modpath("technic").."/node_breaker.lua") dofile(minetest.get_modpath("technic").."/deployer.lua") +dofile(minetest.get_modpath("technic").."/constructor.lua") dofile(minetest.get_modpath("technic").."/tree_tap.lua") dofile(minetest.get_modpath("technic").."/flashlight.lua") dofile(minetest.get_modpath("technic").."/cans.lua") diff --git a/node_breaker.lua b/node_breaker.lua index 3a7f53b..a160737 100644 --- a/node_breaker.lua +++ b/node_breaker.lua @@ -1,7 +1,7 @@ minetest.register_craft({ output = 'technic:nodebreaker_off 1', recipe = { - {'default:wood', 'default:pick_mese','default:wood'}, + {'default:wood', 'default:mese_pick','default:wood'}, {'default:stone', 'mesecons:piston','default:stone'}, {'default:stone', 'mesecons:mesecon','default:stone'}, diff --git a/textures/technic_constructor_back.png b/textures/technic_constructor_back.png new file mode 100644 index 0000000..6baf788 Binary files /dev/null and b/textures/technic_constructor_back.png differ diff --git a/textures/technic_constructor_front_off.png b/textures/technic_constructor_front_off.png new file mode 100644 index 0000000..f878e55 Binary files /dev/null and b/textures/technic_constructor_front_off.png differ diff --git a/textures/technic_constructor_front_on.png b/textures/technic_constructor_front_on.png new file mode 100644 index 0000000..89189d6 Binary files /dev/null and b/textures/technic_constructor_front_on.png differ diff --git a/textures/technic_constructor_mk1_bottom_off.png b/textures/technic_constructor_mk1_bottom_off.png new file mode 100644 index 0000000..205dcc4 Binary files /dev/null and b/textures/technic_constructor_mk1_bottom_off.png differ diff --git a/textures/technic_constructor_mk1_bottom_on.png b/textures/technic_constructor_mk1_bottom_on.png new file mode 100644 index 0000000..9896c52 Binary files /dev/null and b/textures/technic_constructor_mk1_bottom_on.png differ diff --git a/textures/technic_constructor_mk1_side1_off.png b/textures/technic_constructor_mk1_side1_off.png new file mode 100644 index 0000000..e8a01ff Binary files /dev/null and b/textures/technic_constructor_mk1_side1_off.png differ diff --git a/textures/technic_constructor_mk1_side1_on.png b/textures/technic_constructor_mk1_side1_on.png new file mode 100644 index 0000000..c897942 Binary files /dev/null and b/textures/technic_constructor_mk1_side1_on.png differ diff --git a/textures/technic_constructor_mk1_side2_off.png b/textures/technic_constructor_mk1_side2_off.png new file mode 100644 index 0000000..8da65f6 Binary files /dev/null and b/textures/technic_constructor_mk1_side2_off.png differ diff --git a/textures/technic_constructor_mk1_side2_on.png b/textures/technic_constructor_mk1_side2_on.png new file mode 100644 index 0000000..da8ed34 Binary files /dev/null and b/textures/technic_constructor_mk1_side2_on.png differ diff --git a/textures/technic_constructor_mk1_top_off.png b/textures/technic_constructor_mk1_top_off.png new file mode 100644 index 0000000..7d8c7e0 Binary files /dev/null and b/textures/technic_constructor_mk1_top_off.png differ diff --git a/textures/technic_constructor_mk1_top_on.png b/textures/technic_constructor_mk1_top_on.png new file mode 100644 index 0000000..439caf5 Binary files /dev/null and b/textures/technic_constructor_mk1_top_on.png differ diff --git a/textures/technic_constructor_mk2_bottom_off.png b/textures/technic_constructor_mk2_bottom_off.png new file mode 100644 index 0000000..83c5b07 Binary files /dev/null and b/textures/technic_constructor_mk2_bottom_off.png differ diff --git a/textures/technic_constructor_mk2_bottom_on.png b/textures/technic_constructor_mk2_bottom_on.png new file mode 100644 index 0000000..9ad76f4 Binary files /dev/null and b/textures/technic_constructor_mk2_bottom_on.png differ diff --git a/textures/technic_constructor_mk2_side1_off.png b/textures/technic_constructor_mk2_side1_off.png new file mode 100644 index 0000000..584dfe3 Binary files /dev/null and b/textures/technic_constructor_mk2_side1_off.png differ diff --git a/textures/technic_constructor_mk2_side1_on.png b/textures/technic_constructor_mk2_side1_on.png new file mode 100644 index 0000000..fe02042 Binary files /dev/null and b/textures/technic_constructor_mk2_side1_on.png differ diff --git a/textures/technic_constructor_mk2_side2_off.png b/textures/technic_constructor_mk2_side2_off.png new file mode 100644 index 0000000..fd9ad74 Binary files /dev/null and b/textures/technic_constructor_mk2_side2_off.png differ diff --git a/textures/technic_constructor_mk2_side2_on.png b/textures/technic_constructor_mk2_side2_on.png new file mode 100644 index 0000000..f51411a Binary files /dev/null and b/textures/technic_constructor_mk2_side2_on.png differ diff --git a/textures/technic_constructor_mk2_top_off.png b/textures/technic_constructor_mk2_top_off.png new file mode 100644 index 0000000..e3e3292 Binary files /dev/null and b/textures/technic_constructor_mk2_top_off.png differ diff --git a/textures/technic_constructor_mk2_top_on.png b/textures/technic_constructor_mk2_top_on.png new file mode 100644 index 0000000..83043d4 Binary files /dev/null and b/textures/technic_constructor_mk2_top_on.png differ diff --git a/textures/technic_constructor_mk3_bottom_off.png b/textures/technic_constructor_mk3_bottom_off.png new file mode 100644 index 0000000..5f46154 Binary files /dev/null and b/textures/technic_constructor_mk3_bottom_off.png differ diff --git a/textures/technic_constructor_mk3_bottom_on.png b/textures/technic_constructor_mk3_bottom_on.png new file mode 100644 index 0000000..f76f29b Binary files /dev/null and b/textures/technic_constructor_mk3_bottom_on.png differ diff --git a/textures/technic_constructor_mk3_side1_off.png b/textures/technic_constructor_mk3_side1_off.png new file mode 100644 index 0000000..0ea1fc0 Binary files /dev/null and b/textures/technic_constructor_mk3_side1_off.png differ diff --git a/textures/technic_constructor_mk3_side1_on.png b/textures/technic_constructor_mk3_side1_on.png new file mode 100644 index 0000000..ba86332 Binary files /dev/null and b/textures/technic_constructor_mk3_side1_on.png differ diff --git a/textures/technic_constructor_mk3_side2_off.png b/textures/technic_constructor_mk3_side2_off.png new file mode 100644 index 0000000..8e8dce4 Binary files /dev/null and b/textures/technic_constructor_mk3_side2_off.png differ diff --git a/textures/technic_constructor_mk3_side2_on.png b/textures/technic_constructor_mk3_side2_on.png new file mode 100644 index 0000000..12dff69 Binary files /dev/null and b/textures/technic_constructor_mk3_side2_on.png differ diff --git a/textures/technic_constructor_mk3_top_off.png b/textures/technic_constructor_mk3_top_off.png new file mode 100644 index 0000000..705f255 Binary files /dev/null and b/textures/technic_constructor_mk3_top_off.png differ diff --git a/textures/technic_constructor_mk3_top_on.png b/textures/technic_constructor_mk3_top_on.png new file mode 100644 index 0000000..cef077e Binary files /dev/null and b/textures/technic_constructor_mk3_top_on.png differ