ajustes diversos
parent
cabbe5d314
commit
5d3b190ad8
16
API.txt
16
API.txt
|
@ -3,12 +3,9 @@ API taverna_barbara
|
||||||
|
|
||||||
==============> Spawnar criaturas na taverna <==============
|
==============> Spawnar criaturas na taverna <==============
|
||||||
Esse mod pode ser usado para spawnar criaturas/personagens
|
Esse mod pode ser usado para spawnar criaturas/personagens
|
||||||
dentro das tavernas. Todos as tavernas podem ter 3 tipos
|
dentro das tavernas. Todos as tavernas devem ter o carpete
|
||||||
de carpetes:
|
vermelho especifico (itemstring: taverna_barbara:carpete)
|
||||||
*Marrom (macronodes:carpete_marrom)
|
Portanto, o personagem deve poder aparecer no carpete,
|
||||||
*Cinza Escuro (macronodes:carpete_cinzaescuro)
|
|
||||||
*Vermelho (macronodes:carpete_vermelho)
|
|
||||||
Portanto, o personagem deve poder aparecer nos 3 tipos,
|
|
||||||
pois eles sinalizam a area da taverna onde mobs devem
|
pois eles sinalizam a area da taverna onde mobs devem
|
||||||
surgir/spawnar. Compativel com o cme (creatures MOB-Engine)
|
surgir/spawnar. Compativel com o cme (creatures MOB-Engine)
|
||||||
Cuidado pois os mobs podem acabar saindo pela porta e se
|
Cuidado pois os mobs podem acabar saindo pela porta e se
|
||||||
|
@ -20,11 +17,8 @@ definir um comportamento para ele)
|
||||||
=================> Estrutura das tavernas <=================
|
=================> Estrutura das tavernas <=================
|
||||||
Devem ter exatos 12 blocos de cada lado e altura de 15
|
Devem ter exatos 12 blocos de cada lado e altura de 15
|
||||||
blocos.
|
blocos.
|
||||||
Deve conter os carpetes abaixo para definir areas de spawn
|
Deve conter o carpete especifico para tavernas
|
||||||
de personagens para outros mods:
|
(itemstring: taverna_barbara:carpete)
|
||||||
*Marrom (macronodes:carpete_marrom)
|
|
||||||
*Cinza Escuro (macronodes:carpete_cinzaescuro)
|
|
||||||
*Vermelho (macronodes:carpete_vermelho)
|
|
||||||
Usar o bau do trambiqueiro e o piso do barman nos lugares
|
Usar o bau do trambiqueiro e o piso do barman nos lugares
|
||||||
corretos.
|
corretos.
|
||||||
Serializar com o comando auxiliar no arquivo comandos.lua
|
Serializar com o comando auxiliar no arquivo comandos.lua
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
--[[
|
||||||
|
Mod Taverna_Barbara para Minetest
|
||||||
|
Copyright (C) 2018 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/>.
|
||||||
|
|
||||||
|
Carpete
|
||||||
|
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Tradução de strings
|
||||||
|
local S = taverna_barbara.S
|
||||||
|
|
||||||
|
-- Carpete de palha
|
||||||
|
minetest.register_node("taverna_barbara:carpete", {
|
||||||
|
description = S("Carpete de Taverna Barbara"),
|
||||||
|
tiles = {"wool_red.png"},
|
||||||
|
drawtype = "nodebox",
|
||||||
|
paramtype = "light",
|
||||||
|
liquids_pointable = false,
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
drop = {},
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5}
|
||||||
|
},
|
||||||
|
groups = {choppy=2,oddly_breakable_by_hand=3,flammable=1,attached_node=1,fall_damage_add_percent=-5},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
})
|
72
comandos.lua
72
comandos.lua
|
@ -1,72 +0,0 @@
|
||||||
--[[
|
|
||||||
Mod Taverna_Barbara 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/>.
|
|
||||||
|
|
||||||
Comandos
|
|
||||||
|
|
||||||
]]
|
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("taverna_barbara")
|
|
||||||
|
|
||||||
-- Comando de serializar estrutura
|
|
||||||
minetest.register_chatcommand("taverna_barbara", {
|
|
||||||
privs = {server=true},
|
|
||||||
params = "[<s> <numero> | Serializar uma estrutura com sulfixo <numero> || <d> <numero> | Deserializar uma estrutura com sulfixo <numero>]",
|
|
||||||
description = "Serializa e Desarializar uma estrutura",
|
|
||||||
func = function(name, param)
|
|
||||||
local m = string.split(param, " ")
|
|
||||||
local param1, param2 = m[1], m[2]
|
|
||||||
if param1 == "s" then
|
|
||||||
|
|
||||||
if tonumber(param2) then
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local pos = player:getpos()
|
|
||||||
local arquivo = modpath .. "/estruturas/taverna_barbara_"..param2..".mts"
|
|
||||||
minetest.create_schematic(pos, {x=pos.x+11, y=pos.y+14, z=pos.z+11}, {}, arquivo)
|
|
||||||
minetest.chat_send_player(name, "Estrutura de taverna barbara "..param2.." salva com sucesso")
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "Numero de estrutura invalida")
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif param1 == "d" then
|
|
||||||
|
|
||||||
if tonumber(param2) then
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local pos = player:getpos()
|
|
||||||
local arquivo = modpath .. "/estruturas/taverna_barbara_"..param2..".mts"
|
|
||||||
minetest.place_schematic(pos, arquivo, nil, nil, true)
|
|
||||||
minetest.chat_send_player(name, "Estrutura de taverna barbara "..param2.." criada com sucesso")
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "Numero de estrutura invalida")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "Comando invalido")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Comando de deserializar estrutura
|
|
||||||
minetest.register_chatcommand("d", {
|
|
||||||
privs = {server=true},
|
|
||||||
params = "[<arquivo/nome> <largura> <altura>]",
|
|
||||||
description = "Deserializa uma estrutura",
|
|
||||||
func = function(name, param)
|
|
||||||
local m = string.split(param, " ")
|
|
||||||
local param1, param2, param3 = m[1], m[2], m[3]
|
|
||||||
if param1 then
|
|
||||||
local player = minetest.get_player_by_name(name)
|
|
||||||
local pos = player:getpos()
|
|
||||||
if gestor.estruturador.carregar(pos, param1, param2, param3, modpath) then
|
|
||||||
minetest.chat_send_player(name, "Estrutura deserializada com sucesso")
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "Falha ao deserializar estrutura")
|
|
||||||
end
|
|
||||||
else
|
|
||||||
minetest.chat_send_player(name, "Comando invalido")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
|
@ -25,8 +25,9 @@ minetest.register_craftitem("taverna_barbara:cerveja", {
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
hbhunger.register_food("taverna_barbara:cerveja", 4, "macronodes:garrafa_vidro", nil, 2, "taverna_barbara_bebendo_garrafa_de_vidro")
|
if hbhunger then
|
||||||
|
hbhunger.register_food("taverna_barbara:cerveja", 4, "macronodes:garrafa_vidro", nil, 2, "taverna_barbara_bebendo_garrafa_de_vidro")
|
||||||
|
end
|
||||||
|
|
||||||
-- Whisky
|
-- Whisky
|
||||||
minetest.register_craftitem("taverna_barbara:whisky", {
|
minetest.register_craftitem("taverna_barbara:whisky", {
|
||||||
|
@ -43,8 +44,9 @@ minetest.register_craftitem("taverna_barbara:whisky", {
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
hbhunger.register_food("taverna_barbara:whisky", 5, "macronodes:garrafa_vidro", nil, 4, "taverna_barbara_bebendo_garrafa_de_vidro")
|
if hbhunger then
|
||||||
|
hbhunger.register_food("taverna_barbara:whisky", 5, "macronodes:garrafa_vidro", nil, 4, "taverna_barbara_bebendo_garrafa_de_vidro")
|
||||||
|
end
|
||||||
|
|
||||||
-- Amendoim Crocante
|
-- Amendoim Crocante
|
||||||
minetest.register_craftitem("taverna_barbara:amendoim", {
|
minetest.register_craftitem("taverna_barbara:amendoim", {
|
||||||
|
@ -53,7 +55,9 @@ minetest.register_craftitem("taverna_barbara:amendoim", {
|
||||||
stack_max = 20,
|
stack_max = 20,
|
||||||
on_use = core.item_eat(2),
|
on_use = core.item_eat(2),
|
||||||
})
|
})
|
||||||
hbhunger.register_food("taverna_barbara:amendoim", 20, nil, nil, nil, "taverna_barbara_comendo_amendoim")
|
if hbhunger then
|
||||||
|
hbhunger.register_food("taverna_barbara:amendoim", 20, nil, nil, nil, "taverna_barbara_comendo_amendoim")
|
||||||
|
end
|
||||||
|
|
||||||
-- Balinha Sortida
|
-- Balinha Sortida
|
||||||
minetest.register_craftitem("taverna_barbara:balinha_sortida", {
|
minetest.register_craftitem("taverna_barbara:balinha_sortida", {
|
||||||
|
@ -63,8 +67,9 @@ minetest.register_craftitem("taverna_barbara:balinha_sortida", {
|
||||||
stack_max = 20,
|
stack_max = 20,
|
||||||
on_use = core.item_eat(0)
|
on_use = core.item_eat(0)
|
||||||
})
|
})
|
||||||
hbhunger.register_food("taverna_barbara:balinha_sortida", 0, nil, nil, nil, "taverna_barbara_balinha_sortida")
|
if hbhunger then
|
||||||
|
hbhunger.register_food("taverna_barbara:balinha_sortida", 0, nil, nil, nil, "taverna_barbara_balinha_sortida")
|
||||||
|
end
|
||||||
|
|
||||||
-- Batanoura Defumada (Cruzamento de Batata com Cenoura)
|
-- Batanoura Defumada (Cruzamento de Batata com Cenoura)
|
||||||
minetest.register_craftitem("taverna_barbara:batanoura_defumada", {
|
minetest.register_craftitem("taverna_barbara:batanoura_defumada", {
|
||||||
|
@ -73,4 +78,6 @@ minetest.register_craftitem("taverna_barbara:batanoura_defumada", {
|
||||||
stack_max = 10,
|
stack_max = 10,
|
||||||
on_use = core.item_eat(4)
|
on_use = core.item_eat(4)
|
||||||
})
|
})
|
||||||
hbhunger.register_food("taverna_barbara:batanoura_defumada", 4)
|
if hbhunger then
|
||||||
|
hbhunger.register_food("taverna_barbara:batanoura_defumada", 4)
|
||||||
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
default
|
default
|
||||||
hbhunger
|
hbhunger?
|
||||||
creatures
|
creatures
|
||||||
plagen
|
|
||||||
vessels
|
vessels
|
||||||
macromoney
|
macromoney
|
||||||
areas?
|
areas?
|
||||||
|
wool
|
||||||
|
|
Binary file not shown.
Binary file not shown.
7
init.lua
7
init.lua
|
@ -22,6 +22,11 @@ local modpath = minetest.get_modpath("taverna_barbara")
|
||||||
-- Variavel global
|
-- Variavel global
|
||||||
taverna_barbara = {}
|
taverna_barbara = {}
|
||||||
|
|
||||||
|
-- Plagen
|
||||||
|
taverna_barbara.plagen = dofile(modpath.."/lib/plagen.lua")
|
||||||
|
|
||||||
|
dofile(modpath.."/tradutor.lua")
|
||||||
|
|
||||||
-- Carregar scripts
|
-- Carregar scripts
|
||||||
notificar("Carregando...")
|
notificar("Carregando...")
|
||||||
dofile(modpath.."/diretrizes.lua")
|
dofile(modpath.."/diretrizes.lua")
|
||||||
|
@ -30,6 +35,6 @@ dofile(modpath.."/craftitens.lua")
|
||||||
dofile(modpath.."/nodes.lua")
|
dofile(modpath.."/nodes.lua")
|
||||||
dofile(modpath.."/barman.lua")
|
dofile(modpath.."/barman.lua")
|
||||||
dofile(modpath.."/trambiqueiro.lua")
|
dofile(modpath.."/trambiqueiro.lua")
|
||||||
dofile(modpath.."/comandos.lua")
|
dofile(modpath.."/carpete.lua")
|
||||||
dofile(modpath.."/mapgen.lua")
|
dofile(modpath.."/mapgen.lua")
|
||||||
notificar("OK")
|
notificar("OK")
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
|
||||||
|
-- Fallback functions for when `intllib` is not installed.
|
||||||
|
-- Code released under Unlicense <http://unlicense.org>.
|
||||||
|
|
||||||
|
-- Get the latest version of this file at:
|
||||||
|
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||||
|
|
||||||
|
local function format(str, ...)
|
||||||
|
local args = { ... }
|
||||||
|
local function repl(escape, open, num, close)
|
||||||
|
if escape == "" then
|
||||||
|
local replacement = tostring(args[tonumber(num)])
|
||||||
|
if open == "" then
|
||||||
|
replacement = replacement..close
|
||||||
|
end
|
||||||
|
return replacement
|
||||||
|
else
|
||||||
|
return "@"..open..num..close
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gettext, ngettext
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
-- New method using gettext.
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair()
|
||||||
|
else
|
||||||
|
-- Old method using text files.
|
||||||
|
gettext = intllib.Getter()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Fill in missing functions.
|
||||||
|
|
||||||
|
gettext = gettext or function(msgid, ...)
|
||||||
|
return format(msgid, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||||
|
return format(n==1 and msgid or msgid_plural, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
return gettext, ngettext
|
|
@ -0,0 +1,365 @@
|
||||||
|
--[[
|
||||||
|
Lib Plagen para Minetest
|
||||||
|
Plagen v2.0.0 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/>.
|
||||||
|
|
||||||
|
Autoria do código:
|
||||||
|
Originalmente por BrunoMine, Bruno Borges <borgesdossantosbruno@gmail.com>
|
||||||
|
]]
|
||||||
|
|
||||||
|
local plagen = {}
|
||||||
|
|
||||||
|
|
||||||
|
-- Metodo para pegar blocos mesmo nao carregados
|
||||||
|
local function pegar_node(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
if node.name == "ignore" then
|
||||||
|
minetest.get_voxel_manip():read_from_map(pos, pos)
|
||||||
|
node = minetest.get_node(pos)
|
||||||
|
end
|
||||||
|
return node
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Calcular diferença do novo degrau
|
||||||
|
local function calc_dif(y, y1, y2)
|
||||||
|
if y2 > y1 then
|
||||||
|
return y + 1
|
||||||
|
elseif y2 < y1 then
|
||||||
|
return y - 1
|
||||||
|
else
|
||||||
|
return y
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Metodo para colocar um nivel de blocos (como um solo)
|
||||||
|
local function montar_solo(pos, solo, subsolo, rocha)
|
||||||
|
if not pos or not solo or not subsolo or not rocha then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
local miny = pos.y-20
|
||||||
|
local maxy = pos.y+20
|
||||||
|
for y=miny, maxy do
|
||||||
|
if y < pos.y - 2 then
|
||||||
|
minetest.set_node({x=pos.x,y=y,z=pos.z}, {name=rocha})
|
||||||
|
elseif y < pos.y then
|
||||||
|
minetest.set_node({x=pos.x,y=y,z=pos.z}, {name=subsolo})
|
||||||
|
elseif y == pos.y then
|
||||||
|
minetest.set_node({x=pos.x,y=y,z=pos.z}, {name=solo})
|
||||||
|
else
|
||||||
|
minetest.remove_node({x=pos.x,y=y,z=pos.z})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Encontrar altura de um bloco alvo (em uma coluna)
|
||||||
|
local pegar_altura_solo = function(pos, alvos, amplitude)
|
||||||
|
local y = pos.y + amplitude
|
||||||
|
local resp = pos.y
|
||||||
|
while y >= pos.y - amplitude do
|
||||||
|
if table.maxn(minetest.find_nodes_in_area({x=pos.x,y=y,z=pos.z}, {x=pos.x,y=y,z=pos.z}, alvos)) == 1 then
|
||||||
|
resp = y
|
||||||
|
break
|
||||||
|
end
|
||||||
|
y = y - 1
|
||||||
|
end
|
||||||
|
return resp
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Planificar uma area
|
||||||
|
--[[
|
||||||
|
Esse metodo planifica uma area
|
||||||
|
Retornos:
|
||||||
|
<booleano> true para operação bem sucedida e false para nao sucedida
|
||||||
|
Argumentos:
|
||||||
|
<pos> do centro da area a ser planificada
|
||||||
|
<tipo> tipo de planificação
|
||||||
|
"quadrada" para planificar uma area quadrada
|
||||||
|
<largura> largura da area planificada
|
||||||
|
<amplitude> Quantidade de blocos para cima e para baixo em que ocorre a operação (colocação de blocos)
|
||||||
|
<nodes> É o material utilizado na planificação
|
||||||
|
{rocha="string", subsolo="string", solo="string"}
|
||||||
|
<borda> É quantos blocos a partir da area planificada serão afetado para formar os degrais
|
||||||
|
<calc_media> é booleano para planificar em uma faixa de altura média da area a planificar
|
||||||
|
<verif_mapa> Verificar se o mapa está gerado por segurança
|
||||||
|
|
||||||
|
]]
|
||||||
|
local solos_gerais = {"group:soil", "group:stone", "group:sand"}
|
||||||
|
plagen.planificar = function(pos, tipo, largura, amplitude, nodes, borda, calc_media, verif_mapa)
|
||||||
|
-- Verificar dados
|
||||||
|
if not pos then
|
||||||
|
minetest.log("error", "[Plagen] Tabela 'pos' nula (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not tipo then
|
||||||
|
minetest.log("error", "[Plagen] String de 'tipo' nula (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not largura then
|
||||||
|
minetest.log("error", "[Plagen] Variavel 'largura' nula (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not amplitude then
|
||||||
|
minetest.log("error", "[Plagen] Variavel 'amplitude' nula (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not nodes then
|
||||||
|
minetest.log("error", "[Plagen] Tabela 'nodes' nula (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
-- Refino de dados
|
||||||
|
if tipo ~= "quadrada" then
|
||||||
|
minetest.log("error", "[Plagen] Tipo de planificacao "..dump(tipo).." invalida (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not nodes.rocha then
|
||||||
|
minetest.log("error", "[Plagen] Tabela 'nodes' nao tem 'rocha' definido (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not nodes.subsolo then
|
||||||
|
minetest.log("error", "[Plagen] Tabela 'nodes' nao tem 'subsolo' definido (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
if not nodes.solo then
|
||||||
|
minetest.log("error", "[Plagen] Tabela 'nodes' nao tem 'solo' definido (em plagen.planificar)")
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Reajuste de dados
|
||||||
|
if not borda then borda = 0 end
|
||||||
|
|
||||||
|
-- Criado variaveis auxiliares
|
||||||
|
|
||||||
|
-- Materiais
|
||||||
|
local solo = nodes.solo
|
||||||
|
local subsolo = nodes.subsolo
|
||||||
|
local rocha = nodes.rocha
|
||||||
|
|
||||||
|
-- Distancia do centro a borda da area plana
|
||||||
|
local dist = math.ceil(largura/2) -- arredonda pra cima
|
||||||
|
|
||||||
|
-- Coordenadas da area plana
|
||||||
|
local minp = {x=pos.x-dist, z=pos.z-dist}
|
||||||
|
local maxp = {x=pos.x+dist, z=pos.z+dist}
|
||||||
|
|
||||||
|
-- Altura da area plana
|
||||||
|
local altura = pos.y
|
||||||
|
|
||||||
|
-- Verificar se o mapa está gerado
|
||||||
|
if verif_mapa then
|
||||||
|
local d = borda + dist
|
||||||
|
local node1 = pegar_node({x=pos.x+d, y=pos.y+borda, z=pos.z})
|
||||||
|
local node2 = pegar_node({x=pos.x-d, y=pos.y+borda, z=pos.z})
|
||||||
|
local node3 = pegar_node({x=pos.x, y=pos.y+borda, z=pos.z+d})
|
||||||
|
local node4 = pegar_node({x=pos.x, y=pos.y+borda, z=pos.z-d})
|
||||||
|
local node5 = pegar_node({x=pos.x+d, y=pos.y-borda, z=pos.z})
|
||||||
|
local node6 = pegar_node({x=pos.x-d, y=pos.y-borda, z=pos.z})
|
||||||
|
local node7 = pegar_node({x=pos.x, y=pos.y-borda, z=pos.z+d})
|
||||||
|
local node8 = pegar_node({x=pos.x, y=pos.y-borda, z=pos.z-d})
|
||||||
|
if node1.name == "ignore" or node2.name == "ignore" or node3.name == "ignore" or node4.name == "ignore"
|
||||||
|
or node5.name == "ignore" or node6.name == "ignore" or node7.name == "ignore" or node8.name == "ignore"
|
||||||
|
then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Calcular altura média dos blocos de solo na area a ser aplanada para definir a altura mais adequada
|
||||||
|
if calc_media then
|
||||||
|
local nodes = minetest.find_nodes_in_area(
|
||||||
|
{x=minp.x, y=pos.y-amplitude, z=minp.z},
|
||||||
|
{x=maxp.x, y=pos.y+amplitude, z=maxp.z},
|
||||||
|
{solo}
|
||||||
|
)
|
||||||
|
local n = 0
|
||||||
|
for _, vpos in ipairs(nodes) do
|
||||||
|
n = n + vpos.y
|
||||||
|
end
|
||||||
|
if table.maxn(nodes) > 0 then
|
||||||
|
altura = math.ceil(n/table.maxn(nodes))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Inicia um processo de planagem
|
||||||
|
if tipo == "quadrada" then
|
||||||
|
|
||||||
|
|
||||||
|
-- Montar faixa de terra plana
|
||||||
|
for x=minp.x, maxp.x do
|
||||||
|
for z=minp.z, maxp.z do
|
||||||
|
montar_solo({x=x,y=altura,z=z}, solo, subsolo, rocha)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Montar degrais de blocos (em direção a borda)
|
||||||
|
if borda > 0 then
|
||||||
|
for degrau=1, borda do
|
||||||
|
--[[
|
||||||
|
y1 é a altura do degrau já construindo
|
||||||
|
y2 é a altura do degrau que será contruindo
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Montar fileira de Degrais X+
|
||||||
|
for z=minp.z, maxp.z do
|
||||||
|
local p = {x=maxp.x,y=altura,z=z}
|
||||||
|
local y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x + 1
|
||||||
|
local y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Montar fileira de Degrais X-
|
||||||
|
for z=minp.z, maxp.z do
|
||||||
|
local p = {x=minp.x,y=altura,z=z}
|
||||||
|
local y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x - 1
|
||||||
|
local y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Montar fileira de Degrais Z+
|
||||||
|
for x=minp.x, maxp.x do
|
||||||
|
local p = {x=x,y=altura,z=maxp.z}
|
||||||
|
local y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.z = p.z + 1
|
||||||
|
local y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Montar fileira de Degrais Z-
|
||||||
|
for x=minp.x, maxp.x do
|
||||||
|
local p = {x=x,y=altura,z=minp.z}
|
||||||
|
local y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.z = p.z - 1
|
||||||
|
local y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Montar quinas
|
||||||
|
|
||||||
|
-- Quina X+Z+
|
||||||
|
local p = {x=maxp.x,y=altura,z=maxp.z}
|
||||||
|
local y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x + 1
|
||||||
|
p.z = p.z + 1
|
||||||
|
local y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
|
||||||
|
-- Quina X+Z-
|
||||||
|
p = {x=maxp.x,y=altura,z=minp.z}
|
||||||
|
y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x + 1
|
||||||
|
p.z = p.z - 1
|
||||||
|
y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
|
||||||
|
-- Quina X-Z-
|
||||||
|
p = {x=minp.x,y=altura,z=minp.z}
|
||||||
|
y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x - 1
|
||||||
|
p.z = p.z - 1
|
||||||
|
y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
|
||||||
|
-- Quina X-Z+
|
||||||
|
p = {x=minp.x,y=altura,z=maxp.z}
|
||||||
|
y1 = pegar_altura_solo(p, {solo}, amplitude)
|
||||||
|
p.y = y1
|
||||||
|
p.x = p.x - 1
|
||||||
|
p.z = p.z + 1
|
||||||
|
y2 = pegar_altura_solo(p, solos_gerais, amplitude)
|
||||||
|
|
||||||
|
-- Verifica precipicios
|
||||||
|
if y2 == false then y2 = y1 end
|
||||||
|
|
||||||
|
-- Calcula novo degrau
|
||||||
|
p.y = calc_dif(p.y, y1, y2)
|
||||||
|
montar_solo(p, solo, subsolo, rocha)
|
||||||
|
|
||||||
|
|
||||||
|
-- Preparar para proximo degrau
|
||||||
|
minp = {x=minp.x-1, z=minp.z-1}
|
||||||
|
maxp = {x=maxp.x+1, z=maxp.z+1}
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Remove arvores danificadas perto
|
||||||
|
local d = borda + dist + 2
|
||||||
|
local arvores = minetest.find_nodes_in_area(
|
||||||
|
{x=pos.x-d, y=pos.y+borda, z=pos.z-d},
|
||||||
|
{x=pos.x+d, y=pos.y-borda, z=pos.z+d},
|
||||||
|
{"group:tree"}
|
||||||
|
)
|
||||||
|
for _, pos in ipairs(arvores) do
|
||||||
|
minetest.remove_node(pos)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Terreno aplanado com sucesso
|
||||||
|
return true
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return plagen
|
|
@ -0,0 +1 @@
|
||||||
|
barman.lua carpete.lua craftitens.lua nodes.lua protetor.lua trambiqueiro.lua
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2018-12-27 23:36-0200\n"
|
||||||
|
"PO-Revision-Date: 2018-12-27 23:38-0200\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 2.2\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: en\n"
|
||||||
|
|
||||||
|
#: carpete.lua
|
||||||
|
msgid "Carpete de Taverna Barbara"
|
||||||
|
msgstr "Carpet of the Taverna"
|
Binary file not shown.
|
@ -0,0 +1,23 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: \n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2018-12-27 23:36-0200\n"
|
||||||
|
"PO-Revision-Date: 2018-12-27 23:36-0200\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
"X-Generator: Poedit 2.2\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||||
|
"Language: pt\n"
|
||||||
|
|
||||||
|
#: carpete.lua
|
||||||
|
msgid "Carpete de Taverna Barbara"
|
||||||
|
msgstr "Carpete de Taverna Barbara"
|
|
@ -0,0 +1,3 @@
|
||||||
|
### Arquivo gerado por taverna_barbara apartir de en.po
|
||||||
|
# textdomain: taverna_barbara
|
||||||
|
Carpet of the Taverna=Carpet of the Taverna
|
|
@ -0,0 +1,3 @@
|
||||||
|
### Arquivo gerado por taverna_barbara apartir de en.po
|
||||||
|
# textdomain: taverna_barbara
|
||||||
|
Carpet of the Taverna=Carpet of the Taverna
|
|
@ -0,0 +1,3 @@
|
||||||
|
### Arquivo gerado por taverna_barbara apartir de pt.po
|
||||||
|
# textdomain: taverna_barbara
|
||||||
|
Carpet of the Taverna=Carpete de Taverna Barbara
|
|
@ -0,0 +1,22 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2018-12-27 23:36-0200\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: carpete.lua
|
||||||
|
msgid "Carpete de Taverna Barbara"
|
||||||
|
msgstr ""
|
|
@ -324,7 +324,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Planificar area
|
-- Planificar area
|
||||||
if plagen.planificar(pos, "quadrada", 14, 40, {solo=node.name, subsolo="default:dirt", rocha="default:stone"}, 6, true, true) == false then
|
if taverna_barbara.plagen.planificar(pos, "quadrada", 14, 40, {solo=node.name, subsolo="default:dirt", rocha="default:stone"}, 6, true, true) == false then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
set me=%~n0
|
||||||
|
|
||||||
|
rem # Uncomment the following line if gettext is not in your PATH.
|
||||||
|
rem # Value must be absolute and end in a backslash.
|
||||||
|
rem set gtprefix=C:\path\to\gettext\bin\
|
||||||
|
|
||||||
|
if "%1" == "" (
|
||||||
|
echo Usage: %me% FILE... 1>&2
|
||||||
|
exit 1
|
||||||
|
)
|
||||||
|
|
||||||
|
set xgettext=%gtprefix%xgettext.exe
|
||||||
|
set msgmerge=%gtprefix%msgmerge.exe
|
||||||
|
|
||||||
|
md locale > nul 2>&1
|
||||||
|
echo Generating template... 1>&2
|
||||||
|
echo %xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
|
||||||
|
%xgettext% --from-code=UTF-8 -kS -kNS:1,2 -k_ -o locale/template.pot %*
|
||||||
|
if %ERRORLEVEL% neq 0 goto done
|
||||||
|
|
||||||
|
cd locale
|
||||||
|
|
||||||
|
for %%f in (*.po) do (
|
||||||
|
echo Updating %%f... 1>&2
|
||||||
|
%msgmerge% --update %%f template.pot
|
||||||
|
)
|
||||||
|
|
||||||
|
echo DONE! 1>&2
|
||||||
|
|
||||||
|
:done
|
|
@ -0,0 +1,27 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
me=$(basename "${BASH_SOURCE[0]}");
|
||||||
|
|
||||||
|
if [[ $# -lt 1 ]]; then
|
||||||
|
echo "Usage: $me FILE..." >&2;
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p locale;
|
||||||
|
echo "Generating template..." >&2;
|
||||||
|
xgettext --from-code=UTF-8 \
|
||||||
|
--keyword=S \
|
||||||
|
--keyword=NS:1,2 \
|
||||||
|
--keyword=N_ \
|
||||||
|
--add-comments='Translators:' \
|
||||||
|
--add-location=file \
|
||||||
|
-o locale/template.pot \
|
||||||
|
"$@" \
|
||||||
|
|| exit;
|
||||||
|
|
||||||
|
find locale -name '*.po' -type f | while read -r file; do
|
||||||
|
echo "Updating $file..." >&2;
|
||||||
|
msgmerge --update "$file" locale/template.pot;
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "DONE!" >&2;
|
|
@ -0,0 +1,183 @@
|
||||||
|
--[[
|
||||||
|
Mod taverna_barbara para Minetest
|
||||||
|
Copyright (C) 2018 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/>.
|
||||||
|
|
||||||
|
Sistema de tradução
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Modpath
|
||||||
|
local modpath = minetest.get_modpath("taverna_barbara")
|
||||||
|
|
||||||
|
-- Tradução intllib
|
||||||
|
taverna_barbara.intllib = {}
|
||||||
|
taverna_barbara.intllib.S, taverna_barbara.intllib.NS = dofile(modpath.."/lib/intllib.lua")
|
||||||
|
|
||||||
|
-- Configura tradutor opicional
|
||||||
|
taverna_barbara.S = taverna_barbara.intllib.S
|
||||||
|
taverna_barbara.NS = taverna_barbara.intllib.NS
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Ajustes devido ao bug de tradutor ler apenas traduzir do ingles
|
||||||
|
--
|
||||||
|
|
||||||
|
-- Strings para repassar textos em ingles
|
||||||
|
local pt_to_en = {}
|
||||||
|
|
||||||
|
-- Gera arquivos de tradução taverna_barbara.*.tr
|
||||||
|
do
|
||||||
|
local file_to_tb = function(file)
|
||||||
|
local msgid = nil
|
||||||
|
local msgstr = nil
|
||||||
|
local tb = {}
|
||||||
|
for line in io.lines(file) do
|
||||||
|
|
||||||
|
-- Iniciando 'msgid'
|
||||||
|
if string.sub(line, 1, 5) == "msgid" then
|
||||||
|
|
||||||
|
-- Escrever no catalogo a anterior
|
||||||
|
if msgid ~= nil and msgstr ~= nil then
|
||||||
|
if msgid ~= "" then
|
||||||
|
tb[msgid] = msgstr
|
||||||
|
end
|
||||||
|
msgid = nil
|
||||||
|
msgstr = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if line == "msgid \"\"" then
|
||||||
|
msgid = ""
|
||||||
|
else
|
||||||
|
msgid = string.sub(line, 8, (string.len(line)-1))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Continuando 'msgid'
|
||||||
|
elseif string.sub(line, 1, 1) == "\"" and msgstr == nil and msgid ~= nil then
|
||||||
|
msgid = msgid .. string.sub(line, 2, (string.len(line)-1))
|
||||||
|
|
||||||
|
-- Iniciando 'msgstr'
|
||||||
|
elseif string.sub(line, 1, 6) == "msgstr" then
|
||||||
|
|
||||||
|
if line == "msgstr \"\"" then
|
||||||
|
msgstr = ""
|
||||||
|
else
|
||||||
|
msgstr = string.sub(line, 9, (string.len(line)-1))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Continuando 'msgstr'
|
||||||
|
elseif string.sub(line, 1, 1) == "\"" and msgstr ~= nil then
|
||||||
|
msgstr = msgstr .. string.sub(line, 2, (string.len(line)-1))
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Escrever ultima
|
||||||
|
if msgid ~= nil and msgstr ~= nil then
|
||||||
|
if msgid ~= "" then
|
||||||
|
tb[msgid] = msgstr
|
||||||
|
end
|
||||||
|
msgid = nil
|
||||||
|
msgstr = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
return tb
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Pegar strings principais en-pt para realizar as trocas
|
||||||
|
pt_to_en = file_to_tb(modpath.."/locale/en.po")
|
||||||
|
|
||||||
|
--minetest.log("error", "pt_to_en = "..dump(pt_to_en))
|
||||||
|
|
||||||
|
local list = minetest.get_dir_list(modpath.."/locale")
|
||||||
|
for _,file in ipairs(list) do
|
||||||
|
|
||||||
|
if string.match(file, "~") == nil then
|
||||||
|
|
||||||
|
-- Traduções ".po"
|
||||||
|
if string.match(file, ".pot") == nil and string.match(file, ".po") then
|
||||||
|
|
||||||
|
local lang_code = string.gsub(file, ".po", "")
|
||||||
|
|
||||||
|
local pt_to_lang = file_to_tb(modpath.."/locale/"..file)
|
||||||
|
|
||||||
|
-- tabela desejada
|
||||||
|
local en_to_lang = {}
|
||||||
|
for pt,en in pairs(pt_to_en) do
|
||||||
|
en_to_lang[en] = pt_to_lang[pt]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Novo arquivo
|
||||||
|
local new_file = "### Arquivo gerado por taverna_barbara apartir de "..file.."\n# textdomain: taverna_barbara\n"
|
||||||
|
for en,lang in pairs(en_to_lang) do
|
||||||
|
new_file = new_file .. en .. "=" .. lang .. "\n"
|
||||||
|
end
|
||||||
|
local saida = io.open(modpath.."/locale/taverna_barbara."..lang_code..".tr", "w")
|
||||||
|
saida:write(new_file)
|
||||||
|
io.close(saida)
|
||||||
|
|
||||||
|
-- Gera arquivo com lang_code nulo para evitar mensagens de erro (bug do minetest)
|
||||||
|
if lang_code == "en" then
|
||||||
|
local saida2 = io.open(modpath.."/locale/taverna_barbara..tr", "w")
|
||||||
|
saida2:write(new_file)
|
||||||
|
io.close(saida2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Ajuste para repassar termos em ingles
|
||||||
|
local s
|
||||||
|
if minetest.get_translator ~= nil then
|
||||||
|
s = minetest.get_translator("taverna_barbara")
|
||||||
|
else
|
||||||
|
s = taverna_barbara.intllib.S
|
||||||
|
end
|
||||||
|
|
||||||
|
taverna_barbara.s = function(...)
|
||||||
|
local args = { ... }
|
||||||
|
if pt_to_en[args[1]] ~= nil then
|
||||||
|
return s(pt_to_en[args[1]], unpack(args, 2))
|
||||||
|
end
|
||||||
|
minetest.log("error", "[taverna_barbara] String "..dump(args[1]).." nao catalogada")
|
||||||
|
return s(...)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Não troca string caso esteja trabalhando com intllib
|
||||||
|
if minetest.get_modpath("intllib") ~= nil
|
||||||
|
and minetest.get_translator == nil
|
||||||
|
then
|
||||||
|
taverna_barbara.s = s
|
||||||
|
end
|
||||||
|
|
||||||
|
taverna_barbara.S = function(...)
|
||||||
|
local args = { ... }
|
||||||
|
if type(args[1]) == "table" then
|
||||||
|
local r = {}
|
||||||
|
for n,a in ipairs(args[1]) do
|
||||||
|
if n ~= 1 then -- Não traduz o primeiro
|
||||||
|
table.insert(r, taverna_barbara.S(a))
|
||||||
|
else
|
||||||
|
table.insert(r, a)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return taverna_barbara.s(unpack(r))
|
||||||
|
|
||||||
|
elseif type(args[1]) == "string" then
|
||||||
|
-- Não traduz caso faltem argumentos (devido strings ilustrativas)
|
||||||
|
return taverna_barbara.s(...)
|
||||||
|
|
||||||
|
else
|
||||||
|
return args[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Função que retorna a string inalterada para passar pela checagem
|
||||||
|
taverna_barbara.Sfake = function(s) return s end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue