Skip to content

Commit 7ae983b

Browse files
authoredDec 8, 2020
Don't replace protected liquids with bones (#2790)
1 parent 29866db commit 7ae983b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
 

‎mods/bones/init.lua

+13-4
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,18 @@ local function may_replace(pos, player)
141141
return false
142142
end
143143

144-
-- allow replacing air and liquids
145-
if node_name == "air" or node_definition.liquidtype ~= "none" then
144+
-- allow replacing air
145+
if node_name == "air" then
146+
return true
147+
end
148+
149+
-- don't replace nodes inside protections
150+
if minetest.is_protected(pos, player:get_player_name()) then
151+
return false
152+
end
153+
154+
-- allow replacing liquids
155+
if node_definition.liquidtype ~= "none" then
146156
return true
147157
end
148158

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

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

161170
local drop = function(pos, itemstack)

0 commit comments

Comments
 (0)
Please sign in to comment.