ajustes finais

master
BrunoMine 2018-12-22 15:41:20 -02:00
parent 04ce893eef
commit 8f9dd678e0
25 changed files with 471 additions and 308 deletions

View File

@ -1,225 +0,0 @@
--[[
Mod Revom 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/>.
Node demarcador de casa
]]
-- Verificar e remover demarcadores invalidos
local check_demarcador = function(pos)
local meta = minetest.get_meta(pos)
local dono = meta:get_string("dono")
if revom.bd.verif("casas", dono) == false then
minetest.remove_node(pos)
return
end
if minetest.pos_to_string(revom.bd.pegar("casas", dono).pos) ~= minetest.pos_t_string(pos) then
minetest.remove_node(pos)
return
end
end
-- Demarcador de territorio
minetest.register_node("revom:demarcador_casa", {
description = "Demarcador de Casa",
tiles = {
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
},
groups = {choppy = 2, oddly_breakable_by_hand = 2},
sounds = default.node_sound_wood_defaults(),
walkable = true,
paramtype = "light",
selection_box = {
type = "fixed",
fixed = {-0.5,-0.5,-0.5,0.5,0.5,0.5},
},
on_place = function(itemstack, placer, pointed_thing)
local name = placer:get_player_name()
local grupo = manipulus.get_player_grupo(name)
-- Verifica pos
if pointed_thing == nil or pointed_thing.above == nil then
return itemstack
end
local pos = pointed_thing.above
-- Verificar se já está protegido
for x=-1, 1 do
for y=-1, 1 do
for z=-1, 1 do
if minetest.is_protected({x=pos.x+(5*x), y=pos.y+(5*x), z=pos.z+(5*x)}, name) == true then
minetest.chat_send_player(name, "Area protegida nas proximidades")
return itemstack
end
end
end
end
if not minetest.item_place(itemstack, placer, pointed_thing) then
return itemstack
end
-- Remove item do inventario
itemstack:take_item()
return itemstack
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local name = placer:get_player_name()
revom.bd.salvar("casas", name, {pos=pos})
-- Define demarcador
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Casa de "..name)
meta:set_string("dono", name)
end,
can_dig = function(pos, player)
local name = placer:get_player_name()
-- Verifica se grupo existe ainda
local meta = minetest.get_meta(pos)
if meta:get_string("dono") == name then
return true
end
return false
end,
on_punch = function(pos, node, puncher)
manipulus.display_territorio({x=pos.x, y=pos.y, z=pos.z}, 5, "manipulus:display_territorio")
end,
on_destruct = function(pos)
local meta = minetest.get_meta(pos)
local dono = meta:get_string("dono")
revom.bd.remover("casas", dono)
end,
})
-- Receita
minetest.register_craft({
output = 'revom:demarcador_casa',
recipe = {
{'group:stick', 'default:bronze_ingot', 'group:stick'},
{'default:bronze_ingot', 'default:steelblock', 'default:bronze_ingot'},
{'group:stick', 'default:bronze_ingot', 'group:stick'},
}
})
-- LBM para verificar nodes inativos
minetest.register_lbm({
name = "revom:update_demarcador_casa_lbm",
nodenames = {"revom:demarcador_casa"},
run_at_every_load = true,
action = function(pos, node)
check_demarcador(pos)
end,
})
-- Verifica se a coordenada 'pos' é protegida contra o jogador 'name'
local new_is_protected = function(pos, name)
if name == "" or name == nil then return nil end
-- Node demarcador dentro da area de risco (não deve existir mais de 1)
local n = minetest.find_node_near(pos, 5, "revom:demarcador_casa")
if n then
local meta = minetest.get_meta(pos)
if meta:get_string("dono") == name then
return false
end
else
return nil -- Indefinido, repassa para o proximo mod verificar
end
end
-- Sobreescreve metodo de proteção
local old_is_protected = minetest.is_protected
function minetest.is_protected(pos, name)
local r = new_is_protected(pos, name)
if r ~= nil then
return r
end
return old_is_protected(pos, name)
end
---
-- Caixa de Area
------
-- Registro das entidades
minetest.register_entity("revom:display_territorio", {
visual = "mesh",
visual_size = {x=1,y=1},
mesh = "revom_cubo.b3d",
textures = {"revom_display_territorio.png"},
collisionbox = {0,0,0, 0,0,0},
timer = 0,
on_step = function(self, dtime)
self.timer = self.timer + dtime
if self.timer >= 5 then
self.object:remove()
end
end,
})
-- Colocação de uma caixa
revom.display_territorio = function(pos, dist, name)
-- Remove caixas proximas para evitar colisão
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 13)) do
local ent = obj:get_luaentity() or {}
if ent and ent.name == name then
obj:remove()
end
end
-- Cria o objeto
local obj = minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, name)
local obj2 = minetest.add_entity({x=pos.x, y=pos.y, z=pos.z}, name)
obj2:set_properties({visual_size = {x=6, y=6}})
-- Pega a entidade
local ent = obj:get_luaentity()
-- Redimensiona para o tamanho da area
if tonumber(dist) == 1 then
obj:set_properties({visual_size = {x=15, y=15}})
elseif tonumber(dist) == 2 then
obj:set_properties({visual_size = {x=25, y=25}})
elseif tonumber(dist) == 3 then
obj:set_properties({visual_size = {x=35, y=35}})
elseif tonumber(dist) == 4 then
obj:set_properties({visual_size = {x=45, y=45}})
elseif tonumber(dist) == 5 then
obj:set_properties({visual_size = {x=55, y=55}})
elseif tonumber(dist) == 6 then
obj:set_properties({visual_size = {x=65, y=65}})
elseif tonumber(dist) == 7 then -- Na pratica isso serve para verificar area um pouco maior que as de largura 13
obj:set_properties({visual_size = {x=75, y=75}})
elseif tonumber(dist) == 8 then -- Na pratica isso serve para verificar area um pouco maior que as de largura 13
obj:set_properties({visual_size = {x=85, y=85}})
end
return true
end
-------
-----
---

View File

@ -1 +1,2 @@
default
xpro?

1
description.txt Normal file
View File

@ -0,0 +1 @@
Organizador de casas e spawn no mundo

View File

@ -13,22 +13,23 @@
revom = {}
-- Largura de uma zona
revom.largura_zona = 200
revom.largura_zona = tonumber(minetest.setting_get("revom_zone_width") or 200)
-- Limite de spawn por zona apta (de 1 a 20)
revom.limite_spawn_zona = 10
revom.limite_spawn_zona = tonumber(minetest.setting_get("revom_spawns_per_zone") or 10)
-- Nivel minimo para jogador colocar bloco de casa (mod xpro)
revom.level_to_house = tonumber(minetest.setting_get("revom_level_to_house") or 3)
-- Tempo para atualizar demarcadores
revom.waypoints_update_time = tonumber(minetest.setting_get("revom_waypoints_update_time") or 60)
--[[ Inscrever jogadores automaticamente para a batalha
battle.auto_join = true
if minetest.settings:get("battle_enable_auto_join_battle") == "false" then
battle.auto_join = false
end]]
local modpath = minetest.get_modpath("revom")
dofile(modpath.."/common.lua")
dofile(modpath.."/banco_de_dados.lua")
--dofile(modpath.."/tradutor.lua")
dofile(modpath.."/tradutor.lua")
dofile(modpath.."/zonas.lua")
dofile(modpath.."/spawn.lua")

View File

@ -0,0 +1 @@
protetor.lua spawn.lua waypoints.lua zonas.lua

BIN
locale/en.mo Normal file

Binary file not shown.

38
locale/en.po Normal file
View File

@ -0,0 +1,38 @@
# 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-22 14:20-0200\n"
"PO-Revision-Date: 2018-12-22 14:18-0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: protetor.lua
msgid "Demarcador de Casa"
msgstr "House Stone"
#: protetor.lua
msgid "Precisa atingir nivel @1"
msgstr "Need be level @1"
#: protetor.lua
msgid "Area protegida nas proximidades"
msgstr "Protected area"
#: protetor.lua waypoints.lua
msgid "Casa de @1"
msgstr "@1's House"
#~ msgid "Jogador @1 demarcou uma casa em @2"
#~ msgstr "Player @1 marked a house at @2"

39
locale/en.po~ Normal file
View File

@ -0,0 +1,39 @@
# 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-22 14:16-0200\n"
"PO-Revision-Date: 2018-12-22 14:18-0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: en\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: protetor.lua
msgid "Demarcador de Casa"
msgstr "House Stone"
#: protetor.lua
msgid "Precisa atingir nivel @1"
msgstr "Need be level @1"
#: protetor.lua
msgid "Area protegida nas proximidades"
msgstr "Protected area"
#: protetor.lua
msgid "Jogador @1 demarcou uma casa em @2"
msgstr "Player @1 marked a house at @2"
#: protetor.lua waypoints.lua
msgid "Casa de @1"
msgstr "@1's House"

BIN
locale/pt.mo Normal file

Binary file not shown.

38
locale/pt.po Normal file
View File

@ -0,0 +1,38 @@
# 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-22 14:20-0200\n"
"PO-Revision-Date: 2018-12-22 14:17-0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt\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"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: protetor.lua
msgid "Demarcador de Casa"
msgstr "Demarcador de Casa"
#: protetor.lua
msgid "Precisa atingir nivel @1"
msgstr "Precisa atingir nivel @1"
#: protetor.lua
msgid "Area protegida nas proximidades"
msgstr "Area protegida nas proximidades"
#: protetor.lua waypoints.lua
msgid "Casa de @1"
msgstr "Casa de @1"
#~ msgid "Jogador @1 demarcou uma casa em @2"
#~ msgstr "Jogador @1 demarcou uma casa em @2"

39
locale/pt.po~ Normal file
View File

@ -0,0 +1,39 @@
# 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-22 14:16-0200\n"
"PO-Revision-Date: 2018-12-22 14:17-0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: pt\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"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: protetor.lua
msgid "Demarcador de Casa"
msgstr "Demarcador de Casa"
#: protetor.lua
msgid "Precisa atingir nivel @1"
msgstr "Precisa atingir nivel @1"
#: protetor.lua
msgid "Area protegida nas proximidades"
msgstr "Area protegida nas proximidades"
#: protetor.lua
msgid "Jogador @1 demarcou uma casa em @2"
msgstr "Jogador @1 demarcou uma casa em @2"
#: protetor.lua waypoints.lua
msgid "Casa de @1"
msgstr "Casa de @1"

6
locale/revom.en.tr Normal file
View File

@ -0,0 +1,6 @@
### Arquivo gerado por revom apartir de en.po
# textdomain: revom
House Stone=House Stone
@1's House=@1's House
Protected area=Protected area
Need be level @1=Need be level @1

6
locale/revom.pt.tr Normal file
View File

@ -0,0 +1,6 @@
### Arquivo gerado por revom apartir de pt.po
# textdomain: revom
House Stone=Demarcador de Casa
@1's House=Casa de @1
Protected area=Area protegida nas proximidades
Need be level @1=Precisa atingir nivel @1

34
locale/template.pot Normal file
View File

@ -0,0 +1,34 @@
# 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-22 14:20-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"
#: protetor.lua
msgid "Demarcador de Casa"
msgstr ""
#: protetor.lua
msgid "Precisa atingir nivel @1"
msgstr ""
#: protetor.lua
msgid "Area protegida nas proximidades"
msgstr ""
#: protetor.lua waypoints.lua
msgid "Casa de @1"
msgstr ""

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = revom

View File

@ -1,55 +0,0 @@
--[[
Mod Manipulus 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/>.
Compatibilização com o mod protector
]]
-- Cancela se não estiver ativo
if minetest.get_modpath("protector") == nil then return end
local S = manipulus.S
-- Impede que um node seja colocado perto do outro
local old_on_place = {}
local impedir_node = function(node, node_evitado, r)
if minetest.registered_nodes[node] ~= nil then
old_on_place[node] = minetest.registered_nodes[node].on_place
minetest.override_item(node, {
on_place = function(itemstack, placer, pointed_thing)
-- Verifica pos
if pointed_thing == nil or pointed_thing.above == nil then
return itemstack
end
local pos = pointed_thing.above
-- Evitar coledir com protector (mesmo que seja do mesmo dono, não pode misturar as coisas)
if minetest.find_node_near(pos, r, node_evitado) then
minetest.chat_send_player(placer:get_player_name(), S("Area protegida nas proximidades"))
return itemstack
end
if old_on_place[node] == nil then
if not minetest.item_place(itemstack, placer, pointed_thing) then
return itemstack
end
-- Remove item do inventario
itemstack:take_item()
return itemstack
else
return old_on_place[node](itemstack, placer, pointed_thing)
end
end,
})
end
end
impedir_node("manipulus:demarcador", "protector:protect", (protector.radius or 5)+5)
impedir_node("protector:protect", "manipulus:demarcador", (protector.radius or 5)+5)
impedir_node("manipulus:demarcador", "protector:protect2", (protector.radius or 5)+5)
impedir_node("protector:protect2", "manipulus:demarcador", (protector.radius or 5)+5)

View File

@ -9,6 +9,9 @@
Demarcador de casas
]]
-- Tradutor de texto
local S = revom.S
-- Verificar e remover demarcadores invalidos
local check_demarcador = function(pos)
local meta = minetest.get_meta(pos)
@ -91,17 +94,17 @@ end
-- Demarcador de territorio
minetest.register_node("revom:demarcador_casa", {
description = "Demarcador de Casa",
description = S("Demarcador de Casa"),
tiles = {
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"default_steel_block.png",
"revom_marcador_lados.png",
"revom_marcador_lados.png",
"revom_marcador_frente.png",
"revom_marcador_frente.png",
"revom_marcador_frente.png",
"revom_marcador_frente.png",
},
groups = {choppy = 2, oddly_breakable_by_hand = 2},
sounds = default.node_sound_wood_defaults(),
groups = {cracky = 1, level = 2},
sounds = default.node_sound_metal_defaults(),
walkable = true,
paramtype = "light",
selection_box = {
@ -112,6 +115,12 @@ minetest.register_node("revom:demarcador_casa", {
on_place = function(itemstack, placer, pointed_thing)
local name = placer:get_player_name()
-- Verifica nivel do jogador
if xpro and xpro.get_player_lvl(name) < revom.level_to_house then
minetest.chat_send_player(name, S("Precisa atingir nivel @1", revom.level_to_house))
return itemstack
end
-- Verifica pos
if pointed_thing == nil or pointed_thing.above == nil then
return itemstack
@ -123,7 +132,7 @@ minetest.register_node("revom:demarcador_casa", {
for y=-1, 1 do
for z=-1, 1 do
if minetest.is_protected({x=pos.x+(5*x), y=pos.y+(5*x), z=pos.z+(5*x)}, name) == true then
minetest.chat_send_player(name, "Area protegida nas proximidades")
minetest.chat_send_player(name, S("Area protegida nas proximidades"))
return itemstack
end
end
@ -152,11 +161,12 @@ minetest.register_node("revom:demarcador_casa", {
-- Define novo demarcador
revom.bd.salvar("casas", name, {pos=pos})
local meta = minetest.get_meta(pos)
meta:set_string("infotext", "Casa de "..name)
meta:set_string("infotext", S("Casa de @1", name))
meta:set_string("dono", name)
-- Nova ocupação
local x, z = revom.zonas.get_malha(pos)
revom.zonas.desocupar(x, z, "casa", pos, name)
revom.zonas.ocupar(x, z, "casa", pos, name)
-- Verfica no que está na posição anterior
if oldpos then
@ -188,16 +198,30 @@ minetest.register_node("revom:demarcador_casa", {
local meta = minetest.get_meta(pos)
local dono = meta:get_string("dono")
revom.bd.remover("casas", dono)
-- Pega coordenada do banco de dados
local bdpos = nil
if revom.bd.verif("casas", dono) == true then
bdpos = revom.bd.pegar("casas", dono).pos
end
-- Verifica se é o node atual do dono
if bdpos and bdpos.x == pos.x and bdpos.y == pos.y and bdpos.z == pos.z then
revom.bd.remover("casas", dono)
-- Remove ocupação antiga (caso todos os dados sejam validos inclusive nome)
local bdx, bdz = revom.zonas.get_malha(bdpos)
revom.zonas.desocupar(bdx, bdz, "casa", bdpos, dono)
end
end,
})
-- Receita
minetest.register_craft({
output = 'revom:demarcador_casa',
recipe = {
{'group:stick', 'default:bronze_ingot', 'group:stick'},
{'default:bronze_ingot', 'default:steelblock', 'default:bronze_ingot'},
{'group:stick', 'default:bronze_ingot', 'group:stick'},
{'default:coal_lump', 'default:steel_ingot', 'default:coal_lump'},
{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'},
{'default:coal_lump', 'default:steel_ingot', 'default:coal_lump'},
}
})
@ -216,12 +240,13 @@ local new_is_protected = function(pos, name)
if name == "" or name == nil then return nil end
-- Node demarcador dentro da area de risco (não deve existir mais de 1)
local n = minetest.find_node_near(pos, 5, "revom:demarcador_casa")
if n then
if minetest.find_node_near(pos, 5, "revom:demarcador_casa") then
local meta = minetest.get_meta(pos)
if meta:get_string("dono") == name then
return false
else
return true
end
else
return nil -- Indefinido, repassa para o proximo mod verificar

24
settingtypes.txt Normal file
View File

@ -0,0 +1,24 @@
# Configurações aplicaveis para o menu gráfico
# Largura das zonas de spawn
# CUIDADO! Alterar isso após o inicio do mundo pode causar problemas
#
# Width of spawn zones
# CAUTION! Changing this after the start of the world can cause problems
revom_zone_width (Largura de zona | Zone Width) int 200 20
# Numero de spawn realizados numa zona livre
# Number of spawn performed in a free zone
revom_spawns_per_zone (Spawns por zona | Spawns per zone) int 10 1 20
# Nivel minimo para um jogador demarcar uma casa (precisa do mod xpro)
# Minimum level for a player to mark a house (need xpro mod)
revom_level_to_house (Nivel para criar casa | Level to House) int 3 1
# Tempo entre cada vez que os demarcadores (waypoints) do mapa são atualizados
# Time between each time map waypoints are updated
revom_waypoints_update_time (Tempo para atualizar demarcadores | waypoints_update_time) int 60 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 825 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

33
tools/xgettext.bat Normal file
View File

@ -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

27
tools/xgettext.sh Executable file
View File

@ -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;

View File

@ -9,4 +9,125 @@
Marcadores
]]
-- Tradutor de texto
local S = revom.S
-- Tabela de marcadores dos jogadores
local waypoints = {}
-- Atualiza marcadores de zonas
revom.atualizar_waypoints = function(player, loop)
if not player then return end
local pos = player:get_pos()
if not pos then return end
local name = player:get_player_name()
-- Zona atual
local x, z = revom.zonas.get_malha(pos)
-- Zonas proximas
local z1 = {
{x-1, z+1}, {x, z+1}, {x+1, z+1},
{x-1, z }, {x+1, z },
{x-1, z-1}, {x, z-1}, {x+1, z-1}
}
-- Zonas distantes
local z2 = {
{x-2, z+2}, {x-1, z+2}, {x, z+2}, {x+1, z+2}, {x+2, z+2},
{x-2, z+1}, {x+2, z+1},
{x-2, z }, {x+2, z },
{x-2, z-1}, {x+2, z-1},
{x-2, z-2}, {x-1, z-2}, {x, z-2}, {x+1, z-2}, {x+2, z-2}
}
-- Tabela de waypoints do jogador
waypoints[name] = waypoints[name] or {}
-- Remove marcadores anteriores
for _,w in ipairs(waypoints[name]) do
player:hud_remove(w)
end
-- Zera tabela
waypoints[name] = {}
-- Insere marcadores da zona atual
do
if revom.zonas.ocupada(x, z) == true then
-- Casas
local tb = revom.bd.pegar("zonas_ocupadas", x.." "..z)
for _,d in ipairs(tb.casa or {}) do
local w = player:hud_add({
hud_elem_type = "waypoint",
name = S("Casa de @1", d.name),
number = "205",
world_pos = d.pos
})
table.insert(waypoints[name], w)
end
end
end
-- Insere marcadores das zonas proximas
do
for _,m in ipairs(z1) do
if revom.zonas.ocupada(m[1], m[2]) == true then
-- Casas
local tb = revom.bd.pegar("zonas_ocupadas", m[1].." "..m[2])
for _,d in ipairs(tb.casa or {}) do
local w = player:hud_add({
hud_elem_type = "waypoint",
name = S("Casa de @1", d.name),
number = "205",
world_pos = d.pos
})
table.insert(waypoints[name], w)
end
end
end
end
-- Insere marcadores das zonas distantes
do
for _,m in ipairs(z2) do
if revom.zonas.ocupada(m[1], m[2]) == true then
-- Casas
local tb = revom.bd.pegar("zonas_ocupadas", m[1].." "..m[2])
for _,d in ipairs(tb.casa or {}) do
local w = player:hud_add({
hud_elem_type = "waypoint",
name = S("Casa de @1", d.name),
number = "205",
world_pos = d.pos
})
table.insert(waypoints[name], w)
end
end
end
end
-- Reinicia loop de atualização
if loop == true then
minetest.after(revom.waypoints_update_time, revom.atualizar_waypoints, player, true)
end
end
-- Atualiza waypoints de jogadores proximos de uma zona
revom.atualizar_waypoints_zona = function(x, z)
-- Pega jogadores que estao nas zonas afetadas
for _,player in ipairs(minetest.get_connected_players()) do
local xi, zi = revom.zonas.get_malha(player:get_pos())
if xi >= x-1 and xi <= x+1 and zi >= z-1 and zi <= z+1 then
revom.atualizar_waypoints(player)
end
end
end
-- Inicia loop ao conectar
minetest.register_on_joinplayer(function(player)
revom.atualizar_waypoints(player)
end)

View File

@ -160,6 +160,9 @@ revom.zonas.ocupar = function(x, z, tipo, pos, name)
-- Expandir limite de zonas ocupadas
revom.zonas.expande_aptas(x, z)
-- Atualiza waypoints de jogadores proximos
revom.atualizar_waypoints_zona(x, z)
end
-- Desocupar zona
@ -168,7 +171,6 @@ revom.zonas.desocupar = function(x, z, tipo, pos, name)
if revom.bd.verif("zonas_ocupadas", x.." "..z) == true then
dados = revom.bd.pegar("zonas_ocupadas", x.." "..z)
end
-- Novos dados
if tipo then
if dados[tipo] == nil then dados[tipo] = {} end
@ -180,12 +182,15 @@ revom.zonas.desocupar = function(x, z, tipo, pos, name)
end
revom.bd.salvar("zonas_ocupadas", x.." "..z, dados)
-- Atualiza waypoints de jogadores proximos
revom.atualizar_waypoints_zona(x, z)
end
-- Pegar zona apta para spawn
-- Retorna x, z
revom.zonas.get_spawn = function()
for i=0, 20, 1 do
local tb = zonas_livres[tostring(i)]
if table.maxn(tb) > 0 then
@ -196,6 +201,9 @@ revom.zonas.get_spawn = function()
return malha[1], malha[2]
end
end
-- Nenhuma malha encontrada
minetest.log("error", "Nenhuma zona apta para spawn encontrada, retornando zona 0,0")
end