Tweak hive formspec a bit and overall code reduction

This commit is contained in:
jp 2015-08-08 10:54:17 +02:00
parent 5024ced4d1
commit 30b377c052
5 changed files with 24 additions and 34 deletions

View File

@ -3,11 +3,9 @@ local enchanting = {}
function enchanting.construct(pos) function enchanting.construct(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui.. meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui..
"label[0.85,-0.15;Enchant]".. "label[0.85,-0.15;Enchant]".."image[0.6,0.2;2,2;xdecor_enchbook.png]"..
"image[0.6,0.2;2,2;xdecor_enchbook.png]"..
"image[1.5,2;1,1;ench_mese_layout.png]"..
"list[current_name;tool;0.5,2;1,1;]".. "list[current_name;tool;0.5,2;1,1;]"..
"list[current_name;mese;1.5,2;1,1;]".. "list[current_name;mese;1.5,2;1,1;]".."image[1.5,2;1,1;mese_layout.png]"..
"image_button[2.75,0;5,1.5;ench_bg.png;durable;Durable]".. "image_button[2.75,0;5,1.5;ench_bg.png;durable;Durable]"..
"image_button[2.75,1.5;5,1.5;ench_bg.png;fast;Fast]".. "image_button[2.75,1.5;5,1.5;ench_bg.png;fast;Fast]"..
"list[current_player;main;0,3.3;8,4;]") "list[current_player;main;0,3.3;8,4;]")

View File

@ -4,11 +4,9 @@ function hive.construct(pos)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui.. meta:set_string("formspec", "size[8,5;]"..xdecor.fancy_gui..
"label[1.35,0;Bees are making honey\nwith pollen around...]".. "label[1.35,0;Bees are making honey\nwith pollen around...]"..
"image[-0.1,-0.2;1,1;flowers_tulip.png]".. "image[0.2,-0.1;1,1;flowers_dandelion_white.png]"..
"image[0.5,0.2;1,1;flowers_dandelion_yellow.png]".. "image[7,0.1;1,1;flowers_viola.png]"..
"image[6.6,0.1;1,1;flowers_geranium.png]".. "image[6,0;1,1;xdecor_bee.png]"..
"image[7.2,-0.1;1,1;flowers_rose.png]"..
"image[6,0;0.9,0.9;xdecor_bee.png]"..
"list[current_name;honey;5,0;1,1;]".. "list[current_name;honey;5,0;1,1;]"..
"list[current_player;main;0,1.35;8,4;]") "list[current_player;main;0,1.35;8,4;]")
meta:set_string("infotext", "Artificial Hive") meta:set_string("infotext", "Artificial Hive")

View File

Before

Width:  |  Height:  |  Size: 140 B

After

Width:  |  Height:  |  Size: 140 B

View File

@ -14,14 +14,14 @@ local material = {
} }
local def = { -- Node name, yield, nodebox shape. local def = { -- Node name, yield, nodebox shape.
{"nanoslab", "16", {-0.5, -0.5, -0.5, 0, -0.4375, 0}}, {"nanoslab", "16", {-.5,-.5,-.5,0,-.4375,0}},
{"micropanel", "16", {-0.5, -0.5, -0.5, 0.5, -0.4375, 0}}, {"micropanel", "16", {-.5,-.5,-.5,.5,-.4375,0}},
{"microslab", "8", {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}}, {"microslab", "8", {-.5,-.5,-.5,.5,-.4375,.5}},
{"panel", "4", {-0.5, -0.5, -0.5, 0.5, 0, 0}}, {"panel", "4", {-.5,-.5,-.5,.5,0,0}},
{"slab", "2", {-0.5, -0.5, -0.5, 0.5, 0, 0.5}}, {"slab", "2", {-.5,-.5,-.5,.5,0,.5}},
{"outerstair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0, 0.5, 0.5}}}, {"outerstair", "1", {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,0,.5,.5}}},
{"stair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0.5, 0.5, 0.5}}}, {"stair", "1", {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5}}},
{"innerstair", "1", {{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, 0, 0, 0.5, 0.5, 0.5}, {-0.5, 0, -0.5, 0, 0.5, 0}}} {"innerstair", "1", {{-.5,-.5,-.5,.5,0,.5},{-.5,0,0,.5,.5,.5},{-.5,0,-.5,0,.5,0}}}
} }
function worktable.construct(pos) function worktable.construct(pos)
@ -35,18 +35,13 @@ function worktable.construct(pos)
nodebtn = table.concat(nodebtn) nodebtn = table.concat(nodebtn)
meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui.. meta:set_string("formspec", "size[8,7;]"..xdecor.fancy_gui..
"label[0,0;Cut your material into...]".. "label[0,0;Cut your material into...]"..nodebtn..
nodebtn.. "label[0,1.5;Input]".."list[current_name;input;0,2;1,1;]"..
"label[0,1.5;Input]"..
"list[current_name;input;0,2;1,1;]"..
"image[1,2;1,1;xdecor_saw.png]".. "image[1,2;1,1;xdecor_saw.png]"..
"label[2,1.5;Output]".. "label[2,1.5;Output]".."list[current_name;output;2,2;1,1;]"..
"list[current_name;output;2,2;1,1;]".. "label[5,1.5;Tool]".."list[current_name;tool;5,2;1,1;]"..
"label[5,1.5;Tool]"..
"list[current_name;tool;5,2;1,1;]"..
"image[6,2;1,1;xdecor_anvil.png]".. "image[6,2;1,1;xdecor_anvil.png]"..
"label[6.8,1.5;Hammer]".. "label[6.8,1.5;Hammer]".."list[current_name;hammer;7,2;1,1;]"..
"list[current_name;hammer;7,2;1,1;]"..
"list[current_player;main;0,3.25;8,4;]") "list[current_player;main;0,3.25;8,4;]")
meta:set_string("infotext", "Work Table") meta:set_string("infotext", "Work Table")

View File

@ -147,13 +147,13 @@ function xwall.construct_node_box_data(node_box_list, center_node_box_list, node
for _, v in pairs(node_box_list) do for _, v in pairs(node_box_list) do
pos3 = pos3 + 1 pos3 = pos3 + 1
pos4 = pos4 + 1 pos4 = pos4 + 1
res.c3[pos3] = {v[4], v[2], v[3]-0.5, v[1], v[5], v[6]-0.5} res.c3[pos3] = {v[4], v[2], v[3]-.5, v[1], v[5], v[6]-.5}
res.c4[pos4] = {v[4], v[2], v[3]-0.5, v[1], v[5], v[6]-0.5} res.c4[pos4] = {v[4], v[2], v[3]-.5, v[1], v[5], v[6]-.5}
end end
for _, v in pairs(node_box_list) do for _, v in pairs(node_box_list) do
pos4 = pos4 + 1 pos4 = pos4 + 1
res.c4[pos4] = {v[3]-0.5, v[2], v[4], v[6]-0.5, v[5], v[1]} res.c4[pos4] = {v[3]-.5, v[2], v[4], v[6]-.5, v[5], v[1]}
end end
for _, v in pairs(center_node_box_list) do for _, v in pairs(center_node_box_list) do
@ -179,9 +179,8 @@ end
function xwall.register_wall(name, tiles, def) function xwall.register_wall(name, tiles, def)
local node_box_data = xwall.construct_node_box_data( local node_box_data = xwall.construct_node_box_data(
{{ -3/16, -0.5, 0, 3/16, 5/16, 0.5 }}, {{-.1875,-.5,0,.1875,.3125,.5}},{{-.25,-.5,-.25,.25,.5,.25}},
{{ -4/16, -0.5, -4/16, 4/16, 0.5, 4/16 }}, {{-.1875,-.5,-.5,.1875,.3125,.5}}
{{ -3/16, -0.5, -0.5, 3/16, 5/16, 0.5 }}
) )
if def then return end if def then return end
@ -193,7 +192,7 @@ function xwall.register_wall(name, tiles, def)
sunlight_propagates = true, sunlight_propagates = true,
collision_box = { collision_box = {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.25, 0.5, 1, 0.25} fixed = {-.5, -.5, -.25, .5, 1, .25}
} }
} }
xwall.register(name, def, node_box_data) xwall.register(name, def, node_box_data)