From 47c391c6793e8c2b5154e92490fe76adcd853da3 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 26 Apr 2022 22:35:28 +0200 Subject: [PATCH] Fix bug with unconfigured turncontroller --- move_controller/turncontroller.lua | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/move_controller/turncontroller.lua b/move_controller/turncontroller.lua index a41fedf..effcddc 100644 --- a/move_controller/turncontroller.lua +++ b/move_controller/turncontroller.lua @@ -83,20 +83,24 @@ minetest.register_node("techage:ta4_turncontroller", { meta:set_string("formspec", formspec(nvm, meta)) elseif fields.left then meta:set_string("status", "") - local new_posses = fly.rotate_nodes(pos, nvm.lpos, "l") - if new_posses then - nvm.lpos = new_posses - local name = player:get_player_name() - mark.stop(name) + if nvm.lpos then + local new_posses = fly.rotate_nodes(pos, nvm.lpos, "l") + if new_posses then + nvm.lpos = new_posses + local name = player:get_player_name() + mark.stop(name) + end end meta:set_string("formspec", formspec(nvm, meta)) elseif fields.right then meta:set_string("status", "") - local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") - if new_posses then - nvm.lpos = new_posses - local name = player:get_player_name() - mark.stop(name) + if nvm.lpos then + local new_posses = fly.rotate_nodes(pos, nvm.lpos, "r") + if new_posses then + nvm.lpos = new_posses + local name = player:get_player_name() + mark.stop(name) + end end meta:set_string("formspec", formspec(nvm, meta)) end