diff --git a/basis/command.lua b/basis/command.lua index a7f15db..584adbe 100644 --- a/basis/command.lua +++ b/basis/command.lua @@ -339,6 +339,19 @@ function techage.not_protected(number, placer_name, clicker_name) return false end +-- Check the given number value. +-- Returns true if the number is valid, point to real node and +-- and the node is not protected for the given player_name. +function techage.check_number(number, placer_name) + if number then + if not techage.not_protected(number, placer_name, nil) then + return false + end + return true + end + return false +end + -- Check the given list of numbers. -- Returns true if number(s) is/are valid, point to real nodes and -- and the nodes are not protected for the given player_name. diff --git a/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index be1bb5d..caf29af 100644 --- a/move_controller/movecontroller.lua +++ b/move_controller/movecontroller.lua @@ -40,7 +40,7 @@ local WRENCH_MENU = { label = S("Handover to B"), tooltip = S("Number of the next movecontroller"), default = "", - check = techage.check_numbers, + check = techage.check_number, }, { type = "number", @@ -48,7 +48,7 @@ local WRENCH_MENU = { label = S("Handover to A"), tooltip = S("Number of the previous movecontroller"), default = "", - check = techage.check_numbers, + check = techage.check_number, }, { type = "float",