mirror of
https://github.com/BenjieFiftysix/sponge.git
synced 2024-10-04 00:33:05 +02:00
fixed placing bugs
Could not open chest while holding a sponge, would not replace replaceable nodes and would take an item in creative mode.
This commit is contained in:
parent
8c85bcd1f6
commit
0db129e3de
14
init.lua
14
init.lua
@ -51,8 +51,7 @@ minetest.register_node("sponge:sponge", { -- dry sponge
|
|||||||
groups = {crumbly=3},
|
groups = {crumbly=3},
|
||||||
sounds = default.node_sound_dirt_defaults(),
|
sounds = default.node_sound_dirt_defaults(),
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||||
local pos = minetest.get_pointed_thing_position(pointed_thing, pointed_thing.above)
|
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
|
|
||||||
if not minetest.is_protected(pos, name) then
|
if not minetest.is_protected(pos, name) then
|
||||||
@ -74,19 +73,14 @@ minetest.register_node("sponge:sponge", { -- dry sponge
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if count > 3 then -- turns soggy if it removed more than 3 nodes
|
||||||
if count > 3 then -- only turns soggy if it removed more than 3 nodes
|
|
||||||
minetest.set_node(pos, {name="sponge:soggy_sponge"})
|
minetest.set_node(pos, {name="sponge:soggy_sponge"})
|
||||||
else
|
|
||||||
minetest.set_node(pos, {name="sponge:sponge"})
|
|
||||||
end
|
end
|
||||||
itemstack:take_item(1)
|
|
||||||
end
|
end
|
||||||
return itemstack
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = destruct
|
after_dig_node = destruct
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user