Adição de suporte para manipulus
parent
06bce66a18
commit
bae3b8fc17
37
chat.lua
37
chat.lua
|
@ -68,7 +68,18 @@ local enviar_msg = function(name, msg, falante)
|
|||
elseif status == "off" then
|
||||
return
|
||||
|
||||
-- Verifica se jogador está ouvindo apenas seu grupo
|
||||
-- Verifica se o jogador está ouvindo apenas seu grupo de guilda
|
||||
elseif status == "guilda" then
|
||||
minetest.chat_send_player(name, "<"..multichat.prefixo(falante)..falante.."> "..msg)
|
||||
|
||||
-- Evita avisar a si mesmo
|
||||
if name ~= falante then
|
||||
som_avisar(name, msg)
|
||||
else
|
||||
som_avisar(name)
|
||||
end
|
||||
|
||||
-- Verifica se jogador está ouvindo apenas seu grupo privado
|
||||
elseif status == "grupo" and multichat.grupos[name] then
|
||||
|
||||
-- Verifica se falante está no grupo
|
||||
|
@ -99,8 +110,30 @@ minetest.register_on_chat_message(function(name, msg)
|
|||
-- Verificar se está desativado
|
||||
elseif status == "off" then
|
||||
minetest.chat_send_player(name, "Bate-papo desativado")
|
||||
|
||||
|
||||
-- Verifica se jogador está falando apenas com seu grupo
|
||||
elseif status == "guilda" then
|
||||
|
||||
-- Verifica se o recurso esta ativo
|
||||
if multichat.guild == false then return true end
|
||||
|
||||
-- Mod manipulus
|
||||
if multichat.mod_guild == "manipulus" then
|
||||
-- Guilda do ouvinte
|
||||
local mg = manipulus.get_player_grupo(name)
|
||||
-- Verifica se guilda ainda existe
|
||||
if mg == nil or manipulus.existe_grupo(mg) == false then return true end
|
||||
-- Envia a mensagem para todos os jogadores
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
local n = player:get_player_name()
|
||||
if manipulus.get_player_grupo(n) == mg then
|
||||
enviar_msg(n, msg, name)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Verifica se jogador está falando apenas com seu grupo privado
|
||||
elseif status == "grupo" then
|
||||
|
||||
-- Envia a mensagem para todos os jogadores do grupo
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
default
|
||||
sfinv?
|
||||
mymenu?
|
||||
manipulus?
|
||||
|
|
7
init.lua
7
init.lua
|
@ -25,7 +25,12 @@ if minetest.get_version().string and string.find(minetest.get_version().string,
|
|||
minetest.log("error", "[MULTICHAT] Versao imcompativel (use 0.4.16 ou superior)")
|
||||
end
|
||||
|
||||
|
||||
-- Verifica se tem mod de grupo/guilda
|
||||
multichat.guild = false
|
||||
if minetest.get_modpath("manipulus") then
|
||||
multichat.guild = true
|
||||
multichat.mod_guild = "manipulus"
|
||||
end
|
||||
|
||||
-- Modpath
|
||||
local modpath = minetest.get_modpath("multichat")
|
||||
|
|
21
me.lua
21
me.lua
|
@ -33,6 +33,27 @@ local enviar_msg = function(name, msg, falante)
|
|||
elseif status == "off" then
|
||||
return
|
||||
|
||||
-- Verifica se está em grupo da guilda
|
||||
elseif status == "guilda" then
|
||||
|
||||
-- Verifica se o recurso esta ativo
|
||||
if multichat.guild == false then return end
|
||||
|
||||
-- Mod manipulus
|
||||
if multichat.mod_guild == "manipulus" then
|
||||
-- Guilda do ouvinte
|
||||
local my_guild = manipulus.get_player_grupo(name)
|
||||
-- Verifica se guilda ainda existe
|
||||
if my_guild == nil or manipulus.existe_grupo(my_guild) == false then return end
|
||||
-- Guilda do falante
|
||||
local you_guild = manipulus.get_player_grupo(falante)
|
||||
-- Verifica se guilda ainda existe
|
||||
if you_guild == nil or manipulus.existe_grupo(you_guild) == false then return end
|
||||
-- Envia mensagem
|
||||
minetest.chat_send_player(name, "* "..falante.." "..msg)
|
||||
som_avisar(name, msg)
|
||||
end
|
||||
|
||||
-- Verifica se jogador está ouvindo apenas seu grupo
|
||||
elseif status == "grupo" and multichat.grupos[name] then
|
||||
|
||||
|
|
44
menu.lua
44
menu.lua
|
@ -31,10 +31,14 @@ multichat.acessar_menu = function(name)
|
|||
elseif st == "off" then
|
||||
status = status .. minetest.colorize("#FF0000", "Desativado")
|
||||
|
||||
-- Caso esteja no Grupo
|
||||
-- Caso esteja no Grupo Privado
|
||||
elseif st == "grupo" then
|
||||
status = status .. minetest.colorize("#3366FF", "em Privado")
|
||||
|
||||
-- Caso esteja no Grupo da Guilda
|
||||
elseif st == "guilda" then
|
||||
status = status .. minetest.colorize("#3366FF", "em Grupo")
|
||||
|
||||
-- Caso nenhuma situação prevista
|
||||
else
|
||||
status = status .. "Erro"
|
||||
|
@ -44,7 +48,14 @@ multichat.acessar_menu = function(name)
|
|||
local st_som = player:get_attribute("multichat_som") or "true"
|
||||
local st_chamada = player:get_attribute("multichat_chamada") or "true"
|
||||
|
||||
minetest.show_formspec(name, "multichat:menu", "size[4,5]"
|
||||
local formspec = ""
|
||||
if multichat.guild == true then
|
||||
formspec = formspec .. "size[4,6]"
|
||||
else
|
||||
formspec = formspec .. "size[4,5]"
|
||||
end
|
||||
|
||||
formspec = formspec
|
||||
..default.gui_bg
|
||||
..default.gui_bg_img
|
||||
.."label[0,0;Meu Bate-Papo \n"..status.."]"
|
||||
|
@ -55,7 +66,13 @@ multichat.acessar_menu = function(name)
|
|||
.."button_exit[0,2.2;4,1;desativar;Desativar]"
|
||||
.."button_exit[0,3.2;4,1;publico;Publico]"
|
||||
.."button_exit[0,4.2;3.3,1;privado;Privado]"
|
||||
.."image_button[3.15,4.3;0.825,0.825;default_book_written.png;grupo;]")
|
||||
.."image_button[3.15,4.3;0.825,0.825;default_book_written.png;grupo;]"
|
||||
|
||||
-- Botão de grupo
|
||||
if multichat.guild == true then
|
||||
formspec = formspec .. "button_exit[0,5.2;4,1;guild;Guilda]"
|
||||
end
|
||||
minetest.show_formspec(name, "multichat:menu", formspec)
|
||||
end
|
||||
|
||||
-- Acessar menu do grupo
|
||||
|
@ -121,18 +138,31 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.desativar then
|
||||
player:set_attribute("multichat_status", "off")
|
||||
minetest.chat_send_player(player:get_player_name(), "Bate-papo desativado")
|
||||
|
||||
|
||||
elseif fields.publico then
|
||||
player:set_attribute("multichat_status", "pub")
|
||||
minetest.chat_send_player(player:get_player_name(), "Foste para o bate-papo publico")
|
||||
|
||||
|
||||
elseif fields.privado then
|
||||
player:set_attribute("multichat_status", "grupo")
|
||||
minetest.chat_send_player(player:get_player_name(), "Foste para o bate-papo privado")
|
||||
|
||||
|
||||
elseif fields.grupo then
|
||||
acessar_menu_grupo(player:get_player_name())
|
||||
|
||||
|
||||
-- Guilda
|
||||
elseif fields.guild then
|
||||
-- Manipulus
|
||||
if multichat.mod_guild == "manipulus" then
|
||||
local grupo = manipulus.get_player_grupo(player:get_player_name())
|
||||
if grupo == nil or manipulus.existe_grupo(grupo) == false then
|
||||
minetest.chat_send_player(player:get_player_name(), "Precisa entrar em um grupo")
|
||||
else
|
||||
player:set_attribute("multichat_status", "guilda")
|
||||
minetest.chat_send_player(player:get_player_name(), "Foste para o bate-papo do grupo '"..grupo.."'")
|
||||
end
|
||||
end
|
||||
|
||||
-- Caixas de seleção (avisos sonoros)
|
||||
elseif fields.som then
|
||||
player:set_attribute("multichat_som", fields.som)
|
||||
|
|
Loading…
Reference in New Issue