2020-04-11 03:15:26 +02:00
|
|
|
local sc = smart_chat
|
|
|
|
local S = sc.S
|
2020-04-17 13:44:52 +02:00
|
|
|
local cname = "toggle"
|
|
|
|
local short = "t"
|
|
|
|
local activate = minetest.settings:get_bool("smart_chat.cmd_" .. cname, true)
|
|
|
|
|
|
|
|
if(not activate) then return end
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
sc.register_help({
|
2020-04-17 13:44:52 +02:00
|
|
|
Name = cname,
|
|
|
|
Usage = "/c " .. cname,
|
2020-04-11 03:15:26 +02:00
|
|
|
Description = S("Turn's the permanent public Chat on or off."),
|
|
|
|
Parameter = "<>",
|
2020-04-17 13:44:52 +02:00
|
|
|
Shortcut = "/c " .. short,
|
2020-04-11 03:15:26 +02:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[cname] = function(player)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
local status = sc.public[player]
|
|
|
|
|
|
|
|
if(status == nil) then
|
2020-04-11 19:55:51 +02:00
|
|
|
if(sc.player[player] ~= nil) then
|
|
|
|
sc.public[player] = player
|
|
|
|
minetest.chat_send_player(player, sc.green .. S("The permanent public chat is now on."))
|
|
|
|
else
|
|
|
|
minetest.chat_send_player(player, sc.orange .. S("You are already in the public Chat."))
|
2020-04-12 20:35:34 +02:00
|
|
|
|
2020-04-11 19:55:51 +02:00
|
|
|
end
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
else
|
|
|
|
sc.public[player] = nil
|
|
|
|
minetest.chat_send_player(player, sc.orange .. S("The permanent public chat is now off."))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end -- sc["toggle"
|
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[short] = function(player, parameter)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
2020-04-17 13:44:52 +02:00
|
|
|
sc[cname](player, parameter)
|
2020-04-11 03:15:26 +02:00
|
|
|
|
|
|
|
end -- sc["t"
|