Fix movecontroller wrench menu bug

This commit is contained in:
Joachim Stolberg 2022-12-11 09:49:00 +01:00
parent b9072c7940
commit d78004cef3
2 changed files with 15 additions and 2 deletions

View File

@ -339,6 +339,19 @@ function techage.not_protected(number, placer_name, clicker_name)
return false return false
end 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. -- Check the given list of numbers.
-- Returns true if number(s) is/are valid, point to real nodes and -- Returns true if number(s) is/are valid, point to real nodes and
-- and the nodes are not protected for the given player_name. -- and the nodes are not protected for the given player_name.

View File

@ -40,7 +40,7 @@ local WRENCH_MENU = {
label = S("Handover to B"), label = S("Handover to B"),
tooltip = S("Number of the next movecontroller"), tooltip = S("Number of the next movecontroller"),
default = "", default = "",
check = techage.check_numbers, check = techage.check_number,
}, },
{ {
type = "number", type = "number",
@ -48,7 +48,7 @@ local WRENCH_MENU = {
label = S("Handover to A"), label = S("Handover to A"),
tooltip = S("Number of the previous movecontroller"), tooltip = S("Number of the previous movecontroller"),
default = "", default = "",
check = techage.check_numbers, check = techage.check_number,
}, },
{ {
type = "float", type = "float",