[nalc_flowers] Corrige callback on_place du lily_pad

This commit is contained in:
Sys Quatre 2020-07-15 01:33:32 +02:00
parent 98968a54cd
commit 61176e5bf0
1 changed files with 17 additions and 17 deletions

View File

@ -4,24 +4,24 @@ lilypad_def.tiles = {"flowers_lily_pad.png"}
lilypad_def.inventory_image = "flowers_lily_pad.png" lilypad_def.inventory_image = "flowers_lily_pad.png"
lilypad_def.wield_image = "flowers_lily_pad.png" lilypad_def.wield_image = "flowers_lily_pad.png"
lilypad_def.on_place = function(itemstack, placer, pointed_thing) lilypad_def.on_place = function(itemstack, placer, pointed_thing)
local pos = pointed_thing.above local pos = pointed_thing.above
local node = minetest.get_node(pointed_thing.under) local node = minetest.get_node(pointed_thing.under)
local def = minetest.registered_nodes[node.name] local def = minetest.registered_nodes[node.name]
if def and def.on_rightclick then if def then
return def.on_rightclick(pointed_thing.under, node, placer, itemstack, if def.on_rightclick then
pointed_thing) def.on_rightclick(pointed_thing.under, node, placer, itemstack, pointed_thing)
end elseif def.liquidtype == "source" and
if def and def.liquidtype == "source" and
minetest.get_item_group(node.name, "water") > 0 then minetest.get_item_group(node.name, "water") > 0 then
local player_name = placer and placer:get_player_name() or "" local player_name = placer and placer:get_player_name() or ""
if not minetest.is_protected(pos, player_name) then if not minetest.is_protected(pos, player_name) then
minetest.set_node(pos, {name = "nalc_flowers:lily_pad" .. minetest.set_node(
(def.waving == 3 and "_waving" or ""), pos, {
param2 = math.random(0, 3)}) name = "nalc_flowers:lily_pad" ..(def.waving == 3 and "_waving" or ""),
if not (creative and creative.is_enabled_for param2 = math.random(0, 3)
and creative.is_enabled_for(player_name)) then })
if not (creative and creative.is_enabled_for and
creative.is_enabled_for(player_name)) then
itemstack:take_item() itemstack:take_item()
end end
else else
@ -29,8 +29,8 @@ lilypad_def.on_place = function(itemstack, placer, pointed_thing)
minetest.record_protection_violation(pos, player_name) minetest.record_protection_violation(pos, player_name)
end end
end end
end
return itemstack return itemstack
end end
local lilypad_waving_def = table.copy(lilypad_def) local lilypad_waving_def = table.copy(lilypad_def)