beerchat/init.lua

92 lines
2.3 KiB
Lua
Raw Normal View History

--
-- Mod settings -- Change these to your liking
2020-01-18 15:09:05 +01:00
local http = minetest.request_http_api()
2019-08-05 08:33:20 +02: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-05 08:33:20 +02:00
-- The default color of channels when no color is specified
default_channel_color = "#ffffff",
2019-08-05 08:33:20 +02: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-05 08:33:20 +02:00
-- General sound when managing channels like /cc, /dc etc
channel_management_sound = "beerchat_chirp",
2019-08-05 08:33:20 +02:00
-- Sound when a message is sent to a channel
channel_message_sound = "beerchat_chime",
2019-08-05 08:33:20 +02:00
main_channel_message_string = "|#${channel_name}| <${from_player}> ${message}",
2019-08-06 12:59:42 +02:00
mod_storage = minetest.get_mod_storage(),
2019-08-05 08:33:20 +02:00
channels = {},
playersChannels = {},
2020-01-18 15:09:05 +01:00
currentPlayerChannel = {},
-- web settings
url = minetest.settings:get("beerchat.url") or "http://127.0.0.1:8080",
2020-03-09 12:53:46 +01:00
http = http, -- will be removed after init
2020-01-18 15:09:05 +01:00
2020-03-09 12:53:46 +01: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-05 08:33:20 +02:00
local MP = minetest.get_modpath("beerchat")
2019-11-12 18:37:39 +01:00
dofile(MP.."/common.lua")
2019-08-05 09:08:41 +02:00
dofile(MP.."/format_message.lua")
dofile(MP.."/hooks.lua")
2019-08-05 08:33:20 +02: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 18:41:58 +02:00
dofile(MP.."/message.lua")
2019-08-05 08:33:20 +02:00
dofile(MP.."/chatcommands.lua")
2020-01-18 15:24:08 +01:00
if beerchat.http then
2020-01-18 15:09:05 +01:00
-- load web stuff
2020-01-18 15:24:08 +01:00
print("beerchat connects to proxy-endpoint at: " .. beerchat.url)
2020-01-18 15:09:05 +01:00
dofile(MP.."/web/executor.lua")
dofile(MP.."/web/tx.lua")
dofile(MP.."/web/rx.lua")
2020-03-09 12:53:46 +01:00
dofile(MP.."/web/login.lua")
dofile(MP.."/web/logout.lua")
dofile(MP.."/web/common.lua")
dofile(MP.."/web/tan.lua")
2020-01-18 15:09:05 +01:00
end
-- remove http ref
beerchat.http = nil
-- integrated extensions (could also be different mod)
2020-02-16 22:13:58 +01:00
if minetest.settings:get_bool("beerchat.enable_jail") then
dofile(MP.."/jail.lua")
end
if minetest.settings:get_bool("beerchat.enable_cleaner") then
dofile(MP.."/cleaner.lua")
end
2020-05-25 13:01:33 +02:00
if minetest.settings:get_bool("enable_beerchat_integration_test") then
dofile(MP.."/integration_test.lua")
end
2019-08-05 08:33:20 +02:00
print("[OK] beerchat")