mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-12-23 04:42:23 +01:00
Don't need player parameter for can_write_layout_image any more
This commit is contained in:
parent
eaae4276fc
commit
8952c55914
@ -38,7 +38,7 @@ minetest.register_node("digtron:axle", {
|
|||||||
end
|
end
|
||||||
local image = digtron.get_layout_image(pos, clicker)
|
local image = digtron.get_layout_image(pos, clicker)
|
||||||
digtron.rotate_layout_image(image, node.param2)
|
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)
|
digtron.write_layout_image(image)
|
||||||
|
|
||||||
minetest.sound_play("whirr", {gain=1.0, pos=pos})
|
minetest.sound_play("whirr", {gain=1.0, pos=pos})
|
||||||
|
@ -172,12 +172,14 @@ digtron.move_layout_image = function(layout_image, facing, player_name)
|
|||||||
end
|
end
|
||||||
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
|
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)
|
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
|
and not minetest.registered_nodes[minetest.get_node(node_image.pos).name].buildable_to then
|
||||||
return false
|
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
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user