summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFaceDeer <derksenmobile@gmail.com>2017-01-09 01:19:35 -0700
committerFaceDeer <derksenmobile@gmail.com>2017-01-09 01:19:35 -0700
commit8952c55914163d8141bcc3a4ba3c4e5df3153b2e (patch)
tree2cbd2c9950bd18ed5b921d3ff0fe49b46d531d9c
parenteaae4276fcd1ae82ba0fdd39d7901c3cd9513d5f (diff)
Don't need player parameter for can_write_layout_image any more
-rw-r--r--node_axle.lua2
-rw-r--r--util_layout.lua6
2 files changed, 5 insertions, 3 deletions
diff --git a/node_axle.lua b/node_axle.lua
index c30a401..f78b220 100644
--- a/node_axle.lua
+++ b/node_axle.lua
@@ -38,7 +38,7 @@ minetest.register_node("digtron:axle", {
end
local image = digtron.get_layout_image(pos, clicker)
digtron.rotate_layout_image(image, node.param2)
- if digtron.can_write_layout_image(image, clicker) then
+ if digtron.can_write_layout_image(image) then
digtron.write_layout_image(image)
minetest.sound_play("whirr", {gain=1.0, pos=pos})
diff --git a/util_layout.lua b/util_layout.lua
index 292b23f..da5ac6d 100644
--- a/util_layout.lua
+++ b/util_layout.lua
@@ -172,12 +172,14 @@ digtron.move_layout_image = function(layout_image, facing, player_name)
end
end
-digtron.can_write_layout_image = function(layout_image, player)
+digtron.can_write_layout_image = function(layout_image)
for k, node_image in pairs(layout_image.all) do
+ -- check if the target node is buildable_to or is marked as part of the digtron that's moving
if not layout_image.old_pos_pointset:get(node_image.pos.x, node_image.pos.y, node_image.pos.z)
and not minetest.registered_nodes[minetest.get_node(node_image.pos).name].buildable_to then
return false
- elseif minetest.is_protected(node_image.pos, player:get_player_name()) and not minetest.check_player_privs(player, "protection_bypass") then
+ --check if we're moving into a protected node
+ elseif layout_image.protected:get(node_image.pos) then
return false
end
end