Lançamento inicial

master
BrunoMine 2017-06-17 17:20:25 -03:00
parent 8080ff5d38
commit 60711bc90c
6 changed files with 135 additions and 1 deletions

View File

@ -1 +1,29 @@
portais
# Portais v1.0.0
[![Baixar](https://img.shields.io/badge/Baixar-v1.0.0-green.svg)](https://github.com/BrunoMine/portais/archive/v1.0.0.zip)
[![Projeto](https://img.shields.io/badge/Git-Projeto-green.svg)](https://github.com/BrunoMine/portais)
[![!Bower](https://img.shields.io/badge/Bower-Projeto-green.svg)](https://minetest-bower.herokuapp.com/mods/portais)
[![!Fórum](https://img.shields.io/badge/Forum-Projeto-green.svg)](http://forum.minetestbrasil.com)
[![Licença](https://img.shields.io/badge/Licença-LGPL_v3.0-blue.svg)](https://github.com/BrunoMine/portais/blob/master/LICENSE)
## Descrição
Adiciona portais para serem usados nas cidades do mod gestor
## Recursos do projeto
* [Baixar](https://github.com/BrunoMine/portais/archive/v1.0.0.zip)
* [Projeto](https://github.com/BrunoMine/portais)
* [Bower](https://minetest-bower.herokuapp.com/mods/portais)
## Requisitos
* Minetest 0.4.15 ou superior
## 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)
BrunoMine, Bruno Borges <borgesdossantosbruno@gmail.com> (CC BY-SA 3.0)

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
gestor

14
init.lua Normal file
View File

@ -0,0 +1,14 @@
--[[
Mod Portais para Minetest
Memor v1.2 Copyright (C) 2016 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/>.
Inicializador de scripts
]]
-- Carregamento de arquivos de código
dofile(minetest.get_modpath("portais").."/node.lua")

90
node.lua Normal file
View File

@ -0,0 +1,90 @@
--
-- Nodes
--
-- Calculando valores
-- Lugares
local string_de_lugares = ""
local id_lugares = {}
-- Fosmpec padrao
local formspec_p = ""
-- Atualizar lista de vilas
local atualizar_lista = function()
if gestor then
-- Pegar lugares do gestor
if gestor then
string_de_lugares = ""
lista_de_pos = {}
-- Minemacro
string_de_lugares = string_de_lugares .. "Minemacro"
table.insert(id_lugares, {nome="Minemacro",pos=gestor.bd:pegar("centro", "pos")})
-- Vilas
for _,vila in ipairs(minetest.get_dir_list(minetest.get_worldpath().."/gestor/vilas")) do
local dados = gestor.bd:pegar("vilas", vila)
string_de_lugares = string_de_lugares .. "," .. dados.nome
table.insert(id_lugares, {nome=dados.nome,pos=dados.pos})
end
-- Atualiza formspec
formspec_p = "size[6,5]"
..default.gui_bg
..default.gui_bg_img
.."label[1,0.25;Escolha seu destino]"
.."textlist[0.5,1;4.8,3;vila;"..string_de_lugares.."]"
end
end
end
atualizar_lista()
-- Exibir Formspec
local exibir_formspec = function(name, escolha)
if escolha then
minetest.show_formspec(name, "portais:bilheteria", formspec_p.."button_exit[0.5,4;5,1;viajar;Viajar]")
else
minetest.show_formspec(name, "portais:bilheteria", formspec_p)
end
end
-- Bilheteria
minetest.register_node("portais:bilheteria", {
description = "Bilheteria",
tiles = {
"default_wood.png", -- Cima
"default_wood.png", -- Baixo
"default_wood.png^portais_bilheteria.png", -- Lado direito
"default_wood.png^portais_bilheteria.png", -- Lado esquerda
"default_wood.png^portais_bilheteria.png", -- Fundo
"default_wood.png^portais_bilheteria.png" -- Frente
},
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
sounds = default.node_sound_wood_defaults(),
paramtype2 = "facedir",
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_string("infotext", "Bilheteria")
end,
on_rightclick = function(pos, node, player)
exibir_formspec(player:get_player_name())
end,
})
-- Receptor de campos
local escolha = {}
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname == "portais:bilheteria" then
if fields.vila then
local name = player:get_player_name()
local n = string.split(fields.vila, ":")
escolha[name] = n[2]
exibir_formspec(name, n[2])
end
if fields.viajar then
local name = player:get_player_name()
local id = tonumber(escolha[name])
player:setpos(id_lugares[id].pos)
minetest.chat_send_player(name, "Bem vindo a "..id_lugares[id].nome)
end
end
end)

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB