From 6f829b4af11a75db66296a05164441817606ac58 Mon Sep 17 00:00:00 2001 From: BrunoMine Date: Fri, 13 Jul 2018 17:56:07 -0300 Subject: [PATCH] =?UTF-8?q?Adi=C3=A7=C3=A3o=20de=20variaveis=20e=20tradu?= =?UTF-8?q?=C3=A7=C3=B5es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autogen.lua | 24 +++++++++++++----------- balao.lua | 2 +- bau.lua | 2 +- gerar_balao_aleatorio.lua | 6 ++++-- init.lua | 15 +++++++++++++++ interface_jogador.lua | 1 + settingtypes.txt | 22 ++++++++++++++++++++++ 7 files changed, 57 insertions(+), 15 deletions(-) create mode 100644 settingtypes.txt diff --git a/autogen.lua b/autogen.lua index 4ae67eb..3741a1c 100644 --- a/autogen.lua +++ b/autogen.lua @@ -10,15 +10,17 @@ ]] -- Certifica de que jogador tem um balao, caso ainda não tenha cria um -minetest.register_on_joinplayer(function(player) - if not player then return end - - -- Pegar nome do jogador - local name = player:get_player_name() - - -- Verifica se o registro de balao existe no banco de dados - if telepro.bd.verif("jogador_"..name, "pos") == false then - telepro.gerar_balao_aleatorio(name) - end -end) +if telepro.var.autogen == true then + minetest.register_on_joinplayer(function(player) + if not player then return end + + -- Pegar nome do jogador + local name = player:get_player_name() + + -- Verifica se o registro de balao existe no banco de dados + if telepro.bd.verif("jogador_"..name, "pos") == false then + telepro.gerar_balao_aleatorio(name) + end + end) +end diff --git a/balao.lua b/balao.lua index 85549c4..eff2446 100644 --- a/balao.lua +++ b/balao.lua @@ -39,7 +39,7 @@ minetest.register_node("telepro:balao_jogador", { -- Verifica se tem bau ativo minetest.register_abm{ nodenames = {"telepro:balao_jogador"}, - interval = 4, + interval = telepro.var.tempo_verificar_balao, chance = 1, action = function(pos) diff --git a/bau.lua b/bau.lua index 1b6d89f..356623e 100644 --- a/bau.lua +++ b/bau.lua @@ -58,7 +58,7 @@ minetest.register_node("telepro:bau", { -- Atualização constante do balão minetest.register_abm{ nodenames = {"telepro:bau"}, - interval = 5, + interval = telepro.var.tempo_verificar_balao, chance = 1, action = function(pos) diff --git a/gerar_balao_aleatorio.lua b/gerar_balao_aleatorio.lua index efdbe80..161dc77 100644 --- a/gerar_balao_aleatorio.lua +++ b/gerar_balao_aleatorio.lua @@ -74,8 +74,10 @@ local finalizar = function(name, spos) player:setpos({x=pb.x, y=pb.y+1.5, z=pb.z}) -- Travar por 24 horas para impedir ficar gerando em vaios locais - telepro.travados[name] = true - minetest.after(3600, telepro.destravar, name) + if telepro.var.limite_diario == true then + telepro.travados[name] = true + minetest.after(3600, telepro.destravar, name) + end -- Finaliza minetest.chat_send_player(name, S("Novo local encontrado")) diff --git a/init.lua b/init.lua index f314319..6c4b315 100644 --- a/init.lua +++ b/init.lua @@ -32,6 +32,21 @@ if telepro.bd.verif("centro", "pos") == true then telepro.spawn = telepro.bd.pegar("centro", "pos") end +-- Variaveis personalizaveis +telepro.var = {} + +-- Auto geração de balão em jogadores novos +telepro.var.autogen = true +if minetest.settings:get("telepro_autogen") == "false" then telepro.var.autogen = false end + +-- Limitação de uma geração automatica por dia +telepro.var.limite_diario = true +if minetest.settings:get("telepro_daily_limit") == "false" then telepro.var.limite_diario = false end + +-- Tempo de verificação do balao proprio +telepro.var.tempo_verificar_balao = tonumber(minetest.setting_get("telepro_time_check_balloon") or 15) +if telepro.var.tempo_verificar_balao < 5 then telepro.var.tempo_verificar_balao = 5 end + -- Funções dofile(modpath.."/tradutor.lua") dofile(modpath.."/mensagens.lua") diff --git a/interface_jogador.lua b/interface_jogador.lua index a081892..9f8f617 100644 --- a/interface_jogador.lua +++ b/interface_jogador.lua @@ -45,6 +45,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) minetest.chat_send_player(player:get_player_name(), S(telepro.msg.aguardar_gerar_balao)) telepro.gerar_balao_aleatorio(name) + elseif fields.por_balao_aqui then if telepro.travados[name] == true then minetest.chat_send_player(name, S(telepro.msg.limite_de_usos_por_dia)) diff --git a/settingtypes.txt b/settingtypes.txt new file mode 100644 index 0000000..6875b28 --- /dev/null +++ b/settingtypes.txt @@ -0,0 +1,22 @@ +# Configurações aplicaveis para o menu gráfico + +#Gera automaticamente um balao proprio para jogadores +#que ainda nunca geraram +#Automatically generates a balloon for players who +#have never yet generated it +telepro_autogen (Autogerar Balao proprio) bool true + +#Limita a geração de balões proprios em lugares aleatorios do mapa +#Limite de 1 a cada 24 horas +#Limits the generation of own balloons in random places on the map +#Limit of 24 hours for a new generation +telepro_daily_limit (Limite diario para gerar) bool true + +#Tempo entre cada vez que o balão do jogador é verificado +#Time step which balloon is verified +telepro_time_check_balloon (Tempo do iterador de checagem do balao) int 15 5 + + + + +