summaryrefslogtreecommitdiff
path: root/nodes/node_axle.lua
diff options
context:
space:
mode:
Diffstat (limited to 'nodes/node_axle.lua')
-rw-r--r--nodes/node_axle.lua16
1 files changed, 9 insertions, 7 deletions
diff --git a/nodes/node_axle.lua b/nodes/node_axle.lua
index 99dda4b..bdfaf76 100644
--- a/nodes/node_axle.lua
+++ b/nodes/node_axle.lua
@@ -45,13 +45,15 @@ minetest.register_node("digtron:axle", {
local image = DigtronLayout.create(pos, clicker)
image:rotate_layout_image(node.param2)
if image:can_write_layout_image() then
- image:write_layout_image(clicker)
-
- minetest.sound_play("whirr", {gain=1.0, pos=pos})
- meta = minetest.get_meta(pos)
- meta:set_string("waiting", "true")
- meta:set_string("infotext", nil)
- minetest.get_node_timer(pos):start(digtron.config.cycle_time*2)
+ if image:write_layout_image(clicker) then
+ minetest.sound_play("whirr", {gain=1.0, pos=pos})
+ meta = minetest.get_meta(pos)
+ meta:set_string("waiting", "true")
+ meta:set_string("infotext", nil)
+ minetest.get_node_timer(pos):start(digtron.config.cycle_time*2)
+ else
+ meta:set_string("infotext", "unrecoverable write_layout_image error")
+ end
else
minetest.sound_play("buzzer", {gain=1.0, pos=pos})
meta:set_string("infotext", S("Digtron is obstructed."))