57 lines
1.6 KiB
Lua
57 lines
1.6 KiB
Lua
--[[
|
|
Mod Telepro para Minetest
|
|
Copyright (C) 2017 BrunoMine (https://github.com/BrunoMine)
|
|
|
|
Recebeste uma cópia da GNU Lesser General
|
|
Public License junto com esse software,
|
|
se não, veja em <http://www.gnu.org/licenses/>.
|
|
|
|
Interface do Jogador
|
|
]]
|
|
|
|
-- Acesar interface do jogador
|
|
telepro.acessar = function(player)
|
|
if not player then
|
|
minetest.log("error", "[Telepro] player == nil (em telepro.acessar)")
|
|
return false
|
|
end
|
|
|
|
-- Cria formspec
|
|
local formspec = "size[3,5]"
|
|
..default.gui_bg
|
|
..default.gui_bg_img
|
|
.."image[0,0;3.5,3.5;telepro_mapa.png]"
|
|
.."button_exit[0,3.25;3,1;gerar_balao;Gerar Balao]"
|
|
.."button_exit[0,4.25;3,1;por_balao_aqui;Por Balao Aqui]"
|
|
|
|
-- Exibir formspec
|
|
minetest.show_formspec(player:get_player_name(), "telepro:jogador", formspec)
|
|
end
|
|
|
|
-- Receber botoes
|
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
|
|
if formname == "telepro:jogador" then
|
|
|
|
if fields.gerar_balao then
|
|
|
|
if telepro.travados[name] == true then
|
|
minetest.chat_send_player(player:get_player_name(), "Nao pode gerar um novo balao ainda. (sao necessarias 24 horas desde a ultima vez que gerou)")
|
|
return
|
|
end
|
|
|
|
minetest.chat_send_player(player:get_player_name(), "Aguarde alguns segundos enquanto o balao esta endo preparado.")
|
|
telepro.gerar_balao_aleatorio(player)
|
|
elseif fields.por_balao_aqui then
|
|
if telepro.travados[name] == true then
|
|
minetest.chat_send_player(player:get_player_name(), "Nao pode colocar um novo balao ainda. (sao necessarias 24 horas desde a ultima vez que gerou ou colocou)")
|
|
return
|
|
end
|
|
|
|
telepro.reivindicar(player)
|
|
end
|
|
|
|
end
|
|
|
|
end)
|