From 876218ea81688f9e37e108084971be89c3610818 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 27 Jan 2013 10:15:39 +0100 Subject: [PATCH] Bunch of fixes --- technic/technic/concrete.lua | 2 +- technic/technic/constructor.lua | 183 ++++++++++++++------------- technic/technic/copper_chest.lua | 26 +++- technic/technic/depends.txt | 1 - technic/technic/electric_furnace.lua | 1 - technic/technic/gold_chest.lua | 50 +++++++- technic/technic/init.lua | 19 +-- technic/technic/iron_chest.lua | 26 +++- technic/technic/node_breaker.lua | 43 +++---- technic/technic/ores.lua | 10 +- technic/technic/silver_chest.lua | 27 +++- 11 files changed, 238 insertions(+), 150 deletions(-) diff --git a/technic/technic/concrete.lua b/technic/technic/concrete.lua index 6d031d9..2d68ca1 100644 --- a/technic/technic/concrete.lua +++ b/technic/technic/concrete.lua @@ -73,7 +73,7 @@ minetest.register_node("technic:concrete_post", { sounds = default.node_sound_stone_defaults(), }) -stairsplus.register_stair_and_slab_and_panel_and_micro("concrete", "technic:concrete", +stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "concrete", "technic:concrete", {cracky=3}, {"technic_concrete_block.png"}, "Concrete Stairs", diff --git a/technic/technic/constructor.lua b/technic/technic/constructor.lua index 1e58408..b5a61cb 100644 --- a/technic/technic/constructor.lua +++ b/technic/technic/constructor.lua @@ -19,45 +19,7 @@ minetest.register_craft({ }) -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) +mk1_on = function(pos, node) local meta = minetest.env:get_meta(pos) local inv = meta:get_inventory() local pos1={} @@ -75,61 +37,60 @@ mesecon:register_on_signal_on(function(pos, node) local node1=minetest.env:get_node(pos1) deploy_node (inv,"slot1",pos1,node1,node) end +end -end) - -mesecon:register_on_signal_off(function(pos, node) +mk1_off = function(pos, node) if node.name == "technic:constructor_mk1_on" then hacky_swap_node(pos,"technic:constructor_mk1_off") nodeupdate(pos) end -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", +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}, + mesecons= {effector={action_on=mk1_on}}, 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[0,0;Constructor MK1]".. "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") + meta:set_string("infotext", "Constructor MK1") 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 + return inv:is_empty("slot1") 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", +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}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon = 2,not_in_creative_inventory=1}, + mesecons= {effector={action_off=mk1_off}}, sounds = default.node_sound_stone_defaults(), }) -mesecon:register_on_signal_on(function(pos, node) + +--Constructor MK2 + +mk2_on = function(pos, node) local meta = minetest.env:get_meta(pos) local inv = meta:get_inventory() local pos1={} @@ -153,26 +114,23 @@ mesecon:register_on_signal_on(function(pos, node) local node1=minetest.env:get_node(pos2) deploy_node (inv,"slot2",pos2,node1,node) end +end -end) - - -mesecon:register_on_signal_off(function(pos, node) +mk2_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") +end -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", +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}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2}, + mesecons= {effector={action_on=mk2_on}}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.env:get_meta(pos) @@ -183,39 +141,35 @@ minetest.register_node("technic:constructor_mk3_off", { "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") + meta:set_string("infotext", "Constructor MK2") 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 + if inv:is_empty("slot1")==false or inv:is_empty("slot2")==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", +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}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2, not_in_creative_inventory=1}, + mesecons= {effector={action_off=mk2_off}}, sounds = default.node_sound_stone_defaults(), }) -mesecon:register_on_signal_on(function(pos, node) + +-- Constructor MK3 +mk3_on = function(pos, node) local meta = minetest.env:get_meta(pos) local inv = meta:get_inventory() @@ -257,18 +211,65 @@ mesecon:register_on_signal_on(function(pos, node) local node1=minetest.env:get_node(pos4) deploy_node (inv,"slot4",pos4,node1,node) end +end -end) - - -mesecon:register_on_signal_off(function(pos, node) +mk3_off = function(pos, node) if node.name == "technic:constructor_mk3_on" then hacky_swap_node(pos,"technic:constructor_mk3_off") nodeupdate(pos) end -end) +end -mesecon:register_effector("technic:constructor_mk3_on", "technic:constructor_mk3_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 = 2}, + mesecons= {effector={action_on=mk3_on}}, + 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 = 2,not_in_creative_inventory=1}, + mesecons= {effector={action_off=mk3_off}}, + sounds = default.node_sound_stone_defaults(), +}) deploy_node =function (inv, slot_name, pos1, node1, node) @@ -294,4 +295,4 @@ if node1.name == "air" then minetest.env:remove_node(pos1) end -end \ No newline at end of file +end diff --git a/technic/technic/copper_chest.lua b/technic/technic/copper_chest.lua index cf1ae06..5fba6a6 100644 --- a/technic/technic/copper_chest.lua +++ b/technic/technic/copper_chest.lua @@ -38,7 +38,18 @@ minetest.register_node("technic:copper_chest", { tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_front.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) @@ -89,7 +100,18 @@ minetest.register_node("technic:copper_locked_chest", { tiles = {"technic_copper_chest_top.png", "technic_copper_chest_top.png", "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_side.png", "technic_copper_chest_locked.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) diff --git a/technic/technic/depends.txt b/technic/technic/depends.txt index 8f4edab..492d75e 100644 --- a/technic/technic/depends.txt +++ b/technic/technic/depends.txt @@ -1,5 +1,4 @@ moreores -flowers pipeworks mesecons stairsplus diff --git a/technic/technic/electric_furnace.lua b/technic/technic/electric_furnace.lua index ab56bdb..1358802 100644 --- a/technic/technic/electric_furnace.lua +++ b/technic/technic/electric_furnace.lua @@ -107,7 +107,6 @@ minetest.register_abm({ local load = math.floor(internal_EU_buffer/2000 * 100) meta:set_string("formspec", "invsize[8,9;]".. - "background[-1,-1;10,11;technic_electric_furnace_GUI.png]".. "image[1,1;1,2;technic_power_meter_bg.png^[lowpart:".. (load)..":technic_power_meter_fg.png]".. "list[current_name;src;3,1;1,1;]".. diff --git a/technic/technic/gold_chest.lua b/technic/technic/gold_chest.lua index 29f1666..4fd5316 100644 --- a/technic/technic/gold_chest.lua +++ b/technic/technic/gold_chest.lua @@ -57,6 +57,17 @@ minetest.register_node("technic:gold_chest", { "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front.png"}, paramtype2 = "facedir", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) @@ -117,7 +128,18 @@ minetest.register_node("technic:gold_chest".. state, { tiles = {"technic_gold_chest_top.png", "technic_gold_chest_top.png", "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_front"..state..".png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), drop = "technic:gold_chest", @@ -189,6 +211,17 @@ minetest.register_node("technic:gold_locked_chest", { paramtype2 = "facedir", drop = "technic:gold_locked_chest", groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) @@ -287,7 +320,18 @@ minetest.register_node("technic:gold_locked_chest".. state, { "technic_gold_chest_side.png", "technic_gold_chest_side.png", "technic_gold_chest_locked"..state..".png"}, paramtype2 = "facedir", drop = "technic:gold_locked_chest", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, not_in_creative_inventory=1,tubedevice=1,tubedevice_receiver=1}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) @@ -608,4 +652,4 @@ function locked_chest_punched (pos,node,puncher) local meta = minetest.env:get_meta(pos); meta:set_string("formspec", "hack:sign_text_input") end - \ No newline at end of file + diff --git a/technic/technic/init.lua b/technic/technic/init.lua index fd359ba..1456462 100644 --- a/technic/technic/init.lua +++ b/technic/technic/init.lua @@ -1,20 +1,5 @@ -- Minetest 0.4.4 : technic -minetest.register_alias("rebar", "technic:rebar") -minetest.register_alias("concrete", "technic:concrete") -minetest.register_alias("concrete_post", "technic:concrete_post") -minetest.register_alias("iron_chest", "technic:iron_chest") -minetest.register_alias("iron_locked_chest", "technic:iron_locked_chest") -minetest.register_alias("copper_chest", "technic:copper_chest") -minetest.register_alias("copper_locked_chest", "technic:copper_locked_chest") -minetest.register_alias("silver_chest", "technic:silver_chest") -minetest.register_alias("silver_locked_chest", "technic:silver_locked_chest") -minetest.register_alias("gold_chest", "technic:gold_chest") -minetest.register_alias("gold_locked_chest", "technic:gold_locked_chest") -minetest.register_alias("mithril_chest", "technic:mithril_chest") -minetest.register_alias("mithril_locked_chest", "technic:mithril_locked_chest") - - modpath=minetest.get_modpath("technic") --Read technic config file @@ -64,9 +49,9 @@ dofile(modpath.."/screwdriver.lua") dofile(modpath.."/sonic_screwdriver.lua") -- mesecons and tubes related -dofile(modpath.."/injector.lua") +--dofile(modpath.."/injector.lua") dofile(modpath.."/node_breaker.lua") -dofile(modpath.."/deployer.lua") +--dofile(modpath.."/deployer.lua") dofile(modpath.."/constructor.lua") if enable_item_drop then dofile(modpath.."/item_drop.lua") end diff --git a/technic/technic/iron_chest.lua b/technic/technic/iron_chest.lua index 27b1aba..36105d1 100644 --- a/technic/technic/iron_chest.lua +++ b/technic/technic/iron_chest.lua @@ -41,7 +41,18 @@ minetest.register_node("technic:iron_chest", { tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_front.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) @@ -90,7 +101,18 @@ minetest.register_node("technic:iron_locked_chest", { tiles = {"technic_iron_chest_top.png", "technic_iron_chest_top.png", "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_side.png", "technic_iron_chest_locked.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) diff --git a/technic/technic/node_breaker.lua b/technic/technic/node_breaker.lua index 3a7f53b..06de700 100644 --- a/technic/technic/node_breaker.lua +++ b/technic/technic/node_breaker.lua @@ -8,13 +8,29 @@ minetest.register_craft({ } }) +node_breaker_on = function(pos, node) + if node.name == "technic:nodebreaker_off" then + hacky_swap_node(pos,"technic:nodebreaker_on") + break_node (pos,node.param2) + nodeupdate(pos) + end +end + +node_breaker_off = function(pos, node) + if node.name == "technic:nodebreaker_on" then + hacky_swap_node(pos,"technic:nodebreaker_off") + nodeupdate(pos) + end +end + minetest.register_node("technic:nodebreaker_off", { description = "Node Breaker", tile_images = {"technic_nodebreaker_top_off.png","technic_nodebreaker_bottom_off.png","technic_nodebreaker_side2_off.png","technic_nodebreaker_side1_off.png", "technic_nodebreaker_back.png","technic_nodebreaker_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,tubedevice=1}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1}, + mesecons= {effector={action_on=node_breaker_on, action_off=node_breaker_off}}, sounds = default.node_sound_stone_defaults(), on_construct = function(pos) local meta = minetest.env:get_meta(pos) @@ -26,29 +42,13 @@ minetest.register_node("technic:nodebreaker_on", { description = "Node Breaker", tile_images = {"technic_nodebreaker_top_on.png","technic_nodebreaker_bottom_on.png","technic_nodebreaker_side2_on.png","technic_nodebreaker_side1_on.png", "technic_nodebreaker_back.png","technic_nodebreaker_front_on.png"}, + mesecons= {effector={action_on=node_breaker_on, action_off=node_breaker_off}}, is_ground_content = true, paramtype2 = "facedir", - tubelike=1, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon_receptor_off = 1, mesecon_effector_off = 1, mesecon = 2,tubedevice=1,not_in_creative_inventory=1}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, mesecon = 2,tubedevice=1,not_in_creative_inventory=1}, sounds = default.node_sound_stone_defaults(), }) -mesecon:register_on_signal_on(function(pos, node) - if node.name == "technic:nodebreaker_off" then - minetest.env:add_node(pos, {name="technic:nodebreaker_on", param2 = node.param2}) - break_node (pos,node.param2) - nodeupdate(pos) - end -end) - -mesecon:register_on_signal_off(function(pos, node) - if node.name == "technic:nodebreaker_on" then - minetest.env:add_node(pos, {name="technic:nodebreaker_off", param2 = node.param2}) - nodeupdate(pos) - end -end) - -mesecon:register_effector("technic:nodebreaker_on", "technic:nodebreaker_off") function break_node (pos,n_param) local pos1={} @@ -70,9 +70,6 @@ function break_node (pos,n_param) if n_param==0 then pos2.z=pos2.z-1 pos1.x=pos1.z+1 z_velocity=1 end local node=minetest.env:get_node(pos2) - local meta = minetest.env:get_meta(pos1) - tubelike=meta:get_int("tubelike") - --if tubelike==1 then if node.name == "air" then return nil end if node.name == "default:lava_source" then return nil end if node.name == "default:lava_flowing" then return nil end @@ -86,9 +83,7 @@ function break_node (pos,n_param) item1:get_luaentity().start_pos = {x=pos.x,y=pos.y,z=pos.z} item1:setvelocity({x=x_velocity, y=0, z=z_velocity}) item1:setacceleration({x=0, y=0, z=0}) --- minetest.item_drop(dropped_item, "", pos1) end minetest.env:remove_node(pos2) - --end end diff --git a/technic/technic/ores.lua b/technic/technic/ores.lua index 2642c9e..fddfc5e 100644 --- a/technic/technic/ores.lua +++ b/technic/technic/ores.lua @@ -38,7 +38,7 @@ minetest.register_node( "technic:obsidian", { sounds = default.node_sound_stone_defaults(), }) -stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble", +stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "marble", "technic:marble", {cracky=3}, {"technic_marble.png"}, "Marble Stairs", @@ -46,7 +46,7 @@ stairsplus.register_stair_and_slab_and_panel_and_micro("marble", "technic:marble "Marble Panel", "Marble Microblock", "marble") -stairsplus.register_stair_and_slab_and_panel_and_micro("marble_bricks", "technic:marble_bricks", +stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "marble_bricks", "technic:marble_bricks", {cracky=3}, {"technic_marble_bricks.png"}, "Marble Bricks Stairs", @@ -54,7 +54,7 @@ stairsplus.register_stair_and_slab_and_panel_and_micro("marble_bricks", "technic "Marble Bricks Panel", "Marble Bricks Microblock", "marble_bricks") -stairsplus.register_stair_and_slab_and_panel_and_micro("granite", "technic:granite", +stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "granite", "technic:granite", {cracky=3}, {"technic_granite.png"}, "Granite Stairs", @@ -62,7 +62,7 @@ stairsplus.register_stair_and_slab_and_panel_and_micro("granite", "technic:grani "Granite Panel", "Granite Microblock", "granite") -stairsplus.register_stair_and_slab_and_panel_and_micro("obsidian", "technic:obsidian", +stairsplus.register_stair_and_slab_and_panel_and_micro(":stairsplus", "obsidian", "technic:obsidian", {cracky=3}, {"technic_obsidian.png"}, "Obsidian Stairs", @@ -336,4 +336,4 @@ function generate_stratus(name, wherein, ceilin, ceil, minp, maxp, seed, stratus end end --print("generate_ore done") -end \ No newline at end of file +end diff --git a/technic/technic/silver_chest.lua b/technic/technic/silver_chest.lua index 66a915a..85df64c 100644 --- a/technic/technic/silver_chest.lua +++ b/technic/technic/silver_chest.lua @@ -38,7 +38,18 @@ minetest.register_node("technic:silver_chest", { tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_front.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"}, legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), on_construct = function(pos) @@ -106,8 +117,18 @@ minetest.register_node("technic:silver_locked_chest", { tiles = {"technic_silver_chest_top.png", "technic_silver_chest_top.png", "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_side.png", "technic_silver_chest_locked.png"}, paramtype2 = "facedir", - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - legacy_facedir_simple = true, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,tubedevice=1,tubedevice_receiver=1}, + tube={insert_object=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:add_item("main",stack) + end, + can_insert=function(pos,node,stack,direction) + local meta=minetest.env:get_meta(pos) + local inv=meta:get_inventory() + return inv:room_for_item("main",stack) + end, + input_inventory="main"},legacy_facedir_simple = true, sounds = default.node_sound_wood_defaults(), after_place_node = function(pos, placer) local meta = minetest.env:get_meta(pos) -- 2.30.2