Page MenuHome1F616EMO Bugtracker

No OneTemporary

Size
10 KB
Referenced Files
None
Subscribers
None
diff --git a/chatroom_tutorial/init.lua b/chatroom_tutorial/init.lua
index 3b02394..4c087b0 100644
--- a/chatroom_tutorial/init.lua
+++ b/chatroom_tutorial/init.lua
@@ -1,63 +1,59 @@
-- twi_mods/chatroom_tutorial/init.lua
-- Tutorial of how to open chat, and hud message
-- Copyright (C) 2024 1F616EMO
-- SPDX-License-Identifier: LGPL-3.0-or-later
local S = minetest.get_translator("chatroom_tutorial")
local hud = mhud.init()
teacher.register_turorial("chatroom_tutorial:chatroom", {
title = S("How to find help?"),
{
texture = "chat_grant_interact_teacher_1.jpg",
text = {
S("If you need help in non-English languages, type in the chatroom with your mother language, " ..
"or use a translator (e.g. Google Translate) to communicate."),
S("To seek help, use the chatroom. To start chatting:"),
S("On Mobile Phones or iPads: Look at the top right corner of your screen. " ..
"Tap the chat box icon."),
S("On PC or Mac: Press the \"T\" key on your keyboard to open the chat box."),
}
},
})
local function show_to(name)
local player = minetest.get_player_by_name(name)
if player then
teacher.unlock_and_show(player, "chatroom_tutorial:chatroom", nil)
end
end
minetest.register_on_newplayer(function(player)
player:get_meta():set_int("chatroom_tutorial_show_msg", 1)
minetest.after(-1, show_to, player:get_player_name())
end)
minetest.register_on_joinplayer(function(player)
if player:get_meta():get_int("chatroom_tutorial_show_msg") ~= 0 then
hud:add(player, "chatroom_tutorial_show_msg", {
hud_elem_type = "text",
position = { x = 0.5, y = 0.5 },
offset = { x = 0, y = 42 },
text = S("Click on the top-right speech bubble icon to get help. (T on PC)"),
text_scale = 1,
color = 0xFFD700,
})
end
end)
-local register_on_chat_message =
- minetest.global_exists("beerchat")
- and beerchat.register_on_chat_message
- or minetest.register_on_chat_message
-register_on_chat_message(function(name, message)
+twi_fx.register_on_chat_message(function(name, message)
if string.sub(message, 1, 1) == "/" then return end
local player = minetest.get_player_by_name(name)
if not player then return end
if hud:exists(player, "chatroom_tutorial_show_msg") then
player:get_meta():set_int("chatroom_tutorial_show_msg", 0)
hud:remove(player, "chatroom_tutorial_show_msg")
end
end)
diff --git a/chatroom_tutorial/mod.conf b/chatroom_tutorial/mod.conf
index 512c474..f429ef5 100644
--- a/chatroom_tutorial/mod.conf
+++ b/chatroom_tutorial/mod.conf
@@ -1,3 +1,2 @@
name = chatroom_tutorial
-depends = teacher_core, mhud
-optional_depends = beerchat
+depends = teacher_core, mhud, twi_fx
diff --git a/spam_kick/init.lua b/spam_kick/init.lua
index b40f0ca..c5de05c 100644
--- a/spam_kick/init.lua
+++ b/spam_kick/init.lua
@@ -1,17 +1,13 @@
-- twi_mods/spam_kick/init.lua
-- Kick spammers
-- Copyright (C) 2024 1F616EMO
-- SPDX-License-Identifier: LGPL-3.0-or-later
-local register_on_chat_message =
- minetest.global_exists("beerchat")
- and beerchat.register_on_chat_message
- or minetest.register_on_chat_message
-register_on_chat_message(function(name, message)
+twi_fx.register_on_chat_message(function(name, message)
if string.sub(message, 1, 1) == "/" then return end
if string.find(message, "ronwyatt%.com") and minetest.get_player_by_name(name) then
minetest.chat_send_player(name, "Spam keyword matched. (#14)")
return true
end
end)
\ No newline at end of file
diff --git a/spam_kick/mod.conf b/spam_kick/mod.conf
index 47c4fb0..9a84fce 100644
--- a/spam_kick/mod.conf
+++ b/spam_kick/mod.conf
@@ -1,2 +1,2 @@
name = spam_kick
-optional_depends = beerchat
+depends = twi_fx
diff --git a/static_spawn/init.lua b/static_spawn/init.lua
index f9fc4bd..83d1dd8 100644
--- a/static_spawn/init.lua
+++ b/static_spawn/init.lua
@@ -1,106 +1,106 @@
-- twi_mods/static_spawn/init.lua
--[[
Copyright (C) 2014-2021 AndrejIT, spfar, mightyjoe781
Copyright (C) 2024 1F616EMO
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
]]
S = minetest.get_translator("spawn")
minetest.register_chatcommand("spawn", {
description = S("Teleport to spawnpoint"),
privs = {
home = true
},
func = function(name)
local player = minetest.get_player_by_name(name)
if not player then
return false, S("Player object not found.")
end
local spawn_pos = minetest.setting_get_pos("static_spawnpoint")
if not spawn_pos then
return false, S("Spawn point not set. Consult moderators to set a proper static spawnpoint.")
end
player:set_pos(spawn_pos)
background_music.set_start_play_gap(name, 2)
background_music.decide_and_play(player, true)
return true, S("Teleported to Spawn!")
end
})
minetest.register_chatcommand("setspawn", {
description = S("Override the static spawnpoint"),
privs = {
server = true
},
param = "[<pos>]",
func = function(name, param)
if param == "" then
local player = minetest.get_player_by_name(name)
if not player then
return false, S("Player object not found.")
end
param = minetest.pos_to_string(player:get_pos(), 0)
else
local pos = core.string_to_pos(param)
if not pos then
return false, S("Invalid position given.")
end
param = minetest.pos_to_string(pos)
end
minetest.settings:set("static_spawnpoint", param)
return true, S("Static spawnpoint set to @1.", param)
end
})
local last_shouted_spawn = {}
-beerchat.register_on_chat_message(function(name, message)
+twi_fx.register_on_chat_message(function(name, message)
local player = minetest.get_player_by_name(name)
local spawn_pos = minetest.setting_get_pos("static_spawnpoint")
if not (player and spawn_pos) then return end
message = string.trim(message)
message = string.lower(message)
if message == "spawn" then
local now = os.time()
if last_shouted_spawn[name]
and now - last_shouted_spawn[name] < 30 then
player:set_pos(spawn_pos)
background_music.decide_and_play(player, true)
last_shouted_spawn[name] = nil
else
last_shouted_spawn[name] = now
end
minetest.after(0, function()
if minetest.get_player_by_name(name) then
minetest.chat_send_player(name, minetest.colorize("orange",
S("Tips! Put a slash (/) before \"spawn\" (i.e. /spawn) to teleport back Spawn instantly.")))
end
end)
else
last_shouted_spawn[name] = nil
end
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
last_shouted_spawn[name] = nil
end)
diff --git a/static_spawn/mod.conf b/static_spawn/mod.conf
index 83b6136..6e79ea8 100644
--- a/static_spawn/mod.conf
+++ b/static_spawn/mod.conf
@@ -1,2 +1,2 @@
name = static_spawn
-depends = beerchat, background_music
+depends = twi_fx, background_music
diff --git a/twi_fx/init.lua b/twi_fx/init.lua
index fd38ffb..ac7dc23 100644
--- a/twi_fx/init.lua
+++ b/twi_fx/init.lua
@@ -1,49 +1,50 @@
-- twi_mods/twi_fx/init.lua
-- Common functions
--[[
Copyright © 2024 1F616EMO
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
]]
twi_fx = {}
function twi_fx.register_all_stairsplus(modname, name)
local nodename = modname .. ":" .. name
local def = table.copy(minetest.registered_nodes[nodename])
def.is_ground_content = false
def.sunlight_propagates = true
stairsplus:register_all(modname, name, nodename, def)
end
-function twi_fx.chat_send_moderators(msg)
- beerchat.on_channel_message("Moderators", "SYSTEM", msg)
-end
-
function twi_fx.override_group(name, new_groups)
local groups = table.copy(minetest.registered_items[name].groups or {})
for k, v in pairs(new_groups) do
groups[k] = v == 0 and nil or v
end
minetest.override_item(name, {
groups = groups,
})
end
+
+twi_fx.register_on_chat_message =
+ minetest.global_exists("beerchat")
+ and beerchat.register_on_chat_message
+ or minetest.register_on_chat_message
diff --git a/twi_fx/mod.conf b/twi_fx/mod.conf
index c78bf85..4fdaff0 100644
--- a/twi_fx/mod.conf
+++ b/twi_fx/mod.conf
@@ -1,2 +1,3 @@
name = twi_fx
-depends = moreblocks, beerchat
+depends = moreblocks
+optional_depends = beerchat

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jun 14, 10:02 AM (1 d, 57 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
01/27/296ca30da542e2be7ced96966cee
Default Alt Text
(10 KB)

Event Timeline