fixed drops

master
DonBatman 2015-05-06 16:42:56 -07:00
parent e01dca5507
commit 800ec6bd25
4 changed files with 390 additions and 5 deletions

View File

@ -169,21 +169,21 @@ then
local outstack = inv:get_stack("output", 1)
local dyestack = inv:get_stack("dye", 1)
----------------------------------------------------------------------
if instack:get_name()== "myconcrete:concrete" then
if instack:get_name()== "mylandscaping:concrete_bag" then
material = "cement"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
if instack:get_name()== "mylandscaping:concrete_bag" and
dyestack:get_name()== "dye:yellow" then
material = "cement_tan"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
if instack:get_name()== "mylandscaping:concrete_bag" and
dyestack:get_name()== "dye:orange" then
material = "cement_autumn"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
if instack:get_name()== "mylandscaping:concrete_bag" and
dyestack:get_name()== "dye:red" then
material = "cement_red"
make_ok = "1"

257
myconcrete_machine.lua~ Normal file
View File

@ -0,0 +1,257 @@
minetest.register_alias("myconcrete:concrete", "mylandscaping:concrete")
local material = {}
local block = {}
local make_ok = {}
local anzahl = {}
local material2 = {}
local stone = {}
local make_ok2 = {}
local anzahl2 = {}
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}
}
},
can_dig = function(pos,player)
local meta = minetest.env:get_meta(pos);
local inv = meta:get_inventory()
if player:get_player_name() ~= meta:get_string("owner") then
return false
elseif not inv:is_empty("input") then
return false
elseif not inv:is_empty("output") then
return false
end
return true
end,
after_place_node = function(pos, placer, itemstack)
local meta = minetest.env: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.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
"label[1,1;Wall Blocks]"..
"item_image_button[1,1.5;1,1;mylandscaping:rwall_left_cement;wall1; ]"..
"item_image_button[2,1.5;1,1;mylandscaping:rwall_middle_cement;wall2; ]"..
"item_image_button[3,1.5;1,1;mylandscaping:rwall_right_cement;wall3; ]"..
"item_image_button[4,1.5;1,1;mylandscaping:rwall_corner_cement;wall4; ]"..
--Styles of columns
"label[1,2.5;Columns]"..
"item_image_button[1,3;1,1;mylandscaping:rwall_column_m_t_cement;column2; ]"..
"item_image_button[2,3;1,1;mylandscaping:rwall_column_ic_t_cement;column3; ]"..
"item_image_button[3,3;1,1;mylandscaping:rwall_column_oc_t_cement;column4; ]"..
"label[6.5,0.5;Patio Stones]"..
--Styles of blocks
"item_image_button[6,1.5;1,1;mylandscaping:stone_square;patio1; ]"..
"item_image_button[7,1.5;1,1;mylandscaping:stone_square_sm;patio2; ]"..
"item_image_button[8,1.5;1,1;mylandscaping:stone_pavers;patio3; ]"..
--Input
"label[3,4; Input]"..
"list[current_name;input;3,4.5;1,1;]"..
"label[4,4; Dye]"..
"list[current_name;dye;4,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)
inv:set_size("dye", 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"]
or fields["column2"]
or fields["column3"]
or fields["column4"]
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["column2"] then
make_ok = "0"
anzahl = "1"
block = "mylandscaping:rwall_column_m_t_"
if inv:is_empty("input") then
return
end
end
if fields["column3"] then
make_ok = "0"
anzahl = "1"
block = "mylandscaping:rwall_column_ic_t_"
if inv:is_empty("input") then
return
end
end
if fields["column4"] then
make_ok = "0"
anzahl = "1"
block = "mylandscaping:rwall_column_oc_t_"
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()== "myconcrete:concrete" then
material = "cement"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
dyestack:get_name()== "dye:yellow" then
material = "cement_tan"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
dyestack:get_name()== "dye:orange" then
material = "cement_autumn"
make_ok = "1"
end
if instack:get_name()== "myconcrete:concrete" and
dyestack:get_name()== "dye:red" then
material = "cement_red"
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
instack:take_item()
inv:set_stack("input",1,instack)
if dyestack:get_name() == "dye:yellow" or
dyestack:get_name() == "dye:orange" or
dyestack:get_name() == "dye:red" then
dyestack:take_item()
inv:set_stack("dye",1,dyestack)
end
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 instack = inv:get_stack("input", 1)
local outstack = inv:get_stack("output", 1)
----------------------------------------------------------------------
if instack:get_name()== "myconcrete: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
instack:take_item()
inv:set_stack("input",1,instack)
end
end
end
})

View File

@ -87,7 +87,7 @@ minetest.register_node('mylandscaping:rwall_'..typ.."_"..mat, {
groups = grup,
paramtype = 'light',
paramtype2 = 'facedir',
drop = 'mylandscaping:rwall_'..drops..mat,
drop = 'mylandscaping:rwall_'..drops.."_"..mat,
selection_box = colbox,
collision_box = colbox,

128
walls.lua~ Normal file
View File

@ -0,0 +1,128 @@
local colbox_type1 = { --top blocks
type = "fixed",
fixed = {
{-.49, -.5, 0.05, .5, .6, .52}
}
}
local colbox_type2 = { --columns
type = "fixed",
fixed = {
{-.2, -.5, -.2, .5, .5, .5}
}
}
local colbox_type3 = { --bottom blocks
type = "fixed",
fixed = {
{-.5, -.5, -.16, .5, .5, .25}
}
}
local colbox_type4 = { --corner
type = "fixed",
fixed = {
{-.5, -.5, 0, .5, .5, .5},
{0, -.5, -.5, .5, .5, .5}
}
}
local colbox_type5 = { --corner
type = "fixed",
fixed = {
{-.5, -.5, -.5, .5, .5, .5},
}
}
local colbox_type6 = { --corner
type = "fixed",
fixed = {
{-.5, -.5, -.3, .5, .5, .5},
}
}
local block_type1 = { -- desc2, typ, obj, colbox, drops, grup
{"Retaining Wall Left", "left", "block1_l_t", colbox_type1, "left", {cracky=2,not_in_creative_inventory=0}},
{"Retaining Wall Middle", "middle", "block1_m_t", colbox_type1, "middle", {cracky=2,not_in_creative_inventory=0}},
{"Retaining Wall Right", "right", "block1_r_t", colbox_type1, "right", {cracky=2,not_in_creative_inventory=0}},
{"Retaining Wall Corner", "corner", "block1_c_t", colbox_type4, "corner", {cracky=2,not_in_creative_inventory=0}},
{"Retaining Wall Left Bot", "bleft", "block1_l_b", colbox_type3, "left", {not_in_creative_inventory=1}},
{"Retaining Wall Middle Bot", "bmiddle", "block1_m_b", colbox_type3, "middle", {not_in_creative_inventory=1}},
{"Retaining Wall Right Bot", "bright", "block1_r_b", colbox_type3, "right", {not_in_creative_inventory=1}},
{"Retaining Wall Corner Bot", "bcorner", "block1_c_b", colbox_type4, "corner", {not_in_creative_inventory=1}},
{"Column Inside Corner", "column_ic_t", "column_ic_t", colbox_type5, "column_ic_t", {cracky=2,not_in_creative_inventory=0}},
{"Column Outside Corner", "column_oc_t", "column_oc_t", colbox_type2, "column_oc_t", {cracky=2,not_in_creative_inventory=0}},
{"Column Middle", "column_m_t", "column_m_t", colbox_type6, "column_m_t", {cracky=2,not_in_creative_inventory=0}},
{"Column Inside Corner Bot", "bcolumn_ic_t", "column_ic_b", colbox_type5, "column_ic_b", {not_in_creative_inventory=1}},
{"Column Outside Corner Bot","bcolumn_oc_t", "column_oc_b", colbox_type2, "column_oc_b", {not_in_creative_inventory=1}},
{"Column Middle Bot", "bcolumn_m_t", "column_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]
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 grup = block_type1[i][6]
local block_mat = { -- desc1, mat, img, img2, img3
{"Cement", "cement", "mylandscaping_block_top.png","","mylandscaping_block_face.png"},
{"Tan Cement", "cement_tan", "mylandscaping_block_top.png","^[colorize:#967d4d:75", "mylandscaping_block_face.png"},
{"Autumn Cement", "cement_autumn", "mylandscaping_block_top.png","^[colorize:#ffc017:75", "mylandscaping_block_face.png"},
{"Red Cement", "cement_red", "mylandscaping_block_top.png","^[colorize:#800900:75","mylandscaping_block_face.png"},
}
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]
local img2 = block_mat[i][4]
local img3 = block_mat[i][5]
minetest.register_node('mylandscaping:rwall_'..typ.."_"..mat, {
description = desc2,
drawtype = 'mesh',
mesh = 'mylandscaping_'..obj..'.obj',
tiles = {{name=img..img2}, {name=img3..img2}},
groups = grup,
paramtype = 'light',
paramtype2 = 'facedir',
drop = 'mylandscaping:rwall_'..drops..mat,
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 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:rwall_"..typ..mat then
minetest.set_node(pos,{name="mylandscaping:rwall_"..typ..mat,param2=nodeu.param2})
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:rwall_b"..typ.."_"..mat,param2=nodeu.param2})
end
if nodea.name == "mylandscaping:rwall_"..typ..mat then
minetest.set_node(pos,{name="mylandscaping:rwall_b"..typ.."_"..mat,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 nodeu2 = minetest.get_node({x=pos.x,y=pos.y-2,z=pos.z})
local nodea = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
if nodeu.name == "mylandscaping:rwall_b"..typ.."_"..mat and
nodea.name == "air" then
minetest.set_node({x=pos.x,y=pos.y-1,z=pos.z},{name="mylandscaping:rwall_"..typ.."_"..mat,param2=nodeu.param2})
end
end,
})
end
end