mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
Fixed sand replacing non-buildable-to nodes on place
This commit is contained in:
parent
cde238efac
commit
09ef071c81
@ -273,6 +273,30 @@ minetest.register_abm({
|
||||
end
|
||||
})
|
||||
|
||||
local function sand_on_place(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
local pn = placer:get_player_name()
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
local node = minetest.get_node(pointed_thing.above)
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if def and def.buildable_to then
|
||||
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
meta:set_string("owner", pn)
|
||||
nodeupdate(pointed_thing.above)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
else
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_node("default:sand", {
|
||||
description = "Sand",
|
||||
tiles = {"default_sand.png"},
|
||||
@ -284,23 +308,7 @@ minetest.register_node("default:sand", {
|
||||
},
|
||||
groups = {crumbly = 3, falling_node = 1, sand = 1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
local pn = placer:get_player_name()
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
meta:set_string("owner", pn)
|
||||
nodeupdate(pointed_thing.above)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
on_place = sand_on_place
|
||||
})
|
||||
|
||||
minetest.register_node("default:desert_sand", {
|
||||
@ -314,23 +322,7 @@ minetest.register_node("default:desert_sand", {
|
||||
},
|
||||
groups = {crumbly = 3, falling_node = 1, sand = 1},
|
||||
sounds = default.node_sound_sand_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
local pn = placer:get_player_name()
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
meta:set_string("owner", pn)
|
||||
nodeupdate(pointed_thing.above)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
on_place = sand_on_place
|
||||
})
|
||||
|
||||
minetest.register_node("default:gravel", {
|
||||
@ -344,23 +336,7 @@ minetest.register_node("default:gravel", {
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_gravel_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if not pointed_thing.type == "node" then
|
||||
return itemstack
|
||||
end
|
||||
local pn = placer:get_player_name()
|
||||
if minetest.is_protected(pointed_thing.above, pn) then
|
||||
return itemstack
|
||||
end
|
||||
minetest.add_node(pointed_thing.above, {name=itemstack:get_name()})
|
||||
local meta = minetest.get_meta(pointed_thing.above)
|
||||
meta:set_string("owner", pn)
|
||||
nodeupdate(pointed_thing.above)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return itemstack
|
||||
end
|
||||
on_place = sand_on_place
|
||||
})
|
||||
|
||||
minetest.register_node("default:sandstone", {
|
||||
|
Loading…
Reference in New Issue
Block a user