Lançamento de codigo inicial
parent
663705c52b
commit
5997b4a188
|
@ -0,0 +1,165 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
28
README.md
28
README.md
|
@ -1 +1,27 @@
|
||||||
musket
|
# Musket v1.0.0
|
||||||
|
|
||||||
|
[![download](https://img.shields.io/github/tag/BrunoMine/musket.svg?style=flat-square&label=release)](https://github.com/BrunoMine/musket/archive/master.zip)
|
||||||
|
[![git](https://img.shields.io/badge/git-project-green.svg?style=flat-square)](https://github.com/BrunoMine/musket)
|
||||||
|
[![forum](https://img.shields.io/badge/minetest-mod-green.svg?style=flat-square)](https://forum.minetest.net)
|
||||||
|
[![bower](https://img.shields.io/badge/bower-mod-green.svg?style=flat-square)](https://minetest-bower.herokuapp.com/mods/musket)
|
||||||
|
|
||||||
|
## Descrição
|
||||||
|
Adicionar o mosquete ao Minetest
|
||||||
|
|
||||||
|
## Requisitos _(Requirements)_
|
||||||
|
* Minetest 0.4.17 ou superior
|
||||||
|
* Mod intllib (opicional)
|
||||||
|
|
||||||
|
## Licença
|
||||||
|
Veja LICENSE.txt para informações detalhadas da licença LGPL 3.0
|
||||||
|
|
||||||
|
### Autores do código fonte
|
||||||
|
Originalmente por BrunoMine, Bruno Borges <borgesdossantosbruno@gmail.com> (LGPL 3.0)
|
||||||
|
|
||||||
|
### Autores de mídias (texturas, modelos and sons)
|
||||||
|
Todos que não estao listados aqui:
|
||||||
|
BrunoMine, Bruno Borges <borgesdossantosbruno@gmail.com> (CC BY-SA 3.0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
shooter
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Adiciona arma mosquetes | Adds musket shooter
|
|
@ -0,0 +1,134 @@
|
||||||
|
--[[
|
||||||
|
Mod Musket 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/>.
|
||||||
|
|
||||||
|
Arma Mosquete
|
||||||
|
]]
|
||||||
|
|
||||||
|
-- Tabela Global
|
||||||
|
musket = {}
|
||||||
|
|
||||||
|
local modpath = minetest.get_modpath("musket")
|
||||||
|
|
||||||
|
dofile(modpath.."/tradutor.lua")
|
||||||
|
|
||||||
|
local S = musket.S
|
||||||
|
|
||||||
|
-- Arma descarregada
|
||||||
|
minetest.register_craftitem("musket:ammo_mosquete_descarregado", {
|
||||||
|
description = "Mosquete Descarregado",
|
||||||
|
inventory_image = "musket_mosquete_descarregado.png",
|
||||||
|
|
||||||
|
on_drop = function(itemstack, dropper, pos)
|
||||||
|
-- Prints a random number and removes one item from the stack
|
||||||
|
minetest.chat_send_all(math.random())
|
||||||
|
itemstack:take_item()
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Munição de Mosquete
|
||||||
|
minetest.register_craftitem("musket:ammo_mosquete", {
|
||||||
|
description = S("Munição para Mosquete"),
|
||||||
|
inventory_image = "musket_ammo_mosquete.png",
|
||||||
|
wield_image = "musket_ammo_mosquete_na_mao.png",
|
||||||
|
stack_max = 15,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Mosquete
|
||||||
|
shooter:register_weapon("musket:mosquete", {
|
||||||
|
description = S("Mosquete"),
|
||||||
|
inventory_image = "musket_mosquete.png",
|
||||||
|
rounds = 1.1,
|
||||||
|
ammo = "musket:ammo_mosquete",
|
||||||
|
spec = {
|
||||||
|
range = 20,
|
||||||
|
step = 30,
|
||||||
|
tool_caps = {full_punch_interval=1.2, damage_groups={fleshy=6}},
|
||||||
|
groups = {snappy=3, crumbly=3, choppy=3, fleshy=2, oddly_breakable_by_hand=2},
|
||||||
|
sound = "musket_mosquete",
|
||||||
|
particle = "shooter_bullet.png",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Mosquete Descarregado
|
||||||
|
shooter:register_weapon("musket:mosquete_descarregado", {
|
||||||
|
description = S("Mosquete"),
|
||||||
|
inventory_image = "musket_mosquete_descarregado.png",
|
||||||
|
rounds = 1.1,
|
||||||
|
ammo = "musket:ammo_mosquete",
|
||||||
|
spec = {
|
||||||
|
range = 20,
|
||||||
|
step = 30,
|
||||||
|
tool_caps = {full_punch_interval=1.2, damage_groups={fleshy=6}},
|
||||||
|
groups = {snappy=3, crumbly=3, choppy=3, fleshy=2, oddly_breakable_by_hand=2},
|
||||||
|
sound = "musket_mosquete",
|
||||||
|
particle = "shooter_bullet.png",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Ajustes
|
||||||
|
local old_on_use1 = minetest.registered_tools["musket:mosquete_descarregado"].on_use
|
||||||
|
do
|
||||||
|
-- Copiar tabela de definições
|
||||||
|
local def = {}
|
||||||
|
for n,d in pairs(minetest.registered_tools["musket:mosquete_descarregado"]) do
|
||||||
|
def[n] = d
|
||||||
|
end
|
||||||
|
-- Mantem a tabela groups separada
|
||||||
|
def.groups = minetest.deserialize(minetest.serialize(def.groups)) or {}
|
||||||
|
|
||||||
|
-- Altera alguns paremetros
|
||||||
|
def.groups.not_in_creative_inventory = 1
|
||||||
|
|
||||||
|
-- Troca o mosquete
|
||||||
|
def.on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if old_on_use1 then
|
||||||
|
itemstack = old_on_use1(itemstack, user, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verifica se descarregou
|
||||||
|
if itemstack:get_wear() < 500 then
|
||||||
|
itemstack:set_name("musket:mosquete")
|
||||||
|
end
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registra o novo node
|
||||||
|
minetest.override_item("musket:mosquete_descarregado", {groups=def.groups, on_use=def.on_use})
|
||||||
|
end
|
||||||
|
|
||||||
|
local old_on_use2 = minetest.registered_tools["musket:mosquete"].on_use
|
||||||
|
do
|
||||||
|
-- Copiar tabela de definições
|
||||||
|
local def = {}
|
||||||
|
for n,d in pairs(minetest.registered_tools["musket:mosquete"]) do
|
||||||
|
def[n] = d
|
||||||
|
end
|
||||||
|
-- Mantem a tabela groups separada
|
||||||
|
def.groups = minetest.deserialize(minetest.serialize(def.groups)) or {}
|
||||||
|
|
||||||
|
-- Altera alguns paremetros
|
||||||
|
-- Troca o mosquete
|
||||||
|
def.on_use = function(itemstack, user, pointed_thing)
|
||||||
|
if old_on_use2 then
|
||||||
|
itemstack = old_on_use2(itemstack, user, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Verifica se descarregou
|
||||||
|
if itemstack:get_wear() > 50000 then
|
||||||
|
itemstack:set_name("musket:mosquete_descarregado")
|
||||||
|
end
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Registra o novo node
|
||||||
|
minetest.override_item("musket:mosquete", {groups=def.groups, on_use=def.on_use})
|
||||||
|
end
|
|
@ -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 @@
|
||||||
|
init.lua
|
Binary file not shown.
|
@ -0,0 +1,27 @@
|
||||||
|
# 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-08-18 22:50-0300\n"
|
||||||
|
"PO-Revision-Date: 2018-08-18 22:52-0300\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.0.6\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: en\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Munição para Mosquete"
|
||||||
|
msgstr "Musket Ammo"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Mosquete"
|
||||||
|
msgstr "Musket"
|
|
@ -0,0 +1,4 @@
|
||||||
|
### Arquivo gerado por musket apartir de en.po
|
||||||
|
# textdomain: musket
|
||||||
|
Musket Ammo=Musket Ammo
|
||||||
|
Musket=Musket
|
|
@ -0,0 +1,4 @@
|
||||||
|
### Arquivo gerado por musket apartir de pt.po
|
||||||
|
# textdomain: musket
|
||||||
|
Musket Ammo=Munição para Mosquete
|
||||||
|
Musket=Mosquete
|
Binary file not shown.
|
@ -0,0 +1,27 @@
|
||||||
|
# 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-08-18 22:50-0300\n"
|
||||||
|
"PO-Revision-Date: 2018-08-18 22:53-0300\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.0.6\n"
|
||||||
|
"Last-Translator: \n"
|
||||||
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
"Language: pt\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Munição para Mosquete"
|
||||||
|
msgstr "Munição para Mosquete"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Mosquete"
|
||||||
|
msgstr "Mosquete"
|
|
@ -0,0 +1,26 @@
|
||||||
|
# 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-08-18 22:50-0300\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=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Munição para Mosquete"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: init.lua
|
||||||
|
msgid "Mosquete"
|
||||||
|
msgstr ""
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 711 B |
Binary file not shown.
After Width: | Height: | Size: 297 B |
Binary file not shown.
After Width: | Height: | Size: 695 B |
Binary file not shown.
After Width: | Height: | Size: 664 B |
|
@ -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,177 @@
|
||||||
|
--[[
|
||||||
|
Mod musket 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("musket")
|
||||||
|
|
||||||
|
-- Tradução intllib
|
||||||
|
musket.intllib = {}
|
||||||
|
musket.intllib.S, musket.intllib.NS = dofile(modpath.."/lib/intllib.lua")
|
||||||
|
|
||||||
|
-- Configura tradutor opicional
|
||||||
|
musket.S = musket.intllib.S
|
||||||
|
musket.NS = musket.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 musket.*.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 musket apartir de "..file.."\n# textdomain: musket\n"
|
||||||
|
for en,lang in pairs(en_to_lang) do
|
||||||
|
new_file = new_file .. en .. "=" .. lang .. "\n"
|
||||||
|
end
|
||||||
|
-- Escrever arquivo
|
||||||
|
local saida = io.open(modpath.."/locale/musket."..lang_code..".tr", "w")
|
||||||
|
saida:write(new_file)
|
||||||
|
io.close(saida)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Ajuste para repassar termos em ingles
|
||||||
|
local s
|
||||||
|
if minetest.get_translator ~= nil then
|
||||||
|
s = minetest.get_translator("musket")
|
||||||
|
else
|
||||||
|
s = musket.intllib.S
|
||||||
|
end
|
||||||
|
|
||||||
|
musket.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", "[musket] 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
|
||||||
|
musket.s = s
|
||||||
|
end
|
||||||
|
|
||||||
|
musket.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, musket.S(a))
|
||||||
|
else
|
||||||
|
table.insert(r, a)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return musket.s(unpack(r))
|
||||||
|
|
||||||
|
elseif type(args[1]) == "string" then
|
||||||
|
-- Não traduz caso faltem argumentos (devido strings ilustrativas)
|
||||||
|
return musket.s(...)
|
||||||
|
|
||||||
|
else
|
||||||
|
return args[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Função que retorna a string inalterada para passar pela checagem
|
||||||
|
musket.Sfake = function(s) return s end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue