local command_table = {
{command = "clear"},
{command = "set", width = 10, height = 7},
{command = "addbutton", X = 0.2,Y = 1.3,W = 3,H = 2,name = "btn_cirhe",label = "Часовня"},
{command = "addbutton", X = 0.2,Y = 2.7,W = 3,H = 2,name = "btn_spawn",label = "Спавн"},
{command = "addbutton", X = 0.2,Y = 3.4,W = 3,H = 2,name = "btn_1",label = "Светлячки"},
{command = "addbutton", X = 0.2,Y = 4.1,W = 3,H = 2,name = "btn_island",label = "Острова летающие"},
{command = "addbutton", X = 0.2,Y = 4.8,W = 3,H = 2,name = "btn_ohota",label = "ОХОТА"},
{command = "addbutton", X = 4,Y = 1.3,W = 3,H = 2,name = "btn_planet",label = "ПЛАНЕТА"},
{command = "addbox", X = 7,Y = 6.15,W = 2,H = 1,color = "red"},
{command = "addbutton_exit", X = 0.2,Y = 6,W = 3,H = 2,name = "btn_jump",label = "ПРЫЖОК"}
}
function set_screen_draw(info_text, var_mainship)
table.insert(command_table, {command = "addtextarea", X = 0.3, Y = 0.1,W = 10, H = 2,name = "terminal", label ="Монитор данных", default = info_text})
if var_mainship == true then
table.insert(command_table, {command = "addbutton", X = 0.2,Y = 2,W = 3,H = 2,name = "btn_home",label = "Дом"})
table.insert(command_table, {command = "addcheckbox", X = 7.2,Y = 6,name = "mainship",label = "КОРАБЛЬ",selected = "true"})
table.insert(command_table, {command = "addcheckbox", X = 7.2,Y = 6.5,name = "smallship",label = "ЧЕЛНОК",selected = "false"})
elseif var_mainship == false then
table.insert(command_table, {command = "addbutton", X = 0.2,Y = 2,W = 3,H = 2,name = "s_btn_home",label = "Дом"})
table.insert(command_table, {command = "addcheckbox", X = 7.2,Y = 6,name = "mainship",label = "КОРАБЛЬ",selected = "false"})
table.insert(command_table, {command = "addcheckbox", X = 7.2,Y = 6.5,name = "smallship",label = "ЧЕЛНОК",selected = "true"})
end
digiline_send("touchscreen", command_table)
end
if event.type == "digiline" and event.channel == "jumpdrive" then
if event.msg.powerstorage ~= nil then
init_data = "Энергия: " .. tostring(event.msg.powerstorage) .. "\nТекущая позиция: Х=" .. event.msg.position.x .. ", У=" .. event.msg.position.y .. ", Z=" .. event.msg.position.z .. "\nЦель: Х=" .. event.msg.target.x .. ", У=" .. event.msg.target.y .. ", Z=" .. event.msg.target.z .. "\nРадиус поля захвата: " .. tostring(event.msg.radius) .. "\nДистанция прыжка в метрах: " .. tostring(event.msg.distance) .. "\nЭнергии требуется: " .. tostring(event.msg.power_req)
elseif event.msg.success ~= nil then
init_data = "Результат: " .. tostring(event.msg.success) .. "\nВремя в микросекундах: " .. tostring(event.msg.time)
end
if event.msg.radius == 5 then
set_screen_draw(init_data, true)
else
set_screen_draw(init_data, false)
end
end
if event.type == "program" then
--Рисуем кнопки 1 при программировании контроллера
set_screen_draw("Старт////... Укажите радиус поля захвата...]", true)
elseif event.msg.btn_cirhe then
digiline_send("jumpdrive", {command = "set", x = 193, y = 29, z = 238, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_home then
digiline_send("jumpdrive", {command = "set", x = -769, y = 80, z = 955, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.s_btn_home then
digiline_send("jumpdrive", {command = "set", x = -769, y = 80, z = 959, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_spawn then
digiline_send("jumpdrive", {command = "set", x = 3000, y = 35, z = 300, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_1 then
digiline_send("jumpdrive", {command = "set", x = 2260, y = 25, z = 50, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_island then
digiline_send("jumpdrive", {command = "set", x = -4750, y = 1859, z = 985, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
--set_screen_draw(event.msg.clicker, var_mainship)
elseif event.msg.btn_ohota then
digiline_send("jumpdrive", {command = "set", x = 3434, y = 1850, z = 2323, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_planet then
digiline_send("jumpdrive", {command = "set", x = 9000, y = 9070, z = 4200, formupdate = true })
digiline_send("jumpdrive", {command = "get"})
elseif event.msg.btn_jump then
digiline_send("jumpdrive", {command = "jump"})
elseif event.msg.mainship then
set_screen_draw("Задан радиус 5 - режим главный корабль.", true)
digiline_send("jumpdrive", {command = "set", r = 5, formupdate = true })
elseif event.msg.smallship then
set_screen_draw("Задан радиус 1 - режим спасательный челнок.", false)
digiline_send("jumpdrive", {command = "set", r = 1, formupdate = true })
end