Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update butterflies/init.lua to solve #2987 #3086

Closed
wants to merge 5 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions mods/butterflies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,22 @@ for i in ipairs (butter_list) do
on_place = function(itemstack, placer, pointed_thing)
local player_name = placer:get_player_name()
local pos = pointed_thing.above
local node = minetest.get_node(pointed_thing.under)
JoseDouglas26 marked this conversation as resolved.
Show resolved Hide resolved

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()
not minetest.is_protected(pointed_thing.under, player_name) and
minetest.get_node(pos).name == "air" then
JoseDouglas26 marked this conversation as resolved.
Show resolved Hide resolved
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
JoseDouglas26 marked this conversation as resolved.
Show resolved Hide resolved
if placer and placer:get_player_control().sneak then
minetest.set_node(pos, {name = "butterflies:hidden_butterfly_"..name})
minetest.get_node_timer(pos):start(1)
itemstack:take_item()
else
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack)
JoseDouglas26 marked this conversation as resolved.
Show resolved Hide resolved
end
end
return itemstack
end
return itemstack
JoseDouglas26 marked this conversation as resolved.
Show resolved Hide resolved
end,
on_timer = function(pos, elapsed)
if minetest.get_node_light(pos) >= 11 then
Expand Down
Loading