diff --git a/concrete.lua b/concrete.lua index 1b805dc..128cd80 100644 --- a/concrete.lua +++ b/concrete.lua @@ -1,10 +1,8 @@ -minetest.register_node("mylandscaping:concrete", { - description = "Concrete", - drawtype = "normal", - tiles = {"mylandscaping_cement.png"}, - paramtype = "light", - paramtype2 = "facedir", - groups = {cracky=1}, +minetest.register_node('mylandscaping:concrete', { + description = 'Concrete', + tiles = {'mylandscaping_cement.png'}, + groups = {cracky=1, ml=1}, sounds = default.node_sound_stone_defaults(), - }) + +--THIS NEEDS TO BE CRAFTABLE. Right now it has ZERO purpose. diff --git a/formspec.lua b/formspec.lua index 1440603..ce590a1 100644 --- a/formspec.lua +++ b/formspec.lua @@ -8,12 +8,12 @@ form = input = 'label[3,4.5;Input]'.. - 'list[current_name;input;3,5;1,1;]'.. + 'list[context;input;3,5;1,1;]'.. 'label[4,4.5;Dye]'.. - 'list[current_name;dye;4,5;1,1;]'.. + 'list[context;dye;4,5;1,1;]'.. --Output 'label[6,4.5;Output]'.. - 'list[current_name;output;6,5;1,1;]'.. + 'list[context;output;6,5;1,1;]'.. --Players Inven 'list[current_player;main;1,6;8,4;]' diff --git a/init.lua b/init.lua index 1bf9d12..4576547 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,9 @@ ---configs --- change this to make blocks show in creative inventory. 0 will show, 1 is invisible -mylandscaping_visible = 1 +mylandscaping = {} +if minetest.settings:get_bool('mylandscaping.creative') then + ml_visible = 0 +else + ml_visible = 1 +end --Load File dofile(minetest.get_modpath('mylandscaping')..'/walls_freeport.lua') @@ -9,8 +12,8 @@ dofile(minetest.get_modpath('mylandscaping')..'/walls_adaridge.lua') dofile(minetest.get_modpath('mylandscaping')..'/walls_deco.lua') dofile(minetest.get_modpath('mylandscaping')..'/stones.lua') dofile(minetest.get_modpath('mylandscaping')..'/recipes.lua') -dofile(minetest.get_modpath("mylandscaping").."/machine.lua") -dofile(minetest.get_modpath("mylandscaping").."/mixer.lua") +dofile(minetest.get_modpath('mylandscaping')..'/machine.lua') +dofile(minetest.get_modpath('mylandscaping')..'/mixer.lua') dofile(minetest.get_modpath('mylandscaping')..'/concrete.lua') dofile(minetest.get_modpath('mylandscaping')..'/formspec.lua') dofile(minetest.get_modpath('mylandscaping')..'/toppers.lua') diff --git a/machine.lua b/machine.lua index a59dda2..23b0200 100644 --- a/machine.lua +++ b/machine.lua @@ -8,593 +8,578 @@ local deco = {} local color_tab = { -{"black", "Black", "dye:black"}, -{"blue", "Blue", "dye:blue"}, -{"brown", "Brown", "dye:brown"}, -{"cyan", "Cyan", "dye:cyan"}, -{"dark_green", "Dark Green", "dye:dark_green"}, -{"dark_grey", "Dark Grey", "dye:dark_grey"}, -{"green", "Green", "dye:green"}, -{"grey", "Grey", "dye:grey"}, -{"magenta", "Magenta", "dye:magenta"}, -{"orange", "Orange", "dye:orange"}, -{"pink", "Pink", "dye:pink"}, -{"red", "Red", "dye:red"}, -{"violet", "Violet", "dye:violet"}, -{"white", "White", "dye:white"}, -{"yellow", "Yellow", "dye:yellow"}, -{"cement", "", ""}, +{'black', 'Black', 'dye:black'}, +{'blue', 'Blue', 'dye:blue'}, +{'brown', 'Brown', 'dye:brown'}, +{'cyan', 'Cyan', 'dye:cyan'}, +{'dark_green', 'Dark Green', 'dye:dark_green'}, +{'dark_grey', 'Dark Grey', 'dye:dark_grey'}, +{'green', 'Green', 'dye:green'}, +{'grey', 'Grey', 'dye:grey'}, +{'magenta', 'Magenta', 'dye:magenta'}, +{'orange', 'Orange', 'dye:orange'}, +{'pink', 'Pink', 'dye:pink'}, +{'red', 'Red', 'dye:red'}, +{'violet', 'Violet', 'dye:violet'}, +{'white', 'White', 'dye:white'}, +{'yellow', 'Yellow', 'dye:yellow'}, +{'cement', '', ''}, } minetest.register_node('mylandscaping:machine', { - description = 'concrete forms', - drawtype = 'mesh', - mesh = 'mylandscaping_cement_mixer.obj', - tiles = { - {name='mylandscaping_tex3.png'},{name='mylandscaping_tex1.png'},{name='default_gravel.png'},{name='mylandscaping_tex2.png'}}, - groups = {oddly_breakable_by_hand=2}, - paramtype = 'light', - paramtype2 = 'facedir', - selection_box = { - type = 'fixed', - fixed = { - {-0.5, -0.5, -0.5, 1.1, 0.5, 0.5}, - {1.1, -0.5, -0.1, 1.5, -0.3, 0.5} - } - }, - collision_box = { - type = 'fixed', - fixed = { - {-0.5, -0.5, -0.5, 1.1, 0.5, 0.5}, - {1.1, -0.5, -0.1, 1.5, -0.3, 0.5} - } - }, + description = 'Concrete Forms', + drawtype = 'mesh', + mesh = 'mylandscaping_cement_mixer.obj', + tiles = { + {name='mylandscaping_tex3.png'},{name='mylandscaping_tex1.png'}, + {name='default_gravel.png'},{name='mylandscaping_tex2.png'}}, + groups = {oddly_breakable_by_hand=2}, + paramtype = 'light', + paramtype2 = 'facedir', + selection_box = { + type = 'fixed', + fixed = { + {-0.5, -0.5, -0.5, 1.1, 0.5, 0.5}, + {1.1, -0.5, -0.1, 1.5, -0.3, 0.5} + } + }, + collision_box = { + type = 'fixed', + fixed = { + {-0.5, -0.5, -0.5, 1.1, 0.5, 0.5}, + {1.1, -0.5, -0.1, 1.5, -0.3, 0.5} + } + }, -can_dig = function(pos,player) - local meta = minetest.get_meta(pos); - local inv = meta:get_inventory() - if player:get_player_name() == meta:get_string("owner") and - inv:is_empty("input") and - inv:is_empty("input") and - inv:is_empty("output") then - return true - else - return false - end + can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + if player:get_player_name() == meta:get_string('owner') and + inv:is_empty('input') and + inv:is_empty('dye') and + inv:is_empty('output') then + return true + else + return false + end + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + local input = stack:get_name() + if listname == 'input' then + if input == 'mylandscaping:concrete' or input == 'mylandscaping:concrete_bag' then + return 99 + else + return 0 + end + elseif listname == 'dye' then + if minetest.get_item_group(input, 'dye') > 0 then + return 99 + else + return 0 + end + elseif listname == 'output' then + return 0 + end + end, -end, + after_place_node = function(pos, placer, itemstack) + local meta = minetest.get_meta(pos) + meta:set_string('owner',placer:get_player_name()) + meta:set_string('infotext','Concrete Mixer (owned by '..placer:get_player_name()..')') + end, -after_place_node = function(pos, placer, itemstack) - local meta = minetest.get_meta(pos) - meta:set_string("owner",placer:get_player_name()) - meta:set_string("infotext","Concrete Mixer (owned by "..placer:get_player_name()..")") - end, + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string('formspec', retaining_walls) + meta:set_string('infotext', 'Concrete Mixer') + local inv = meta:get_inventory() + inv:set_size('input', 1) + inv:set_size('output', 1) + inv:set_size('dye', 1) + end, -on_construct = function(pos) - local meta = minetest.get_meta(pos) - meta:set_string("formspec", retaining_walls) - meta:set_string("infotext", "Concrete Mixer") - local inv = meta:get_inventory() - inv:set_size("input", 1) - inv:set_size("output", 1) - inv:set_size("dye", 1) -end, + on_receive_fields = function(pos, formname, fields, sender) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if fields['retain'] then + meta:set_string('formspec', retaining_walls) + elseif fields['patio'] then + meta:set_string('formspec', patio_pavers) + elseif fields['deco'] then + meta:set_string('formspec', deco_walls) + elseif fields['column'] then + meta:set_string('formspec', columns) + end -on_receive_fields = function(pos, formname, fields, sender) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - if fields['retain'] then - meta:set_string('formspec', retaining_walls) - end - if fields['patio'] then - meta:set_string('formspec', patio_pavers) - end - if fields['deco'] then - meta:set_string('formspec', deco_walls) - end - if fields['column'] then - meta:set_string('formspec', columns) - end + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local dyecol = color_tab[i][3] -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local dyecol = color_tab[i][3] + if fields['awall1'] + or fields['awall2'] + or fields['awall3'] + or fields['awall4'] + or fields['awall5'] + then -if fields["awall1"] -or fields["awall2"] -or fields["awall3"] -or fields["awall4"] -or fields["awall5"] -then + if fields['awall1'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:awall_left_' + if inv:is_empty('input') then + return + end + end + if fields['awall2'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:awall_middle_' + if inv:is_empty('input') then + return + end + end + if fields['awall3'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:awall_right_' + if inv:is_empty('input') then + return + end + end + if fields['awall4'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:awall_icorner_' + if inv:is_empty('input') then + return + end + end + if fields['awall5'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:awall_ocorner_' + if inv:is_empty('input') then + return + end + end + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + --------------------------------------------------------------------- + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + material = col + make_ok = true + end + --------------------------------------------------------------------- + if make_ok == true then + local give = {} + if inv:room_for_item('output', block..col) then + inv:add_item('output', block..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + --------------------------------------------------------------------- + if fields['fwall1'] + or fields['fwall2'] + or fields['fwall3'] + or fields['fwall4'] + then - if fields["awall1"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:awall_left_" - if inv:is_empty("input") then - return - end - end - if fields["awall2"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:awall_middle_" - if inv:is_empty("input") then - return - end - end - if fields["awall3"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:awall_right_" - if inv:is_empty("input") then - return - end - end - if fields["awall4"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:awall_icorner_" - if inv:is_empty("input") then - return - end - end - if fields["awall5"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:awall_ocorner_" - if inv:is_empty("input") then - return - end - end - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) ---------------------------------------------------------------------- + if fields['fwall1'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:fwall_left_' + if inv:is_empty('input') then + return + end + end + if fields['fwall2'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:fwall_middle_' + if inv:is_empty('input') then + return + end + end + if fields['fwall3'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:fwall_right_' + if inv:is_empty('input') then + return + end + end + if fields['fwall4'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:fwall_corner_' + if inv:is_empty('input') then + return + end + end + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + --------------------------------------------------------------------- + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + material = col + make_ok = true + end + --------------------------------------------------------------------- + if make_ok == true then + local give = {} + if inv:room_for_item('output', block..col) then + inv:add_item('output', block..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + --------------------------------------------------------------------- + if fields['mwall1'] + or fields['mwall2'] + or fields['mwall3'] + then - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end ---------------------------------------------------------------------- - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",block..col) - end - instack:take_item() - inv:set_stack("input",1,instack) - if dyestack:get_name() == "dye:"..col then - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - end - end + if fields['mwall1'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:mwall_middle_' + if inv:is_empty('input') then + return + end + end + if fields['mwall2'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:mwall_icorner_' + if inv:is_empty('input') then + return + end + end + if fields['mwall3'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:mwall_ocorner_' + if inv:is_empty('input') then + return + end + end + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + --------------------------------------------------------------------- + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + material = col + make_ok = true + end + --------------------------------------------------------------------- + if make_ok == true then + local give = {} + if inv:room_for_item('output', block..col) then + inv:add_item('output', block..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + --------------------------------------------------------------------- + --all columns here, possible decorative caps too. + if fields['acolumn1'] + or fields['acolumn2'] + or fields['acolumn3'] + or fields['fcolumn1'] + or fields['fcolumn2'] + or fields['fcolumn3'] + or fields['mcolumn1'] + or fields['mcolumn2'] + or fields['mcolumn3'] + or fields['column_sphere'] + or fields['column_dragon'] + or fields['column_suzanne'] + or fields['column_cross'] + then + if fields['acolumn1'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:awall_column_m_t_' + if inv:is_empty('input') then + return + end + end + if fields['acolumn2'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:awall_column_ic_t_' + if inv:is_empty('input') then + return + end + end + if fields['acolumn3'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:awall_column_oc_t_' + if inv:is_empty('input') then + return + end + end + if fields['fcolumn1'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:fwall_column_m_t_' + if inv:is_empty('input') then + return + end + end + if fields['fcolumn2'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:fwall_column_ic_t_' + if inv:is_empty('input') then + return + end + end + if fields['fcolumn3'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:fwall_column_oc_t_' + if inv:is_empty('input') then + return + end + end + if fields['column_sphere'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:column_t_sphere_' + if inv:is_empty('input') then + return + end + end + if fields['column_dragon'] then + make_ok = false + anzahl = 1 + block = 'mylandscaping:column_t_dragon_' + if inv:is_empty('input') then + return + end + end + if fields['column_suzanne'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:column_t_suzanne_' + if inv:is_empty('input') then + return + end + end + if fields['column_cross'] then + make_ok = false + anzahl = 2 + block = 'mylandscaping:column_t_cross_' + if inv:is_empty('input') then + return + end + end + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + --------------------------------------------------------------------- + + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + material = col + make_ok = true + end + if make_ok == true then + local give = {} + if inv:room_for_item('output', block..col) then + inv:add_item('output', block..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + + if fields['patio1'] + or fields['patio2'] + or fields['patio3'] + or fields['patio4'] + or fields['patio5'] + or fields['patio6'] + or fields['patio7'] + then + + if fields['patio1'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_square' + if inv:is_empty('input') then + return + end + end + if fields['patio2'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_square_sm' + if inv:is_empty('input') then + return + end + end + if fields['patio7'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_square_xsm' + if inv:is_empty('input') then + return + end + end + if fields['patio3'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_pavers' + if inv:is_empty('input') then + return + end + end + if fields['patio4'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_ashlar' + if inv:is_empty('input') then + return + end + end + if fields['patio5'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_flagstone' + if inv:is_empty('input') then + return + end + end + if fields['patio6'] then + make_ok = false + anzahl = 3 + stone = 'mylandscaping:stone_pinwheel' + if inv:is_empty('input') then + return + end + end + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + make_ok = true + end + --------------------------------------------------------------------- + if make_ok == true then + local give = {} + if inv:room_for_item('output', stone..col) then + inv:add_item('output', stone..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + --------------------------------------------------------------------- + if fields['deco1'] + or fields['deco2'] + or fields['deco3'] + or fields['deco4'] + or fields['deco5'] + then + + if fields['deco1'] then + make_ok = false + anzahl = 4 + deco = 'mylandscaping:deco_wall_s_' + if inv:is_empty('input') then + return + end + end + if fields['deco2'] then + make_ok = false + anzahl = 4 + deco = 'mylandscaping:deco_wall_f_' + if inv:is_empty('input') then + return + end + end + if fields['deco3'] then + make_ok = false + anzahl = 4 + deco = 'mylandscaping:deco_wall_p_' + if inv:is_empty('input') then + return + end + end + if fields['deco4'] then + make_ok = false + anzahl = 4 + deco = 'mylandscaping:deco_wall_r_' + if inv:is_empty('input') then + return + end + end + if fields['deco5'] then + make_ok = false + anzahl = 4 + deco = 'mylandscaping:deco_column_' + if inv:is_empty('input') then + return + end + end + + local instack = inv:get_stack('input', 1) + local outstack = inv:get_stack('output', 1) + local dyestack = inv:get_stack('dye', 1) + + if instack:get_name()== 'mylandscaping:concrete_bag' and dyestack:get_name()== dyecol + or instack:get_name()== 'mylandscaping:concrete' and dyestack:get_name()== dyecol then + make_ok = true + end + --------------------------------------------------------------------- + if make_ok == true then + local give = {} + if inv:room_for_item('output', deco..col) then + inv:add_item('output', deco..col..' '..anzahl) + instack:take_item() + inv:set_stack('input',1,instack) + if dyestack:get_name() == 'dye:'..col then + dyestack:take_item() + inv:set_stack('dye',1,dyestack) + end + end + end + end + end end ---------------------------------------------------------------------- -if fields["fwall1"] -or fields["fwall2"] -or fields["fwall3"] -or fields["fwall4"] -then - - if fields["fwall1"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:fwall_left_" - if inv:is_empty("input") then - return - end - end - if fields["fwall2"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:fwall_middle_" - if inv:is_empty("input") then - return - end - end - if fields["fwall3"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:fwall_right_" - if inv:is_empty("input") then - return - end - end - if fields["fwall4"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:fwall_corner_" - if inv:is_empty("input") then - return - end - end - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) ---------------------------------------------------------------------- - - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end ---------------------------------------------------------------------- - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",block..col) - end - instack:take_item() - inv:set_stack("input",1,instack) - if dyestack:get_name() == "dye:"..col then - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - end - end -end ---------------------------------------------------------------------- -if fields["mwall1"] -or fields["mwall2"] -or fields["mwall3"] -then - - if fields["mwall1"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:mwall_middle_" - if inv:is_empty("input") then - return - end - end - if fields["mwall2"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:mwall_icorner_" - if inv:is_empty("input") then - return - end - end - if fields["mwall3"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:mwall_ocorner_" - if inv:is_empty("input") then - return - end - end - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) ---------------------------------------------------------------------- - - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end ---------------------------------------------------------------------- - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",block..col) - end - instack:take_item() - inv:set_stack("input",1,instack) - if dyestack:get_name() == "dye:"..col then - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - end - end -end ---------------------------------------------------------------------- ---all columns here, possible decorative caps too. -if fields['acolumn1'] -or fields['acolumn2'] -or fields['acolumn3'] -or fields['fcolumn1'] -or fields['fcolumn2'] -or fields['fcolumn3'] -or fields['mcolumn1'] -or fields['mcolumn2'] -or fields['mcolumn3'] -or fields['column_sphere'] -or fields['column_dragon'] -or fields['column_suzanne'] -or fields['column_cross'] -then - if fields["acolumn1"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:awall_column_m_t_" - if inv:is_empty("input") then - return - end - end - if fields["acolumn2"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:awall_column_ic_t_" - if inv:is_empty("input") then - return - end - end - if fields["acolumn3"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:awall_column_oc_t_" - if inv:is_empty("input") then - return - end - end - if fields["fcolumn1"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:fwall_column_m_t_" - if inv:is_empty("input") then - return - end - end - if fields["fcolumn2"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:fwall_column_ic_t_" - if inv:is_empty("input") then - return - end - end - if fields["fcolumn3"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:fwall_column_oc_t_" - if inv:is_empty("input") then - return - end - end - if fields["column_sphere"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:column_t_sphere_" - if inv:is_empty("input") then - return - end - end - if fields["column_dragon"] then - make_ok = false - anzahl = 1 - block = "mylandscaping:column_t_dragon_" - if inv:is_empty("input") then - return - end - end - if fields["column_suzanne"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:column_t_suzanne_" - if inv:is_empty("input") then - return - end - end - if fields["column_cross"] then - make_ok = false - anzahl = 2 - block = "mylandscaping:column_t_cross_" - if inv:is_empty("input") then - return - end - end - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) ---------------------------------------------------------------------- - - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - material = col - make_ok = true - end - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",block..col) - end - instack:take_item() - inv:set_stack("input",1,instack) - if dyestack:get_name() == "dye:"..col then - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - end - end -end - -if fields["patio1"] -or fields["patio2"] -or fields["patio3"] -or fields["patio4"] -or fields["patio5"] -or fields["patio6"] -or fields["patio7"] -then - - if fields["patio1"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_square" - if inv:is_empty("input") then - return - end - end - if fields["patio2"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_square_sm" - if inv:is_empty("input") then - return - end - end - if fields["patio7"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_square_xsm" - if inv:is_empty("input") then - return - end - end - if fields["patio3"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_pavers" - if inv:is_empty("input") then - return - end - end - if fields["patio4"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_ashlar" - if inv:is_empty("input") then - return - end - end - if fields["patio5"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_flagstone" - if inv:is_empty("input") then - return - end - end - if fields["patio6"] then - make_ok = false - anzahl = 3 - stone = "mylandscaping:stone_pinwheel" - if inv:is_empty("input") then - return - end - end - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) - - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - make_ok = true - - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - make_ok = true - - end ---------------------------------------------------------------------- - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",stone..col) - end - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - instack:take_item() - inv:set_stack("input",1,instack) - end -end ---------------------------------------------------------------------- -if fields["deco1"] -or fields["deco2"] -or fields["deco3"] -or fields['deco4'] -or fields['deco5'] -then - - if fields["deco1"] then - make_ok = false - anzahl = 4 - deco = "mylandscaping:deco_wall_s_" - if inv:is_empty("input") then - return - end - end - if fields["deco2"] then - make_ok = false - anzahl = 4 - deco = "mylandscaping:deco_wall_f_" - if inv:is_empty("input") then - return - end - end - if fields["deco3"] then - make_ok = false - anzahl = 4 - deco = "mylandscaping:deco_wall_p_" - if inv:is_empty("input") then - return - end - end - if fields["deco4"] then - make_ok = false - anzahl = 4 - deco = "mylandscaping:deco_wall_r_" - if inv:is_empty("input") then - return - end - end - if fields["deco5"] then - make_ok = false - anzahl = 4 - deco = "mylandscaping:deco_column_" - if inv:is_empty("input") then - return - end - end - - local instack = inv:get_stack("input", 1) - local outstack = inv:get_stack("output", 1) - local dyestack = inv:get_stack("dye", 1) - - if instack:get_name()== "mylandscaping:concrete_bag" and - dyestack:get_name()== dyecol then - make_ok = true - - end - if instack:get_name()== "myconcrete:concrete" and - dyestack:get_name()== dyecol then - make_ok = true - end ---------------------------------------------------------------------- - if make_ok == true then - local give = {} - for i = 0, anzahl-1 do - give[i+1]=inv:add_item("output",deco..col) - end - dyestack:take_item() - inv:set_stack("dye",1,dyestack) - instack:take_item() - inv:set_stack("input",1,instack) - end -end -end -end -}) + }) diff --git a/mixer.lua b/mixer.lua index 7c2d463..7f00e69 100644 --- a/mixer.lua +++ b/mixer.lua @@ -1,12 +1,11 @@ - -minetest.register_alias("myconcrete:concrete", "mylandscaping:concrete") - minetest.register_node('mylandscaping:mixer', { - description = 'concrete mixer', + description = 'Concrete Mixer', drawtype = 'mesh', mesh = 'mylandscaping_crusher.obj', tiles = { - {name='mylandscaping_tex1.png'},{name='mylandscaping_supports.png'},{name='mylandscaping_base.png'},{name='mylandscaping_hopper.png'},{name='mylandscaping_crusher.png'}}, + {name='mylandscaping_tex1.png'},{name='mylandscaping_supports.png'}, + {name='mylandscaping_base.png'},{name='mylandscaping_hopper.png'}, + {name='mylandscaping_crusher.png'}}, groups = {oddly_breakable_by_hand=2}, paramtype = 'light', paramtype2 = 'facedir', @@ -26,63 +25,59 @@ minetest.register_node('mylandscaping:mixer', { can_dig = function(pos,player) local meta = minetest.get_meta(pos); local inv = meta:get_inventory() - if player:get_player_name() == meta:get_string("owner") and - inv:is_empty("cobble") and - inv:is_empty("gravel") and - inv:is_empty("concrete") and - inv:is_empty("sand") then + if player:get_player_name() == meta:get_string('owner') and + inv:is_empty('cobble') and + inv:is_empty('gravel') and + inv:is_empty('concrete') and + inv:is_empty('sand') then return true else - return false + return false end end, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta(pos) - local timer = minetest.get_node_timer(pos) - meta:set_string("owner",placer:get_player_name()) - meta:set_string("infotext","Cement Mixer (owned by "..placer:get_player_name()..")") + local timer = minetest.get_node_timer(pos) + meta:set_string('owner',placer:get_player_name()) + meta:set_string('infotext','Cement Mixer (owned by '..placer:get_player_name()..')') timer:start(10) end, on_construct = function(pos) local meta = minetest.get_meta(pos) - meta:set_string("formspec", "size[9,10;]".. - "background[-0.15,-0.25;9.40,10.75;mylandscaping_background.png]".. - --Gravel - "label[0.5,1;Cobble]".. - "label[0.5,1.5;Crusher]".. - "label[2.5,2;Cobble]".. - "list[current_name;cobble;2.5,1;1,1;]".. - --"button[4,1;1,1;crush;Crush]".. - "list[current_name;gravel;5.5,1;1,1;]".. - "label[6.5,1;Gravel]".. - - --Concrete - "label[5,0.5;Concrete Mixer]".. - "list[current_name;sand;5.5,2.5;1,1;]".. - "label[6.5,2.5;Sand]".. - --"button[5.5,3.5;1,1;mix;Mix]".. - "list[current_name;concrete;5.5,4.5;1,1;]".. - "label[6.5,4.5;Output]".. - - --Players Inven - "list[current_player;main;0.5,6;8,4;]") - meta:set_string("infotext", "Concrete Mixer") + meta:set_string('formspec', 'size[9,10;]'.. + 'background[-0.15,-0.25;9.40,10.75;mylandscaping_background.png]'.. + --Gravel + 'label[0.5,1;Cobble]'.. + 'label[0.5,1.5;Crusher]'.. + 'label[2.5,2;Cobble]'.. + 'list[context;cobble;2.5,1;1,1;]'.. + 'list[context;gravel;5.5,1;1,1;]'.. + 'label[6.5,1;Gravel]'.. + --Concrete + 'label[5,0.5;Concrete Mixer]'.. + 'list[context;sand;5.5,2.5;1,1;]'.. + 'label[6.5,2.5;Sand]'.. + 'list[context;concrete;5.5,4.5;1,1;]'.. + 'label[6.5,4.5;Output]'.. + --Players Inven + 'list[current_player;main;0.5,6;8,4;]') + meta:set_string('infotext', 'Concrete Mixer') local inv = meta:get_inventory() - inv:set_size("cobble", 1) - inv:set_size("gravel", 1) - inv:set_size("concrete", 1) - inv:set_size("sand", 1) - end, + inv:set_size('cobble', 1) + inv:set_size('gravel', 1) + inv:set_size('concrete', 1) + inv:set_size('sand', 1) +end, allow_metadata_inventory_put = function(pos, listname, index, stack, player) local input = stack:get_name() if listname == 'cobble' then - if input ~= 'default:cobble' then - return 0 - else + if input == 'default:cobble' or minetest.get_item_group(input, 'ml') > 0 then return 99 + else + return 0 end elseif listname == 'gravel' then if input ~= 'default:gravel' then @@ -91,10 +86,10 @@ on_construct = function(pos) return 99 end elseif listname == 'sand' then - if input ~= 'default:sand' then - return 0 - else + if minetest.get_item_group(input, 'sand') > 0 then return 99 + else + return 0 end elseif listname == 'concrete' then return 0 @@ -102,30 +97,27 @@ on_construct = function(pos) end, on_timer = function(pos) - local timer = minetest.get_node_timer(pos) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local cobble = inv:get_stack("cobble", 1) - local gravel = inv:get_stack("gravel", 1) - local sand = inv:get_stack("sand", 1) - local cobble_inv= cobble:get_name() + local timer = minetest.get_node_timer(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local cobble = inv:get_stack('cobble', 1) + local gravel = inv:get_stack('gravel', 1) + local sand = inv:get_stack('sand', 1) + local cobble_inv= cobble:get_name() + local sand_inv = sand:get_name() ---------------------------------------------------------------------- - if cobble:get_name() == "default:cobble" or - minetest.get_item_group(cobble_inv, 'ml') > 0 then - inv:add_item("gravel","default:gravel") - cobble:take_item() - inv:set_stack("cobble",1,cobble) + if cobble:get_name() == 'default:cobble' or minetest.get_item_group(cobble_inv, 'ml') > 0 then + inv:add_item('gravel','default:gravel') + cobble:take_item() + inv:set_stack('cobble',1,cobble) end - if gravel:get_name() == "default:gravel" and - sand:get_name() == "default:sand" or - sand:get_name() == "default:desert_sand" then - inv:add_item("concrete","mylandscaping:concrete_bag") - gravel:take_item() - inv:set_stack("gravel",1,gravel) - sand:take_item() - inv:set_stack("sand",1,sand) + if gravel:get_name() == 'default:gravel' and minetest.get_item_group(sand_inv, 'sand') > 0 then + inv:add_item('concrete','mylandscaping:concrete_bag') + gravel:take_item() + inv:set_stack('gravel',1,gravel) + sand:take_item() + inv:set_stack('sand',1,sand) end timer:start(10) - end, }) diff --git a/readme.md b/readme.md index ef2e5e6..a4285f5 100644 --- a/readme.md +++ b/readme.md @@ -15,7 +15,3 @@ This is a Minetest mod that adds retaining walls and column nodes. - default - bucket - myconcrete? - -# -Please Note: -If you don't want all the blocks showing in creative inventory modify the walls.lua file and change the first line to say visible = 0, (this is the default setting.) diff --git a/recipes.lua b/recipes.lua index eccf3fe..5306ed3 100644 --- a/recipes.lua +++ b/recipes.lua @@ -1,19 +1,28 @@ minetest.register_craft({ - output = 'mylandscaping:machine 1', - recipe = { - {'default:shovel_steel', 'bucket:bucket_water', ''}, - {'default:steel_ingot', 'mylandscaping:concrete_bag', 'default:steel_ingot'}, - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - } + output = 'mylandscaping:machine', + recipe = { + {'default:shovel_steel', 'bucket:bucket_water', ''}, + {'default:steel_ingot', 'mylandscaping:concrete_bag', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } }) minetest.register_craft({ - output = 'mylandscaping:mixer 1', - recipe = { - {'default:pick_steel', 'default:paper', 'default:chest'}, - {'group:stick', 'default:paper', 'group:stick'}, - {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, - } + output = 'mylandscaping:mixer', + recipe = { + {'default:pick_steel', 'default:paper', 'default:chest'}, + {'group:stick', 'default:paper', 'group:stick'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'mylandscaping:concrete', + recipe = { + {'', '', ''}, + {'', '', ''}, + {'', '', ''}, + } }) minetest.register_craftitem('mylandscaping:concrete_bag', { diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..27896cd --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1 @@ +mylandscaping.creative (Display retaining wall blocks in creative inventory?) bool false diff --git a/stones.lua b/stones.lua index 77c6741..237da26 100644 --- a/stones.lua +++ b/stones.lua @@ -1,32 +1,32 @@ local stone_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, } } local sstone_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } } local sq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, 0.4375, -0.3125, 0.4375}, {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, } } local s_sq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, 0.4375, 0.5, 0.4375}, {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } } local smsq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, -0.0625, -0.3125, -0.0625}, {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, @@ -36,7 +36,7 @@ local smsq_cbox = { } } local s_smsq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, -0.0625, 0.5, -0.0625}, {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, @@ -46,7 +46,7 @@ local s_smsq_cbox = { } } local xsmsq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, -0.1875, -0.3125, -0.1875}, {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, @@ -61,7 +61,7 @@ local xsmsq_cbox = { } } local s_xsmsq_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.4375, -0.5, -0.4375, -0.1875, 0.5, -0.1875}, {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, @@ -76,89 +76,89 @@ local s_xsmsq_cbox = { } } local paver_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, 0.3125, -0.3125, -0.3125, 0.5}, {-0.25, -0.5, 0.3125, -0.0625, -0.3125, 0.5}, - {-0.5, -0.5, 0.0625, -0.0625, -0.3125, 0.25}, - {0, -0.5, 0.0625, 0.1875, -0.3125, 0.5}, + {-0.5, -0.5, 0.0625, -0.0625, -0.3125, 0.25}, + {0, -0.5, 0.0625, 0.1875, -0.3125, 0.5}, {-0.5, -0.5, -0.4375, -0.3125, -0.3125, 0}, - {-0.25, -0.5, -0.1875, 0.1875, -0.3125, 0}, - {0.25, -0.5, 0.3125, 0.5, -0.3125, 0.5}, - {0.25, -0.5, -0.1875, 0.4375, -0.3125, 0.25}, - {-0.25, -0.5, -0.5, -0.0625, -0.3125, -0.25}, - {0, -0.5, -0.4375, 0.4375, -0.3125, -0.25}, - {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, + {-0.25, -0.5, -0.1875, 0.1875, -0.3125, 0}, + {0.25, -0.5, 0.3125, 0.5, -0.3125, 0.5}, + {0.25, -0.5, -0.1875, 0.4375, -0.3125, 0.25}, + {-0.25, -0.5, -0.5, -0.0625, -0.3125, -0.25}, + {0, -0.5, -0.4375, 0.4375, -0.3125, -0.25}, + {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, } } local spaver_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, 0.3125, -0.3125, 0.5, 0.5}, {-0.25, -0.5, 0.3125, -0.0625, 0.5, 0.5}, - {-0.5, -0.5, 0.0625, -0.0625, 0.5, 0.25}, - {0, -0.5, 0.0625, 0.1875, 0.5, 0.5}, + {-0.5, -0.5, 0.0625, -0.0625, 0.5, 0.25}, + {0, -0.5, 0.0625, 0.1875, 0.5, 0.5}, {-0.5, -0.5, -0.4375, -0.3125, 0.5, 0}, - {-0.25, -0.5, -0.1875, 0.1875, 0.5, 0}, - {0.25, -0.5, 0.3125, 0.5, 0.5, 0.5}, - {0.25, -0.5, -0.1875, 0.4375, 0.5, 0.25}, - {-0.25, -0.5, -0.5, -0.0625, 0.5, -0.25}, - {0, -0.5, -0.4375, 0.4375, 0.5, -0.25}, - {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, + {-0.25, -0.5, -0.1875, 0.1875, 0.5, 0}, + {0.25, -0.5, 0.3125, 0.5, 0.5, 0.5}, + {0.25, -0.5, -0.1875, 0.4375, 0.5, 0.25}, + {-0.25, -0.5, -0.5, -0.0625, 0.5, -0.25}, + {0, -0.5, -0.4375, 0.4375, 0.5, -0.25}, + {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } } local ashlar_cbox = { - type = "fixed", + type = 'fixed', fixed = { - {-0.5, -0.5, 0.375, -0.375, -0.3125, 0.5}, - {-0.5, -0.5, 0.1875, -0.375, -0.3125, 0.3125}, - {-0.3125, -0.5, 0.1875, -0.0625, -0.3125, 0.5}, - {0, -0.5, 0.375, 0.25, -0.3125, 0.5}, - {0.3125, -0.5, 0.375, 0.5, -0.3125, 0.5}, - {-0.5, -0.5, -0.1875, -0.1875, -0.3125, 0.125}, - {-0.5, -0.5, -0.5, -0.375, -0.3125, -0.25}, - {-0.3125, -0.5, -0.375, -0.1875, -0.3125, -0.25}, - {-0.125, -0.5, -0.0625, -0.0625, -0.3125, 0.125}, - {-0.125, -0.5, -0.375, 0.0625, -0.3125, -0.125}, - {0, -0.5, -0.0625, 0.0625, -0.3125, 0}, - {0, -0.5, 0.0625, 0.3125, -0.3125, 0.3125}, - {0.375, -0.5, 0.1875, 0.5, -0.3125, 0.3125}, - {0.375, -0.5, -0.1875, 0.5, -0.3125, 0.125}, - {0.125, -0.5, -0.1875, 0.3125, -0.3125, 0}, - {0.125, -0.5, -0.375, 0.25, -0.3125, -0.25}, - {-0.3125, -0.5, -0.5, -0.0625, -0.3125, -0.4375}, - {0, -0.5, -0.5, 0.25, -0.3125, -0.4375}, - {0.3125, -0.5, -0.5, 0.5, -0.3125, -0.25}, - {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, + {-0.5, -0.5, 0.375, -0.375, -0.3125, 0.5}, + {-0.5, -0.5, 0.1875, -0.375, -0.3125, 0.3125}, + {-0.3125, -0.5, 0.1875, -0.0625, -0.3125, 0.5}, + {0, -0.5, 0.375, 0.25, -0.3125, 0.5}, + {0.3125, -0.5, 0.375, 0.5, -0.3125, 0.5}, + {-0.5, -0.5, -0.1875, -0.1875, -0.3125, 0.125}, + {-0.5, -0.5, -0.5, -0.375, -0.3125, -0.25}, + {-0.3125, -0.5, -0.375, -0.1875, -0.3125, -0.25}, + {-0.125, -0.5, -0.0625, -0.0625, -0.3125, 0.125}, + {-0.125, -0.5, -0.375, 0.0625, -0.3125, -0.125}, + {0, -0.5, -0.0625, 0.0625, -0.3125, 0}, + {0, -0.5, 0.0625, 0.3125, -0.3125, 0.3125}, + {0.375, -0.5, 0.1875, 0.5, -0.3125, 0.3125}, + {0.375, -0.5, -0.1875, 0.5, -0.3125, 0.125}, + {0.125, -0.5, -0.1875, 0.3125, -0.3125, 0}, + {0.125, -0.5, -0.375, 0.25, -0.3125, -0.25}, + {-0.3125, -0.5, -0.5, -0.0625, -0.3125, -0.4375}, + {0, -0.5, -0.5, 0.25, -0.3125, -0.4375}, + {0.3125, -0.5, -0.5, 0.5, -0.3125, -0.25}, + {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5}, } } local sashlar_cbox = { - type = "fixed", + type = 'fixed', fixed = { - {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5}, - {-0.5, -0.5, 0.1875, -0.375, 0.5, 0.3125}, - {-0.3125, -0.5, 0.1875, -0.0625, 0.5, 0.5}, - {0, -0.5, 0.375, 0.25, 0.5, 0.5}, - {0.3125, -0.5, 0.375, 0.5, 0.5, 0.5}, - {-0.5, -0.5, -0.1875, -0.1875, 0.5, 0.125}, - {-0.5, -0.5, -0.5, -0.375, 0.5, -0.25}, - {-0.3125, -0.5, -0.375, -0.1875, 0.5, -0.25}, - {-0.125, -0.5, -0.0625, -0.0625, 0.5, 0.125}, - {-0.125, -0.5, -0.375, 0.0625, 0.5, -0.125}, - {0, -0.5, -0.0625, 0.0625, 0.5, 0}, - {0, -0.5, 0.0625, 0.3125, 0.5, 0.3125}, - {0.375, -0.5, 0.1875, 0.5, 0.5, 0.3125}, - {0.375, -0.5, -0.1875, 0.5, 0.5, 0.125}, - {0.125, -0.5, -0.1875, 0.3125, 0.5, 0}, - {0.125, -0.5, -0.375, 0.25, 0.5, -0.25}, - {-0.3125, -0.5, -0.5, -0.0625, 0.5, -0.4375}, - {0, -0.5, -0.5, 0.25, 0.5, -0.4375}, - {0.3125, -0.5, -0.5, 0.5, 0.5, -0.25}, - {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, + {-0.5, -0.5, 0.375, -0.375, 0.5, 0.5}, + {-0.5, -0.5, 0.1875, -0.375, 0.5, 0.3125}, + {-0.3125, -0.5, 0.1875, -0.0625, 0.5, 0.5}, + {0, -0.5, 0.375, 0.25, 0.5, 0.5}, + {0.3125, -0.5, 0.375, 0.5, 0.5, 0.5}, + {-0.5, -0.5, -0.1875, -0.1875, 0.5, 0.125}, + {-0.5, -0.5, -0.5, -0.375, 0.5, -0.25}, + {-0.3125, -0.5, -0.375, -0.1875, 0.5, -0.25}, + {-0.125, -0.5, -0.0625, -0.0625, 0.5, 0.125}, + {-0.125, -0.5, -0.375, 0.0625, 0.5, -0.125}, + {0, -0.5, -0.0625, 0.0625, 0.5, 0}, + {0, -0.5, 0.0625, 0.3125, 0.5, 0.3125}, + {0.375, -0.5, 0.1875, 0.5, 0.5, 0.3125}, + {0.375, -0.5, -0.1875, 0.5, 0.5, 0.125}, + {0.125, -0.5, -0.1875, 0.3125, 0.5, 0}, + {0.125, -0.5, -0.375, 0.25, 0.5, -0.25}, + {-0.3125, -0.5, -0.5, -0.0625, 0.5, -0.4375}, + {0, -0.5, -0.5, 0.25, 0.5, -0.4375}, + {0.3125, -0.5, -0.5, 0.5, 0.5, -0.25}, + {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5}, } } local flag_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, 0.0625, -0.0625, -0.3125, 0.5}, {-0.5, -0.5, -0.1875, -0.25, -0.3125, 0}, @@ -172,7 +172,7 @@ local flag_cbox = { } } local sflag_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, 0.0625, -0.0625, 0.5, 0.5}, {-0.5, -0.5, -0.1875, -0.25, 0.5, 0}, @@ -186,7 +186,7 @@ local sflag_cbox = { } } local pin_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, -0.125, -0.25, -0.3125, 0.5}, {-0.5, -0.5, -0.4375, 0.125, -0.3125, -0.1875}, @@ -197,7 +197,7 @@ local pin_cbox = { } } local spin_cbox = { - type = "fixed", + type = 'fixed', fixed = { {-0.5, -0.5, -0.125, -0.25, 0.5, 0.5}, {-0.5, -0.5, -0.4375, 0.125, 0.5, -0.1875}, @@ -208,16 +208,14 @@ local spin_cbox = { } } - - local stone_types = { --style, desc, img1, img2 - {"square", "Square", "concrete", "square",sq_cbox,s_sq_cbox}, - {"square_sm", "Small Square", "concrete", "square_sm",smsq_cbox,s_smsq_cbox}, - {"square_xsm", "Extra Small Square", "concrete", "square_xsm",xsmsq_cbox,s_xsmsq_cbox}, - {"pavers", "Paver", "concrete", "pavers",paver_cbox,spaver_cbox}, - {"ashlar", "Ashlar", "concrete", "ashlar",ashlar_cbox,sashlar_cbox}, - {"flagstone", "Flagstone", "concrete", "flagstone",flag_cbox,sflag_cbox}, - {"pinwheel", "Pinwheel", "concrete", "pinwheel",pin_cbox,spin_cbox}, + {'square', 'Square', 'concrete', 'square',sq_cbox,s_sq_cbox}, + {'square_sm', 'Small Square', 'concrete', 'square_sm',smsq_cbox,s_smsq_cbox}, + {'square_xsm', 'Extra Small Square', 'concrete', 'square_xsm',xsmsq_cbox,s_xsmsq_cbox}, + {'pavers', 'Paver', 'concrete', 'pavers',paver_cbox,spaver_cbox}, + {'ashlar', 'Ashlar', 'concrete', 'ashlar',ashlar_cbox,sashlar_cbox}, + {'flagstone', 'Flagstone', 'concrete', 'flagstone',flag_cbox,sflag_cbox}, + {'pinwheel', 'Pinwheel', 'concrete', 'pinwheel',pin_cbox,spin_cbox}, } for i in ipairs (stone_types) do local style = stone_types[i][1] @@ -226,83 +224,80 @@ for i in ipairs (stone_types) do local img2 = stone_types[i][4] local cbox = stone_types[i][5] local scbox = stone_types[i][6] + local color_tab = { + {'black', 'Black', '^[colorize:black:150'}, + {'blue', 'Blue', '^[colorize:#0404B4:100'}, + {'brown', 'Brown', '^[colorize:#190B07:100'}, + {'cyan', 'Cyan', '^[colorize:cyan:100'}, + {'dark_green', 'Dark Green', '^[colorize:#071907:150'}, + {'dark_grey', 'Dark Grey', '^[colorize:black:150'}, + {'green', 'Green', '^[colorize:green:100'}, + {'grey', 'Grey', '^[colorize:black:100'}, + {'magenta', 'Magenta', '^[colorize:magenta:100'}, + {'orange', 'Orange', '^[colorize:orange:100'}, + {'pink', 'Pink', '^[colorize:#FE2E9A:100'}, + {'red', 'Red', '^[colorize:#B40404:100'}, + {'violet', 'Violet', '^[colorize:#2F0B3A:100'}, + {'white', 'White', '^[colorize:white:100'}, + {'yellow', 'Yellow', '^[colorize:yellow:100'}, + {'cement', 'Concrete', ''}, + } -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] -minetest.register_alias("mylandscaping:stone_"..style,"mylandscaping:stone_"..style.."cement") + minetest.register_alias('mylandscaping:stone_'..style,'mylandscaping:stone_'..style..'cement') -minetest.register_node("mylandscaping:stone_"..style..col,{ - description = desc.." Patio Stone"..coldesc, - drawtype = "nodebox", - tiles = { - "mylandscaping_"..img1..".png^mylandscaping_"..img2..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - }, - paramtype = "light", - groups = {cracky = 2, not_in_creative_inventory=1, ml=1,}, - node_box = cbox, - selection_box = stone_cbox, - collision_box = stone_cbox, - sounds = default.node_sound_stone_defaults(), - - after_place_node = function(pos, placer, itemstack, pointed_thing) - - local nodeu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name + minetest.register_node('mylandscaping:stone_'..style..col,{ + description = desc..' Patio Stone '..coldesc, + drawtype = 'nodebox', + tiles = { + 'mylandscaping_'..img1..'.png^mylandscaping_'..img2..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + }, + paramtype = 'light', + groups = {cracky = 2, not_in_creative_inventory=ml_visible, ml=1,}, + node_box = cbox, + selection_box = stone_cbox, + collision_box = stone_cbox, + sounds = default.node_sound_stone_defaults(), - if nodeu == "default:sand" or - nodeu == "default:desert_sand" then - minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z},{name = "mylandscaping:stone_"..style.."_sand"..col}) - minetest.set_node(pos,{name = "air"}) - end - end, + after_place_node = function(pos, placer, itemstack, pointed_thing) + local nodeu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name + if minetest.get_item_group(nodeu, 'sand') > 0 then + minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z},{name = 'mylandscaping:stone_'..style..'_sand'..col}) + minetest.set_node(pos,{name = 'air'}) + end + end, -}) -minetest.register_node("mylandscaping:stone_"..style.."_sand"..col,{ - description = desc.." Patio Stone in Sand "..coldesc, - drawtype = "nodebox", - tiles = { - "mylandscaping_"..img1..".png^mylandscaping_"..img2..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - "mylandscaping_"..img1..".png"..alpha, - }, - drop = "mylandscaping:stone_"..style, - paramtype = "light", - groups = {cracky = 2, not_in_creative_inventory = 1}, - node_box = scbox, - selection_box = sstone_cbox, - collision_box = sstone_cbox, - sounds = default.node_sound_stone_defaults(), - after_dig_node = function(pos, oldnode, oldmetadata, digger) - minetest.set_node(pos,{name = "default:sand"}) - end, -}) -end + }) + minetest.register_node('mylandscaping:stone_'..style..'_sand'..col,{ + description = desc..' Patio Stone in Sand '..coldesc, + drawtype = 'nodebox', + tiles = { + 'mylandscaping_'..img1..'.png^mylandscaping_'..img2..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + 'mylandscaping_'..img1..'.png'..alpha, + }, + drop = 'mylandscaping:stone_'..style, + paramtype = 'light', + groups = {cracky = 2, not_in_creative_inventory = 1}, + node_box = scbox, + selection_box = sstone_cbox, + collision_box = sstone_cbox, + sounds = default.node_sound_stone_defaults(), + after_dig_node = function(pos, oldnode, oldmetadata, digger) + minetest.set_node(pos,{name = 'default:silver_sand'}) + end, + }) + end end diff --git a/textures/mylandscaping_cement.png b/textures/mylandscaping_cement.png index 732716c..6d7b439 100644 Binary files a/textures/mylandscaping_cement.png and b/textures/mylandscaping_cement.png differ diff --git a/toppers.lua b/toppers.lua index 9cf97a6..242c08b 100644 --- a/toppers.lua +++ b/toppers.lua @@ -1,48 +1,47 @@ local block_type1 = { -- desc2, obj, texture -{"Sphere", "sphere", 'concrete'}, -{"Suzanne", "suzanne", 'concrete'}, +{'Sphere', 'sphere', 'concrete'}, +{'Suzanne', 'suzanne', 'concrete'}, {'Dragon', 'dragon', 'dragon'}, {'Cross', 'cross', 'concrete'}, } + for i in ipairs (block_type1) do local desc2 = block_type1[i][1] local obj = block_type1[i][2] local tex = block_type1[i][3] + local color_tab = { + {'black', 'Black', '^[colorize:black:150'}, + {'blue', 'Blue', '^[colorize:#0404B4:100'}, + {'brown', 'Brown', '^[colorize:#190B07:100'}, + {'cyan', 'Cyan', '^[colorize:cyan:100'}, + {'dark_green', 'Dark Green', '^[colorize:#071907:150'}, + {'dark_grey', 'Dark Grey', '^[colorize:black:150'}, + {'green', 'Green', '^[colorize:green:100'}, + {'grey', 'Grey', '^[colorize:black:100'}, + {'magenta', 'Magenta', '^[colorize:magenta:100'}, + {'orange', 'Orange', '^[colorize:orange:100'}, + {'pink', 'Pink', '^[colorize:#FE2E9A:100'}, + {'red', 'Red', '^[colorize:#B40404:100'}, + {'violet', 'Violet', '^[colorize:#2F0B3A:100'}, + {'white', 'White', '^[colorize:white:100'}, + {'yellow', 'Yellow', '^[colorize:yellow:100'}, + {'cement', 'Concrete', ''}, + } -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] - -minetest.register_node('mylandscaping:column_t_'..obj.."_"..col, { - description = desc2..' topper', - drawtype = 'mesh', - mesh = 'mylandscaping_column_t_'..obj..'.obj', - tiles = {name='mylandscaping_'..tex..'.png'..alpha}, - groups = {cracky=2, not_in_creative_inventory=mylandscaping_visible, ml=1}, - paramtype = 'light', - paramtype2 = 'facedir', - sounds = default.node_sound_stone_defaults(), -}) + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] + minetest.register_node('mylandscaping:column_t_'..obj..'_'..col, { + description = desc2..' topper', + drawtype = 'mesh', + mesh = 'mylandscaping_column_t_'..obj..'.obj', + tiles = {name='mylandscaping_'..tex..'.png'..alpha}, + groups = {cracky=2, not_in_creative_inventory=ml_visible, ml=1}, + paramtype = 'light', + paramtype2 = 'facedir', + sounds = default.node_sound_stone_defaults(), + }) + end end -end - diff --git a/walls_adaridge.lua b/walls_adaridge.lua index bcae8e8..78e4839 100644 --- a/walls_adaridge.lua +++ b/walls_adaridge.lua @@ -1,26 +1,26 @@ local colbox_type1 = { --top blocks - type = "fixed", + type = 'fixed', fixed = {{-.49, -.5, 0.05, .5, .5, .52}} } local colbox_type2 = { --outside corner columns - type = "fixed", + type = 'fixed', fixed = {{-.2, -.5, -.2, .5, .5, .5}} } local colbox_type3 = { --bottom blocks - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.16, .5, .5, .25}} } local colbox_type4 = { --inside corner - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, 0, .5, .5, .5}, {0, -.5, -.5, .5, .5, .5}} } local colbox_type5 = { --inside corner column - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.5, .5, .5, .5},} } local colbox_type6 = { --middle column - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.3, .5, .5, .5},} } @@ -30,22 +30,22 @@ local colbox_type7 = { --outside corner } local block_type1 = { -- desc2, typ, obj, colbox, drops, grup -{"Retaining Wall Left", "left", "blocka_l_t", colbox_type1, "left", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Middle", "middle", "blocka_m_t", colbox_type1, "middle", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Right", "right", "blocka_r_t", colbox_type1, "right", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Inside Corner", "icorner", "blocka_ic_t", colbox_type4, "icorner", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Outside Corner", "ocorner", "blocka_oc_t", colbox_type2, "ocorner", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Left Bot", "bleft", "blocka_l_b", colbox_type3, "left", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Middle Bot", "bmiddle", "blocka_m_b", colbox_type3, "middle", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Right Bot", "bright", "blocka_r_b", colbox_type3, "right", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Inside Corner Bot", "bicorner", "blocka_ic_b", colbox_type4, "icorner", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Outside Corner Bot", "bocorner", "blocka_oc_b", colbox_type2, "ocorner", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Inside Corner", "column_ic_t", "columna_ic_t", colbox_type5, "column_ic_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Outside Corner", "column_oc_t", "columna_oc_t", colbox_type2, "column_oc_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Middle", "column_m_t", "columna_m_t", colbox_type6, "column_m_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Inside Corner Bot", "bcolumn_ic_t", "columna_ic_b", colbox_type5, "column_ic_b", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Outside Corner Bot", "bcolumn_oc_t", "columna_oc_b", colbox_type2, "column_oc_b", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Middle Bot", "bcolumn_m_t", "columna_m_b", colbox_type6, "column_m_b", {not_in_creative_inventory=mylandscaping_visible}}, +{'Adaridge Left', 'left', 'blocka_l_t', colbox_type1, 'left', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Middle', 'middle', 'blocka_m_t', colbox_type1, 'middle', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Right', 'right', 'blocka_r_t', colbox_type1, 'right', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Inside Corner', 'icorner', 'blocka_ic_t', colbox_type4, 'icorner', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Outside Corner', 'ocorner', 'blocka_oc_t', colbox_type2, 'ocorner', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bleft', 'blocka_l_b', colbox_type3, 'left', {not_in_creative_inventory=1}}, +{'Hax0r', 'bmiddle', 'blocka_m_b', colbox_type3, 'middle', {not_in_creative_inventory=1}}, +{'Hax0r', 'bright', 'blocka_r_b', colbox_type3, 'right', {not_in_creative_inventory=1}}, +{'Hax0r', 'bicorner', 'blocka_ic_b', colbox_type4, 'icorner', {not_in_creative_inventory=1}}, +{'Hax0r', 'bocorner', 'blocka_oc_b', colbox_type2, 'ocorner', {not_in_creative_inventory=1}}, +{'Adaridge Column (IC)', 'column_ic_t', 'columna_ic_t', colbox_type5, 'column_ic_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Column (OC)', 'column_oc_t', 'columna_oc_t', colbox_type2, 'column_oc_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Adaridge Column (M)', 'column_m_t', 'columna_m_t', colbox_type6, 'column_m_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bcolumn_ic_t', 'columna_ic_b', colbox_type5, 'column_ic_b', {not_in_creative_inventory=1}}, +{'Hax0r', 'bcolumn_oc_t', 'columna_oc_b', colbox_type2, 'column_oc_b', {not_in_creative_inventory=1}}, +{'Hax0r', 'bcolumn_m_t', 'columna_m_b', colbox_type6, 'column_m_b', {not_in_creative_inventory=1}}, } for i in ipairs (block_type1) do local desc2 = block_type1[i][1] @@ -54,66 +54,61 @@ for i in ipairs (block_type1) do local colbox = block_type1[i][4] local drops = block_type1[i][5] local grup = block_type1[i][6] + local color_tab = { + {'black', 'Black', '^[colorize:black:150'}, + {'blue', 'Blue', '^[colorize:#0404B4:100'}, + {'brown', 'Brown', '^[colorize:#190B07:100'}, + {'cyan', 'Cyan', '^[colorize:cyan:100'}, + {'dark_green', 'Dark Green', '^[colorize:#071907:150'}, + {'dark_grey', 'Dark Grey', '^[colorize:black:150'}, + {'green', 'Green', '^[colorize:green:100'}, + {'grey', 'Grey', '^[colorize:black:100'}, + {'magenta', 'Magenta', '^[colorize:magenta:100'}, + {'orange', 'Orange', '^[colorize:orange:100'}, + {'pink', 'Pink', '^[colorize:#FE2E9A:100'}, + {'red', 'Red', '^[colorize:#B40404:100'}, + {'violet', 'Violet', '^[colorize:#2F0B3A:100'}, + {'white', 'White', '^[colorize:white:100'}, + {'yellow', 'Yellow', '^[colorize:yellow:100'}, + {'cement', 'Concrete', ''}, + } + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] + minetest.register_node('mylandscaping:awall_'..typ..'_'..col, { + description = desc2..' '..coldesc, + drawtype = 'mesh', + mesh = 'mylandscaping_'..obj..'.obj', + tiles = {name='mylandscaping_adaridge_tex.png'..alpha}, + groups = grup, + paramtype = 'light', + paramtype2 = 'facedir', + drop = 'mylandscaping:awall_'..drops..'_'..col, + selection_box = colbox, + collision_box = colbox, + sounds = default.node_sound_stone_defaults(), -minetest.register_node('mylandscaping:awall_'..typ.."_"..col, { - description = desc2.." "..coldesc, - drawtype = 'mesh', - mesh = 'mylandscaping_'..obj..'.obj', - tiles = {name='mylandscaping_adaridge_tex.png'..alpha}, - groups = grup, - paramtype = 'light', - paramtype2 = 'facedir', - drop = 'mylandscaping:awall_'..drops.."_"..col, - selection_box = colbox, - collision_box = colbox, - sounds = default.node_sound_stone_defaults(), - -after_place_node = function(pos, placer, itemstack, pointed_thing) - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) - if nodeu.name == "mylandscaping:awall_"..typ.."_"..col then - minetest.set_node(pos,{name="mylandscaping:awall_"..typ.."_"..col,param2=nodeu.param2}) - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:awall_b"..typ.."_"..col,param2=nodeu.param2}) - end - if nodea.name == "mylandscaping:awall_"..typ..col then - minetest.set_node(pos,{name="mylandscaping:awall_b"..typ.."_"..col,param2=node.param2}) - end -end, - -after_destruct = function(pos, oldnode) - local node = minetest.get_node(pos).name - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - if nodeu.name == "mylandscaping:awall_b"..typ.."_"..col then - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:awall_"..typ.."_"..col,param2=nodeu.param2}) - end -end, - -}) + after_place_node = function(pos, placer, itemstack, pointed_thing) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) + local node = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}) + if nodeu.name == 'mylandscaping:awall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:awall_'..typ..'_'..col,param2=nodeu.param2}) + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:awall_b'..typ..'_'..col,param2=nodeu.param2}) + end + if nodea.name == 'mylandscaping:awall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:awall_b'..typ..'_'..col,param2=nodea.param2}) + end + end, -end + after_destruct = function(pos, oldnode) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + if nodeu.name == 'mylandscaping:awall_b'..typ..'_'..col then + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:awall_'..typ..'_'..col,param2=nodeu.param2}) + end + end, + }) + end end diff --git a/walls_deco.lua b/walls_deco.lua index 2102b3e..fcf544d 100644 --- a/walls_deco.lua +++ b/walls_deco.lua @@ -8,77 +8,76 @@ local colbox_type2 = { --wall } local block_type1 = { -- desc2, obj, colbox, grup, -{"Deco Wall Scalloped", "wall_s", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Deco Wall Flat Top", "wall_f", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{'Deco Wall Peaked Top', 'wall_p', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{'Deco Wall Random Top', 'wall_r', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Deco Wall Column", "column", colbox_type1, {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, +{"Deco Wall Scalloped", "wall_s", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{"Deco Wall Flat Top", "wall_f", colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Deco Wall Peaked Top', 'wall_p', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Deco Wall Random Top', 'wall_r', colbox_type2, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{"Deco Wall Column", "column", colbox_type1, {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, } for i in ipairs (block_type1) do local desc2 = block_type1[i][1] local obj = block_type1[i][2] local colbox = block_type1[i][3] local grup = block_type1[i][4] + local color_tab = { + {"black", "Black", "^[colorize:black:150"}, + {"blue", "Blue", "^[colorize:#0404B4:100"}, + {"brown", "Brown", "^[colorize:#190B07:100"}, + {"cyan", "Cyan", "^[colorize:cyan:100"}, + {"dark_green", "Dark Green", "^[colorize:#071907:150"}, + {"dark_grey", "Dark Grey", "^[colorize:black:150"}, + {"green", "Green", "^[colorize:green:100"}, + {"grey", "Grey", "^[colorize:black:100"}, + {"magenta", "Magenta", "^[colorize:magenta:100"}, + {"orange", "Orange", "^[colorize:orange:100"}, + {"pink", "Pink", "^[colorize:#FE2E9A:100"}, + {"red", "Red", "^[colorize:#B40404:100"}, + {"violet", "Violet", "^[colorize:#2F0B3A:100"}, + {"white", "White", "^[colorize:white:100"}, + {"yellow", "Yellow", "^[colorize:yellow:100"}, + {"cement", "Concrete", ""}, + } + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] + minetest.register_node('mylandscaping:deco_'..obj..'_'..col, { + description = desc2.." "..coldesc, + drawtype = 'mesh', + mesh = 'mylandscaping_deco_'..obj..'.obj', + tiles = {{name='mylandscaping_block_split.png'..alpha}, {name='mylandscaping_block_smooth.png'..alpha}}, + groups = grup, + paramtype = 'light', + paramtype2 = 'facedir', + selection_box = colbox, + collision_box = colbox, + sounds = default.node_sound_stone_defaults(), + }) -minetest.register_node('mylandscaping:deco_'..obj..'_'..col, { - description = desc2.." "..coldesc, - drawtype = 'mesh', - mesh = 'mylandscaping_deco_'..obj..'.obj', - tiles = {{name='mylandscaping_block_split.png'..alpha}, {name='mylandscaping_block_smooth.png'..alpha}}, - groups = grup, - paramtype = 'light', - paramtype2 = 'facedir', - selection_box = colbox, - collision_box = colbox, - sounds = default.node_sound_stone_defaults(), -}) + minetest.register_node('mylandscaping:deco_column_light_'..col, { + description = coldesc..'lighted column', + drawtype = 'mesh', + mesh = 'mylandscaping_deco_column_l.obj', + tiles = { + {name='mylandscaping_block_split.png'..alpha}, + {name='mylandscaping_block_smooth.png'..alpha}, + {name='mylandscaping_block_smooth.png^[colorize:yellow:255'}, + {name='mylandscaping_block_smooth.png^[colorize:#190B07:200'}}, + groups = grup, + paramtype = 'light', + paramtype2 = 'facedir', + light_source = LIGHT_MAX, + selection_box = colbox_type1, + collision_box = colbox_type1, + sounds = default.node_sound_stone_defaults(), + }) -minetest.register_node('mylandscaping:deco_column_light_'..col, { - description = coldesc..'lighted column', - drawtype = 'mesh', - mesh = 'mylandscaping_deco_column_l.obj', - tiles = { - {name='mylandscaping_block_split.png'..alpha}, - {name='mylandscaping_block_smooth.png'..alpha}, - {name='mylandscaping_block_smooth.png^[colorize:yellow:255'}, - {name='mylandscaping_block_smooth.png^[colorize:#190B07:200'}}, - groups = grup, - paramtype = 'light', - paramtype2 = 'facedir', - light_source = LIGHT_MAX, - selection_box = colbox_type1, - collision_box = colbox_type1, - sounds = default.node_sound_stone_defaults(), -}) - -minetest.register_craft({ - type = 'shapeless', - output = 'mylandscaping:deco_column_light_'..col, - recipe = {'default:torch', 'mylandscaping:deco_column_'..col} -}) + minetest.register_craft({ + type = 'shapeless', + output = 'mylandscaping:deco_column_light_'..col, + recipe = {'default:torch', 'mylandscaping:deco_column_'..col} + }) -end + end end diff --git a/walls_freeport.lua b/walls_freeport.lua index 2f74110..3563729 100644 --- a/walls_freeport.lua +++ b/walls_freeport.lua @@ -1,44 +1,44 @@ local colbox_type1 = { --top blocks - type = "fixed", + type = 'fixed', fixed = {{-.49, -.5, 0.05, .5, .5, .52}} } local colbox_type2 = { --columns - type = "fixed", + type = 'fixed', fixed = {{-.2, -.5, -.2, .5, .5, .5}} } local colbox_type3 = { --bottom blocks - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.16, .5, .5, .25}} } local colbox_type4 = { --corner - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, 0, .5, .5, .5}, {0, -.5, -.5, .5, .5, .5}} } local colbox_type5 = { --corner - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.5, .5, .5, .5},} } local colbox_type6 = { --corner - type = "fixed", + type = 'fixed', fixed = {{-.5, -.5, -.3, .5, .5, .5},} } local block_type1 = { -- desc2, typ, obj, colbox, drops, grup -{"Retaining Wall Left", "left", "blockf_l_t", colbox_type1, "left", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Middle", "middle", "blockf_m_t", colbox_type1, "middle", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Right", "right", "blockf_r_t", colbox_type1, "right", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Corner", "corner", "blockf_c_t", colbox_type4, "corner", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Left Bot", "bleft", "blockf_l_b", colbox_type3, "left", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Middle Bot", "bmiddle", "blockf_m_b", colbox_type3, "middle", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Right Bot", "bright", "blockf_r_b", colbox_type3, "right", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Corner Bot", "bcorner", "blockf_c_b", colbox_type4, "corner", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Inside Corner", "column_ic_t", "columnf_ic_t", colbox_type5, "column_ic_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Outside Corner", "column_oc_t", "columnf_oc_t", colbox_type2, "column_oc_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Middle", "column_m_t", "columnf_m_t", colbox_type6, "column_m_t", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Column Inside Corner Bot", "bcolumn_ic_t", "columnf_ic_b", colbox_type5, "column_ic_b", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Outside Corner Bot", "bcolumn_oc_t", "columnf_oc_b", colbox_type2, "column_oc_b", {not_in_creative_inventory=mylandscaping_visible}}, -{"Column Middle Bot", "bcolumn_m_t", "columnf_m_b", colbox_type6, "column_m_b", {not_in_creative_inventory=mylandscaping_visible}}, +{'Freeport Left', 'left', 'blockf_l_t', colbox_type1, 'left', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Freeport Middle', 'middle', 'blockf_m_t', colbox_type1, 'middle', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Freeport Right', 'right', 'blockf_r_t', colbox_type1, 'right', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Freeport Inside Corner', 'corner', 'blockf_c_t', colbox_type4, 'corner', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bleft', 'blockf_l_b', colbox_type3, 'left', {not_in_creative_inventory=1}}, +{'Hax0r', 'bmiddle', 'blockf_m_b', colbox_type3, 'middle', {not_in_creative_inventory=1}}, +{'Hax0r', 'bright', 'blockf_r_b', colbox_type3, 'right', {not_in_creative_inventory=1}}, +{'Hax0r', 'bcorner', 'blockf_c_b', colbox_type4, 'corner', {not_in_creative_inventory=1}}, +{'Freeport Column (IC)', 'column_ic_t', 'columnf_ic_t', colbox_type5, 'column_ic_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Freeport Column (OC)', 'column_oc_t', 'columnf_oc_t', colbox_type2, 'column_oc_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Freeport Column (M)', 'column_m_t', 'columnf_m_t', colbox_type6, 'column_m_t', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bcolumn_ic_t', 'columnf_ic_b', colbox_type5, 'column_ic_b', {not_in_creative_inventory=1}}, +{'Hax0r', 'bcolumn_oc_t', 'columnf_oc_b', colbox_type2, 'column_oc_b', {not_in_creative_inventory=1}}, +{'Hax0r', 'bcolumn_m_t', 'columnf_m_b', colbox_type6, 'column_m_b', {not_in_creative_inventory=1}}, } for i in ipairs (block_type1) do local desc2 = block_type1[i][1] @@ -47,65 +47,61 @@ for i in ipairs (block_type1) do local colbox = block_type1[i][4] local drops = block_type1[i][5] local grup = block_type1[i][6] + local color_tab = { + {'black', 'Black', '^[colorize:black:150'}, + {'blue', 'Blue', '^[colorize:#0404B4:100'}, + {'brown', 'Brown', '^[colorize:#190B07:100'}, + {'cyan', 'Cyan', '^[colorize:cyan:100'}, + {'dark_green', 'Dark Green', '^[colorize:#071907:150'}, + {'dark_grey', 'Dark Grey', '^[colorize:black:150'}, + {'green', 'Green', '^[colorize:green:100'}, + {'grey', 'Grey', '^[colorize:black:100'}, + {'magenta', 'Magenta', '^[colorize:magenta:100'}, + {'orange', 'Orange', '^[colorize:orange:100'}, + {'pink', 'Pink', '^[colorize:#FE2E9A:100'}, + {'red', 'Red', '^[colorize:#B40404:100'}, + {'violet', 'Violet', '^[colorize:#2F0B3A:100'}, + {'white', 'White', '^[colorize:white:100'}, + {'yellow', 'Yellow', '^[colorize:yellow:100'}, + {'cement', 'Concrete', ''}, + } + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] + minetest.register_node('mylandscaping:fwall_'..typ..'_'..col, { + description = desc2..' '..coldesc, + drawtype = 'mesh', + mesh = 'mylandscaping_'..obj..'.obj', + tiles = {{name='mylandscaping_block_smooth.png'..alpha}, {name='mylandscaping_block_split.png'..alpha}}, + groups = grup, + paramtype = 'light', + paramtype2 = 'facedir', + drop = 'mylandscaping:fwall_'..drops..'_'..col, + selection_box = colbox, + collision_box = colbox, + sounds = default.node_sound_stone_defaults(), -minetest.register_node('mylandscaping:fwall_'..typ.."_"..col, { - description = desc2.." "..coldesc, - drawtype = 'mesh', - mesh = 'mylandscaping_'..obj..'.obj', - tiles = {{name='mylandscaping_block_smooth.png'..alpha}, {name='mylandscaping_block_split.png'..alpha}}, - groups = grup, - paramtype = 'light', - paramtype2 = 'facedir', - drop = 'mylandscaping:fwall_'..drops.."_"..col, - selection_box = colbox, - collision_box = colbox, - sounds = default.node_sound_stone_defaults(), + after_place_node = function(pos, placer, itemstack) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) + if nodeu.name == 'mylandscaping:fwall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:fwall_'..typ..'_'..col,param2=nodeu.param2}) + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:fwall_b'..typ..'_'..col,param2=nodeu.param2}) + end + if nodea.name == 'mylandscaping:fwall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:fwall_b'..typ..'_'..col,param2=nodea.param2}) + end + end, -after_place_node = function(pos, placer, itemstack) - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - if nodeu.name == "mylandscaping:fwall_"..typ.."_"..col then - minetest.set_node(pos,{name="mylandscaping:fwall_"..typ.."_"..col,param2=nodeu.param2}) - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:fwall_b"..typ.."_"..col,param2=nodeu.param2}) - end - if nodea.name == "mylandscaping:fwall_"..typ..'_'..col then - minetest.set_node(pos,{name="mylandscaping:fwall_b"..typ.."_"..col,param2=nodea.param2}) - end -end, - -after_destruct = function(pos, oldnode) - local node = minetest.get_node(pos) - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - if nodeu.name == "mylandscaping:fwall_b"..typ.."_"..col then - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:fwall_"..typ.."_"..col,param2=node.param2}) - end -end, - -}) + after_destruct = function(pos, oldnode) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + if nodeu.name == 'mylandscaping:fwall_b'..typ..'_'..col then + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:fwall_'..typ..'_'..col,param2=nodeu.param2}) + end + end, -end + }) + end end diff --git a/walls_madison.lua b/walls_madison.lua index 205e4f2..cfbb392 100644 --- a/walls_madison.lua +++ b/walls_madison.lua @@ -1,37 +1,37 @@ local colbox_type1 = { --top blocks - type = "fixed", + type = 'fixed', fixed = {-.5, -.5, -.2, .5, .5, .5} } local colbox_type2 = { --bottom blocks - type = "fixed", + type = 'fixed', fixed = {-.5, -.5, -.2, .5, .5, .5} } local colbox_type3 = { --top inside corner - type = "fixed", + type = 'fixed', fixed = {{-.2, -.5, -.5, .5, .5, .5}, {-.5, -.5, -.2, .5, .5, .5}} } local colbox_type4 = { --bottom inside corner - type = "fixed", + type = 'fixed', fixed = {{-.2, -.5, -.5, .5, .5, .5}, {-.5, -.5, -.2, .5, .5, .5}} } local colbox_type5 = { --top outside corner - type = "fixed", + type = 'fixed', fixed = {-.2, -.5, -.2, .5, .5, .5} } local colbox_type6 = { --bottom outside corner - type = "fixed", + type = 'fixed', fixed = {-.2, -.5, -.2, .5, .5, .5} } local block_type1 = { -- desc2, typ, obj, colbox, drops, grup -{"Retaining Wall Middle", "middle", "blockm_m_t", colbox_type1, "middle", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Middle Bot", "bmiddle", "blockm_m_b", colbox_type2, "middle", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Inside Corner", "icorner", "blockm_ic_t", colbox_type3, "icorner", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Inside Corner Bot", "bicorner", "blockm_ic_b", colbox_type4, "icorner", {not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Outside Corner", "ocorner", "blockm_oc_t", colbox_type5, "ocorner", {ml=1,cracky=2,not_in_creative_inventory=mylandscaping_visible}}, -{"Retaining Wall Outside Corner Bot", "bocorner", "blockm_oc_b", colbox_type6, "ocorner", {not_in_creative_inventory=mylandscaping_visible}}, +{'Madison Middle', 'middle', 'blockm_m_t', colbox_type1, 'middle', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bmiddle', 'blockm_m_b', colbox_type2, 'middle', {not_in_creative_inventory=1}}, +{'Madison Inside Corner', 'icorner', 'blockm_ic_t', colbox_type3, 'icorner', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bicorner', 'blockm_ic_b', colbox_type4, 'icorner', {not_in_creative_inventory=1}}, +{'Madison Outside Corner', 'ocorner', 'blockm_oc_t', colbox_type5, 'ocorner', {ml=1,cracky=2,not_in_creative_inventory=ml_visible}}, +{'Hax0r', 'bocorner', 'blockm_oc_b', colbox_type6, 'ocorner', {not_in_creative_inventory=1}}, } for i in ipairs (block_type1) do @@ -41,65 +41,60 @@ for i in ipairs (block_type1) do local colbox = block_type1[i][4] local drops = block_type1[i][5] local grup = block_type1[i][6] + local color_tab = { + {'black', 'Black', '^[colorize:black:150'}, + {'blue', 'Blue', '^[colorize:#0404B4:100'}, + {'brown', 'Brown', '^[colorize:#190B07:100'}, + {'cyan', 'Cyan', '^[colorize:cyan:100'}, + {'dark_green', 'Dark Green', '^[colorize:#071907:150'}, + {'dark_grey', 'Dark Grey', '^[colorize:black:150'}, + {'green', 'Green', '^[colorize:green:100'}, + {'grey', 'Grey', '^[colorize:black:100'}, + {'magenta', 'Magenta', '^[colorize:magenta:100'}, + {'orange', 'Orange', '^[colorize:orange:100'}, + {'pink', 'Pink', '^[colorize:#FE2E9A:100'}, + {'red', 'Red', '^[colorize:#B40404:100'}, + {'violet', 'Violet', '^[colorize:#2F0B3A:100'}, + {'white', 'White', '^[colorize:white:100'}, + {'yellow', 'Yellow', '^[colorize:yellow:100'}, + {'cement', 'Concrete', ''}, + } + for i in ipairs (color_tab) do + local col = color_tab[i][1] + local coldesc = color_tab[i][2] + local alpha = color_tab[i][3] -local color_tab = { -{"black", "Black", "^[colorize:black:150"}, -{"blue", "Blue", "^[colorize:#0404B4:100"}, -{"brown", "Brown", "^[colorize:#190B07:100"}, -{"cyan", "Cyan", "^[colorize:cyan:100"}, -{"dark_green", "Dark Green", "^[colorize:#071907:150"}, -{"dark_grey", "Dark Grey", "^[colorize:black:150"}, -{"green", "Green", "^[colorize:green:100"}, -{"grey", "Grey", "^[colorize:black:100"}, -{"magenta", "Magenta", "^[colorize:magenta:100"}, -{"orange", "Orange", "^[colorize:orange:100"}, -{"pink", "Pink", "^[colorize:#FE2E9A:100"}, -{"red", "Red", "^[colorize:#B40404:100"}, -{"violet", "Violet", "^[colorize:#2F0B3A:100"}, -{"white", "White", "^[colorize:white:100"}, -{"yellow", "Yellow", "^[colorize:yellow:100"}, -{"cement", "Concrete", ""}, -} -for i in ipairs (color_tab) do -local col = color_tab[i][1] -local coldesc = color_tab[i][2] -local alpha = color_tab[i][3] + minetest.register_node('mylandscaping:mwall_'..typ..'_'..col, { + description = desc2..' '..coldesc, + drawtype = 'mesh', + mesh = 'mylandscaping_'..obj..'.obj', + tiles = {{name='mylandscaping_madison_wood.png'}, {name='mylandscaping_madison_stone.png'..alpha}}, + groups = grup, + paramtype = 'light', + paramtype2 = 'facedir', + drop = 'mylandscaping:mwall_'..drops..'_'..col, + selection_box = colbox, + collision_box = colbox, + sounds = default.node_sound_stone_defaults(), -minetest.register_node('mylandscaping:mwall_'..typ.."_"..col, { - description = desc2.." "..coldesc, - drawtype = 'mesh', - mesh = 'mylandscaping_'..obj..'.obj', - tiles = {{name='mylandscaping_madison_wood.png'}, {name='mylandscaping_madison_stone.png'..alpha}}, - groups = grup, - paramtype = 'light', - paramtype2 = 'facedir', - drop = 'mylandscaping:mwall_'..drops.."_"..col, - selection_box = colbox, - collision_box = colbox, - sounds = default.node_sound_stone_defaults(), - -after_place_node = function(pos, placer, itemstack, pointed_thing) - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - if nodeu.name == "mylandscaping:mwall_"..typ.."_"..col then - minetest.set_node(pos,{name="mylandscaping:mwall_"..typ.."_"..col,param2=nodeu.param2}) - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:mwall_b"..typ.."_"..col,param2=nodeu.param2}) - end - if nodea.name == "mylandscaping:mwall_"..typ..col then - minetest.set_node(pos,{name="mylandscaping:mwall_b"..typ.."_"..col,param2=nodea.param2}) - end -end, - -after_destruct = function(pos, oldnode) - local node = minetest.get_node(pos) - local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) - local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) - if nodeu.name == "mylandscaping:mwall_b"..typ.."_"..col then - minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:mwall_"..typ.."_"..col,param2=node.param2}) - end -end, - -}) + after_place_node = function(pos, placer, itemstack, pointed_thing) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) + if nodeu.name == 'mylandscaping:mwall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:mwall_'..typ..'_'..col,param2=nodeu.param2}) + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:mwall_b'..typ..'_'..col,param2=nodeu.param2}) + end + if nodea.name == 'mylandscaping:mwall_'..typ..'_'..col then + minetest.swap_node(pos,{name='mylandscaping:mwall_b'..typ..'_'..col,param2=nodea.param2}) + end + end, -end + after_destruct = function(pos, oldnode) + local nodeu = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + if nodeu.name == 'mylandscaping:mwall_b'..typ..'_'..col then + minetest.swap_node({x=pos.x,y=pos.y-1,z=pos.z},{name='mylandscaping:mwall_'..typ..'_'..col,param2=nodeu.param2}) + end + end, + }) + end end