| | |
| | | |
| | | local S = technic.getter |
| | | |
| | | minetest.register_craft({ |
| | | type = "shapeless", |
| | | output = 'technic:constructor_mk1_off 1', |
| | |
| | | |
| | | }) |
| | | |
| | | mk1_on = function(pos, node) |
| | | local function mk1_on(pos, node) |
| | | local meta = minetest.get_meta(pos) |
| | | local inv = meta:get_inventory() |
| | | local pos1={} |
| | |
| | | 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") |
| | | technic.swap_node(pos,"technic:constructor_mk1_on") |
| | | nodeupdate(pos) |
| | | local node1=minetest.get_node(pos1) |
| | | deploy_node (inv,"slot1",pos1,node1,node) |
| | | end |
| | | end |
| | | |
| | | mk1_off = function(pos, node) |
| | | local function mk1_off(pos, node) |
| | | if node.name == "technic:constructor_mk1_on" then |
| | | hacky_swap_node(pos,"technic:constructor_mk1_off") |
| | | technic.swap_node(pos,"technic:constructor_mk1_off") |
| | | nodeupdate(pos) |
| | | end |
| | | end |
| | | |
| | | |
| | | minetest.register_node("technic:constructor_mk1_off", { |
| | | description = "Constructor MK1", |
| | | description = S("Constructor Mk%d"):format(1), |
| | | 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, |
| | |
| | | local meta = minetest.get_meta(pos) |
| | | meta:set_string("formspec", |
| | | "invsize[8,9;]".. |
| | | "label[0,0;Constructor MK1]".. |
| | | "label[0,0;"..S("Constructor Mk%d"):format(1).."]".. |
| | | "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") |
| | | meta:set_string("infotext", S("Constructor Mk%d"):format(1)) |
| | | local inv = meta:get_inventory() |
| | | inv:set_size("slot1", 1) |
| | | end, |
| | |
| | | }) |
| | | |
| | | minetest.register_node("technic:constructor_mk1_on", { |
| | | description = "Constructor MK1", |
| | | description = S("Constructor Mk%d"):format(3), |
| | | 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"}, |
| | | paramtype2 = "facedir", |
| | |
| | | }) |
| | | |
| | | |
| | | --Constructor MK2 |
| | | --Constructor Mk2 |
| | | |
| | | mk2_on = function(pos, node) |
| | | local function mk2_on(pos, node) |
| | | local meta = minetest.get_meta(pos) |
| | | local inv = meta:get_inventory() |
| | | local pos1={} |
| | |
| | | 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") |
| | | technic.swap_node(pos,"technic:constructor_mk2_on") |
| | | nodeupdate(pos) |
| | | local node1=minetest.get_node(pos1) |
| | | deploy_node (inv,"slot1",pos1,node1,node) |
| | |
| | | end |
| | | end |
| | | |
| | | mk2_off = function(pos, node) |
| | | local function mk2_off(pos, node) |
| | | if node.name == "technic:constructor_mk2_on" then |
| | | hacky_swap_node(pos,"technic:constructor_mk2_off") |
| | | technic.swap_node(pos,"technic:constructor_mk2_off") |
| | | nodeupdate(pos) |
| | | end |
| | | end |
| | | |
| | | minetest.register_node("technic:constructor_mk2_off", { |
| | | description = "Constructor MK2", |
| | | description = S("Constructor Mk%d"):format(2), |
| | | 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, |
| | |
| | | local meta = minetest.get_meta(pos) |
| | | meta:set_string("formspec", |
| | | "invsize[8,9;]".. |
| | | "label[0,0;Constructor MK2]".. |
| | | "label[0,0;"..S("Constructor Mk%d"):format(2).."]".. |
| | | "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", S("Constructor Mk%d"):format(2)) |
| | | local inv = meta:get_inventory() |
| | | inv:set_size("slot1", 1) |
| | | inv:set_size("slot2", 1) |
| | |
| | | }) |
| | | |
| | | minetest.register_node("technic:constructor_mk2_on", { |
| | | description = "Constructor MK2", |
| | | description = S("Constructor Mk%d"):format(2), |
| | | 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, |
| | |
| | | }) |
| | | |
| | | |
| | | -- Constructor MK3 |
| | | mk3_on = function(pos, node) |
| | | -- Constructor Mk3 |
| | | local function mk3_on(pos, node) |
| | | local meta = minetest.get_meta(pos) |
| | | local inv = meta:get_inventory() |
| | | |
| | |
| | | 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") |
| | | technic.swap_node(pos,"technic:constructor_mk3_on") |
| | | nodeupdate(pos) |
| | | local node1=minetest.get_node(pos1) |
| | | deploy_node (inv,"slot1",pos1,node1,node) |
| | |
| | | end |
| | | end |
| | | |
| | | mk3_off = function(pos, node) |
| | | local function mk3_off(pos, node) |
| | | if node.name == "technic:constructor_mk3_on" then |
| | | hacky_swap_node(pos,"technic:constructor_mk3_off") |
| | | technic.swap_node(pos,"technic:constructor_mk3_off") |
| | | nodeupdate(pos) |
| | | end |
| | | end |
| | | |
| | | minetest.register_node("technic:constructor_mk3_off", { |
| | | description = "Constructor MK3", |
| | | description = S("Constructor Mk%d"):format(3), |
| | | 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"}, |
| | | paramtype2 = "facedir", |
| | |
| | | local meta = minetest.get_meta(pos) |
| | | meta:set_string("formspec", |
| | | "invsize[8,9;]".. |
| | | "label[0,0;Constructor MK2]".. |
| | | "label[0,0;"..S("Constructor Mk%d"):format(3).."]".. |
| | | "label[5,0;Slot 1]".. |
| | | "list[current_name;slot1;6,0;1,1;]".. |
| | | "label[5,1;Slot 2]".. |
| | |
| | | "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", S("Constructor Mk%d"):format(3)) |
| | | local inv = meta:get_inventory() |
| | | inv:set_size("slot1", 1) |
| | | inv:set_size("slot2", 1) |
| | |
| | | }) |
| | | |
| | | minetest.register_node("technic:constructor_mk3_on", { |
| | | description = "Constructor MK3", |
| | | description = S("Constructor Mk%d"):format(3), |
| | | 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, |
| | |
| | | }) |
| | | |
| | | |
| | | deploy_node =function (inv, slot_name, pos1, node1, node) |
| | | local function deploy_node(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) |