Added Nodes and Machine

master
DonBatman 2015-04-27 10:31:29 -07:00
parent 03cf010c82
commit a0bd99ce7d
17 changed files with 329 additions and 18 deletions

10
concrete.lua Normal file
View File

@ -0,0 +1,10 @@
minetest.register_node("mylandscaping:concrete", {
description = "Concrete",
drawtype = "normal",
tiles = {"mylandscaping_cement.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=1},
-- sounds = default.node_sound_stone_defaults(),
})

View File

@ -1,4 +1,6 @@
--Load File
dofile(minetest.get_modpath('mylandscaping')..'/walls.lua')
dofile(minetest.get_modpath('mylandscaping')..'/stones.lua')
dofile(minetest.get_modpath('mylandscaping')..'/concrete.lua')
dofile(minetest.get_modpath('mylandscaping')..'/machine.lua')

View File

@ -1,3 +1,12 @@
local material = {}
local block = {}
local make_ok = {}
local anzahl = {}
local material2 = {}
local stone = {}
local make_ok2 = {}
local anzahl2 = {}
minetest.register_node('mylandscaping:machine', {
description = 'landscaping machine',
drawtype = 'mesh',
@ -23,4 +32,181 @@ minetest.register_node('mylandscaping:machine', {
{1.1, -0.5, -0.1, 1.5, -0.3, 0.5}
}
},
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("formspec", "invsize[10,10;]"..
"background[-0.15,-0.25;10.40,10.75;mylandscaping_background.png]"..
"label[1.5,0.5;Retaining Wall]"..
--Styles of blocks
"image_button[1,1.5;1,1;mylandscaping_wall1.png;wall1; ]"..
"image_button[2,1.5;1,1;mylandscaping_wall2.png;wall2; ]"..
"image_button[3,1.5;1,1;mylandscaping_wall3.png;wall3; ]"..
"image_button[1.5,2.5;1,1;mylandscaping_wall4.png;wall4; ]"..
"image_button[2.5,2.5;1,1;mylandscaping_wall5.png;column; ]"..
"label[6.5,0.5;Patio Stones]"..
--Styles of blocks
"image_button[6,1.5;1,1;mylandscaping_square.png;patio1; ]"..
"image_button[7,1.5;1,1;mylandscaping_square_sm.png;patio2; ]"..
"image_button[8,1.5;1,1;mylandscaping_pavers.png;patio3; ]"..
--Input
"label[3,4; Input]"..
"list[current_name;input;3,4.5;1,1;]"..
--Output
"label[6,4;Output]"..
"list[current_name;output;6,4.5;1,1;]"..
--Players Inven
"list[current_player;main;1,6;8,4;]")
meta:set_string("infotext", "Concrete Mixer")
local inv = meta:get_inventory()
inv:set_size("input", 1)
inv:set_size("output", 1)
end,
on_receive_fields = function(pos, formname, fields, sender)
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
if fields["wall1"]
or fields["wall2"]
or fields["wall3"]
or fields["wall4"]
or fields["column"]
then
if fields["wall1"] then
make_ok = "0"
anzahl = "2"
block = "mylandscaping:rwall_left"
if inv:is_empty("input") then
return
end
end
if fields["wall2"] then
make_ok = "0"
anzahl = "2"
block = "mylandscaping:rwall_middle"
if inv:is_empty("input") then
return
end
end
if fields["wall3"] then
make_ok = "0"
anzahl = "2"
block = "mylandscaping:rwall_right"
if inv:is_empty("input") then
return
end
end
if fields["wall4"] then
make_ok = "0"
anzahl = "2"
block = "mylandscaping:rwall_corner"
if inv:is_empty("input") then
return
end
end
if fields["column"] then
make_ok = "0"
anzahl = "2"
block = "mylandscaping:rwall_column"
if inv:is_empty("input") then
return
end
end
local ingotstack = inv:get_stack("input", 1)
local outstack = inv:get_stack("output", 1)
----------------------------------------------------------------------
----------------------------------------------------------------------
if ingotstack:get_name()== "mylandscaping:concrete" then
material = "cement"
make_ok = "1"
end
if ingotstack:get_name()== "default:wood" then
material = "wood"
make_ok = "1"
end
----------------------------------------------------------------------
----------------------------------------------------------------------
if make_ok == "1" then
local give = {}
for i = 0, anzahl-1 do
give[i+1]=inv:add_item("output",block..material)
end
ingotstack:take_item()
inv:set_stack("input",1,ingotstack)
end
end
--------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
if fields["patio1"]
or fields["patio2"]
or fields["patio3"]
then
if fields["patio1"] then
make_ok2 = "0"
anzahl2 = "2"
stone = "mylandscaping:stone_square"
if inv:is_empty("input") then
return
end
end
if fields["patio2"] then
make_ok2 = "0"
anzahl2 = "2"
stone = "mylandscaping:stone_square_sm"
if inv:is_empty("input") then
return
end
end
if fields["patio3"] then
make_ok2 = "0"
anzahl2 = "2"
stone = "mylandscaping:stone_pavers"
if inv:is_empty("input") then
return
end
end
local ingotstack = inv:get_stack("input", 1)
local outstack = inv:get_stack("output", 1)
----------------------------------------------------------------------
----------------------------------------------------------------------
if ingotstack:get_name()== "mylandscaping:concrete" then
make_ok2 = "1"
end
----------------------------------------------------------------------
----------------------------------------------------------------------
if make_ok2 == "1" then
local give = {}
for i = 0, anzahl2-1 do
give[i+1]=inv:add_item("output",stone)
end
ingotstack:take_item()
inv:set_stack("input",1,ingotstack)
end
end
end
})

62
stones.lua Normal file
View File

@ -0,0 +1,62 @@
local stone_types = { --style, desc, img1, img2
{"square", "Square", "concrete", "square"},
{"square_sm", "Small Square", "concrete", "square_sm"},
{"pavers", "Paver", "concrete", "pavers"},
}
for i in ipairs (stone_types) do
local style = stone_types[i][1]
local desc = stone_types[i][2]
local img1 = stone_types[i][3]
local img2 = stone_types[i][4]
minetest.register_node("mylandscaping:stone_"..style,{
description = desc.." Patio Stone",
drawtype = "nodebox",
tiles = {
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
},
paramtype = "light",
groups = {cracky = 2},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5},
}
},
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 nodeu == "default:sand" then
minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z},{name = "mylandscaping:stone_"..style.."_sand"})
minetest.set_node(pos,{name = "air"})
end
end,
})
minetest.register_node("mylandscaping:stone_"..style.."_sand",{
description = desc.." Patio Stone in Sand",
drawtype = "normal",
tiles = {
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
},
drop = "mylandscaping:stone"..style,
paramtype = "light",
groups = {cracky = 2, not_in_creative_inventory = 1},
after_dig_node = function(pos, oldnode, oldmetadata, digger)
minetest.set_node(pos,{name = "default:sand"})
end,
})
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 633 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

View File

@ -1,23 +1,74 @@
minetest.register_node('mylandscaping:block1_wall', {
description = 'block 1 wall', --we should probably name the block styles
local colbox_type1 = {
type = "fixed",
fixed = {
{-.5, -.5, -.25, .5, .5, .5}
}
}
local colbox_type2 = {
type = "fixed",
fixed = {
{-.25, -.5, -.25, .5, .5, .5}
}
}
local block_type1 = { -- desc2, typ, obj, colbox, drops
{"Left", "left", "block1_top_l", colbox_type1, ""},
{"Middle", "middle", "block1_top_m", colbox_type1, ""},
{"Right", "right", "block1_top_r", colbox_type1, ""},
{"Corner", "corner", "block1_top_c", colbox_type1, ""},
{"Column Top", "column", "column_upper", colbox_type2, ""},
{"Left Bot", "bleft", "block1_bot_l", colbox_type1, "mylandscaping:rwall_cement_left"},
{"Middle Bot", "bmiddle", "block1_bot_m", colbox_type1, "mylandscaping:rwall_cement_middle"},
{"Right Bot", "bright", "block1_bot_r", colbox_type1, "mylandscaping:rwall_cement_right"},
{"Corner Bot", "bcorner", "block1_bot_c", colbox_type1, "mylandscaping:rwall_cement_corner"},
{"Column Bot", "bcolumn", "column_lower", colbox_type2, "mylandscaping:rwall_cement_column"},
}
for i in ipairs (block_type1) do
local desc2 = block_type1[i][1]
local typ = block_type1[i][2]
local obj = block_type1[i][3]
local colbox = block_type1[i][4]
local drops = block_type1[i][5]
local block_mat = { -- desc1, mat, img
{"Cement", "cement", "mylandscaping_cement"},
{"Wood", "wood", "default_wood"},
}
for i in ipairs (block_mat) do
local desc1 = block_mat[i][1]
local mat = block_mat[i][2]
local img = block_mat[i][3]
minetest.register_node('mylandscaping:rwall_'..typ..mat, {
description = desc1..' Retaining Wall '..desc2,
drawtype = 'mesh',
mesh = 'mylandscaping_block1_bot_c.obj',
tiles = {'mylandscaping_cement.png'},
mesh = 'mylandscaping_'..obj..'.obj',
tiles = {img..'.png'},
groups = {oddly_breakable_by_hand=2},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
type = 'fixed',
fixed = {
{-.5, -.5, -.4, .3, .5, .3}, -- Right, Bottom, Back, Left, Top, Front
{-1., -.5, -.1, -.5, .5, .3}
}
},
collision_box = {
type = 'fixed',
fixed = {
{-.5, -.5, -.4, .3, .5, .3}, -- Right, Bottom, Back, Left, Top, Front
{-1., -.5, -.1, -.5, .5, .3}
}
},
drop = drops,
selection_box = colbox,
collision_box = colbox,
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 node = minetest.get_node(pos)
if nodeu.name == "mylandscaping:rwall_"..typ..mat then
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:rwall_b"..typ..mat,param2=node.param2})
end
end
})
end
end