Skip to content

Commit

Permalink
Don't replace protected liquids with bones (#2790)
Browse files Browse the repository at this point in the history
  • Loading branch information
auouymous committed Dec 8, 2020
1 parent 29866db commit 7ae983b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions mods/bones/init.lua
Expand Up @@ -141,8 +141,18 @@ local function may_replace(pos, player)
return false
end

-- allow replacing air and liquids
if node_name == "air" or node_definition.liquidtype ~= "none" then
-- allow replacing air
if node_name == "air" then
return true
end

-- don't replace nodes inside protections
if minetest.is_protected(pos, player:get_player_name()) then
return false
end

-- allow replacing liquids
if node_definition.liquidtype ~= "none" then
return true
end

Expand All @@ -154,8 +164,7 @@ local function may_replace(pos, player)

-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones?
-- flowers being squished by bones are more realistical than a squished stone, too
-- exception are of course any protected buildable_to
return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name())
return node_definition.buildable_to
end

local drop = function(pos, itemstack)
Expand Down

0 comments on commit 7ae983b

Please sign in to comment.