Added dig protection and a few other funtions

master
DonBatman 2015-04-27 16:18:04 -07:00
parent a0bd99ce7d
commit 98bf7094db
7 changed files with 49 additions and 7 deletions

View File

@ -32,6 +32,24 @@ minetest.register_node('mylandscaping:machine', {
{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 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;]"..

View File

@ -15,17 +15,17 @@ minetest.register_node("mylandscaping:stone_"..style,{
tiles = {
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png",
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
"mylandscaping_"..img1..".png^mylandscaping_"..img2..".png",
},
paramtype = "light",
groups = {cracky = 2},
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.125, 0.5},
{-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
}
},
@ -38,6 +38,7 @@ minetest.register_node("mylandscaping:stone_"..style,{
minetest.set_node(pos,{name = "air"})
end
end,
})
minetest.register_node("mylandscaping:stone_"..style.."_sand",{
description = desc.." Patio Stone in Sand",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 633 B

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

After

Width:  |  Height:  |  Size: 255 B

View File

@ -60,11 +60,34 @@ minetest.register_node('mylandscaping:rwall_'..typ..mat, {
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)
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 == "mylandscaping:rwall_"..typ..mat or
nodeu == "mylandscaping:rwall_b"..typ..mat then
minetest.set_node(pos,{name="mylandscaping:rwall_"..typ..mat,param2=node.param2})
end
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
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=node.param2})
end
end,
})
end