beerchat/init.lua

98 lines
2.5 KiB
Lua
Raw Normal View History

--
-- Mod settings -- Change these to your liking
2020-01-18 06:09:05 -08:00
local http = minetest.request_http_api()
2019-08-04 23:33:20 -07:00
beerchat = {
-- The main channel is the one you send messages to when no channel is specified
main_channel_name = minetest.settings:get("beerchat.main_channel_name"),
2019-08-04 23:33:20 -07:00
-- The default color of channels when no color is specified
default_channel_color = "#ffffff",
2019-08-04 23:33:20 -07:00
-- Global flag to enable/ disable sounds
enable_sounds = true,
-- how loud the sounds should be by default (0.0 = low, 1.0 = max)
sounds_default_gain = 0.3,
2019-08-04 23:33:20 -07:00
-- General sound when managing channels like /cc, /dc etc
channel_management_sound = "beerchat_chirp",
2019-08-04 23:33:20 -07:00
-- Sound when a message is sent to a channel
channel_message_sound = "beerchat_chime",
2019-08-04 23:33:20 -07:00
main_channel_message_string = "|#${channel_name}| <${from_player}> ${message}",
2020-11-20 09:56:21 -08:00
moderator_channel_name = minetest.settings:get("beerchat.moderator_channel_name"),
2019-08-06 03:59:42 -07:00
mod_storage = minetest.get_mod_storage(),
2019-08-04 23:33:20 -07:00
channels = {},
playersChannels = {},
2020-01-18 06:09:05 -08:00
currentPlayerChannel = {},
-- web settings
url = minetest.settings:get("beerchat.url") or "http://127.0.0.1:8080",
2020-03-09 04:53:46 -07:00
http = http, -- will be removed after init
2020-01-18 06:09:05 -08:00
2020-03-09 04:53:46 -07:00
-- mapped remote users (irc, discord)
-- data: local user => remote user
remote_username_map = {}
}
if nil == beerchat.main_channel_name or "" == beerchat.main_channel_name then
beerchat.main_channel_name = "main"
end
2019-08-04 23:33:20 -07:00
local MP = minetest.get_modpath("beerchat")
2019-11-12 09:37:39 -08:00
dofile(MP.."/common.lua")
2019-08-05 00:08:41 -07:00
dofile(MP.."/format_message.lua")
dofile(MP.."/hooks.lua")
2019-08-04 23:33:20 -07:00
dofile(MP.."/storage.lua")
dofile(MP.."/session.lua")
dofile(MP.."/pm.lua")
dofile(MP.."/hash.lua")
dofile(MP.."/me.lua")
dofile(MP.."/whisper.lua")
2019-08-05 09:41:58 -07:00
dofile(MP.."/message.lua")
2019-08-04 23:33:20 -07:00
dofile(MP.."/chatcommands.lua")
2020-01-18 06:24:08 -08:00
if beerchat.http then
2020-01-18 06:09:05 -08:00
-- load web stuff
2020-01-18 06:24:08 -08:00
print("beerchat connects to proxy-endpoint at: " .. beerchat.url)
2020-01-18 06:09:05 -08:00
dofile(MP.."/web/executor.lua")
dofile(MP.."/web/tx.lua")
2020-09-11 12:09:44 -07:00
dofile(MP.."/web/audit.lua")
2020-01-18 06:09:05 -08:00
dofile(MP.."/web/rx.lua")
2020-03-09 04:53:46 -07:00
dofile(MP.."/web/login.lua")
dofile(MP.."/web/logout.lua")
dofile(MP.."/web/common.lua")
dofile(MP.."/web/tan.lua")
2020-01-18 06:09:05 -08:00
end
-- remove http ref
beerchat.http = nil
-- integrated extensions (could also be different mod)
2020-02-16 13:13:58 -08:00
if minetest.settings:get_bool("beerchat.enable_jail") then
dofile(MP.."/plugin/jail.lua")
end
if minetest.settings:get_bool("beerchat.enable_cleaner") then
dofile(MP.."/plugin/cleaner.lua")
end
dofile(MP.."/plugin/override.lua")
2020-05-25 04:01:33 -07:00
if minetest.settings:get_bool("enable_beerchat_integration_test") then
dofile(MP.."/integration_test.lua")
end
2019-08-04 23:33:20 -07:00
print("[OK] beerchat")