mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-04-30 13:11:41 -04:00
Changes on placement checks
This commit is contained in:
parent
1ce48351ea
commit
a6d5468511
1 changed files with 20 additions and 14 deletions
|
@ -45,15 +45,18 @@ for i in ipairs (butter_list) do
|
|||
floodable = true,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local player_name = placer and placer:get_player_name() or ""
|
||||
local pos = pointed_thing.above
|
||||
local apos = pointed_thing.above
|
||||
|
||||
if not minetest.is_protected(pos, player_name) and
|
||||
not minetest.is_protected(pointed_thing.under, player_name) and
|
||||
minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name = "butterflies:butterfly_"..name})
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
itemstack:take_item()
|
||||
if minetest.is_protected(pos, player_name) or minetest.is_protected(pointed_thing.under, player_name) then
|
||||
return
|
||||
end
|
||||
|
||||
local _, sucess = minetest.item_place(itemstack, placer, pointed_thing)
|
||||
|
||||
if sucess then
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
|
@ -78,15 +81,18 @@ for i in ipairs (butter_list) do
|
|||
floodable = true,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local player_name = placer and placer:get_player_name() or ""
|
||||
local pos = pointed_thing.above
|
||||
local apos = pointed_thing.above
|
||||
|
||||
if not minetest.is_protected(pos, player_name) and
|
||||
not minetest.is_protected(pointed_thing.under, player_name) and
|
||||
minetest.get_node(pos).name == "air" then
|
||||
minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name})
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
itemstack:take_item()
|
||||
if minetest.is_protected(pos, player_name) or minetest.is_protected(pointed_thing.under, player_name) then
|
||||
return
|
||||
end
|
||||
|
||||
local _, sucess = minetest.item_place(itemstack, placer, pointed_thing)
|
||||
|
||||
if sucess then
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end,
|
||||
on_timer = function(pos, elapsed)
|
||||
|
|
Loading…
Add table
Reference in a new issue