Page Menu
Home
1F616EMO Bugtracker
Search
Configure Global Search
Log In
Files
F173321
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/newcomer_tips/init.lua b/newcomer_tips/init.lua
index f59dd61..450123a 100644
--- a/newcomer_tips/init.lua
+++ b/newcomer_tips/init.lua
@@ -1,83 +1,108 @@
-- twi_mods/newcomer_tips/init.lua
-- Tips for newcomers
--[[
The MIT License (MIT)
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.
]]
local S = minetest.get_translator("newcomer_tips")
local C = minetest.colorize
local time_joined = {}
local msg = table.concat({
S("Welcome to 1F616EMO Survival Server!"),
S("Read the rules at @1, or TL;DR: respect others.", "https://wiki-twi.1f616emo.xyz/wiki/Project:Rules"),
S("You can ask for help in the chatroom. Type \"/report\" if you want to contact the moderation team."),
S("Have fun!"),
}, "\n")
minetest.register_on_newplayer(function(player)
local meta = player:get_meta()
meta:set_int("newcomer_tips_send", 1)
end)
minetest.register_on_joinplayer(function(player)
local name = player:get_player_name()
local meta = player:get_meta()
if meta:get_int("newcomer_tips_send") == 1 then
time_joined[name] = os.time()
minetest.after(0.5, function()
if minetest.get_player_by_name(name) then
minetest.chat_send_all(C("yellow", S("Welcome our new player, @1!", name)))
minetest.chat_send_player(name, msg)
end
end)
end
end)
local TIME_NEEDED = 2 * 60
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
if time_joined[name] and os.time() - time_joined[name] > TIME_NEEDED then
local meta = player:get_meta()
meta:set_int("newcomer_tips_send", 0)
end
time_joined[name] = nil
end)
local function loop()
local now = os.time()
for name, time in pairs(time_joined) do
if now - time > TIME_NEEDED then
local player = minetest.get_player_by_name(name)
local meta = player:get_meta()
meta:set_int("newcomer_tips_send", 0)
time_joined[name] = nil
end
end
minetest.after(30, loop)
end
minetest.after(5, loop)
+
+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
+ local meta = player:get_meta()
+ if meta:get_int("newcomer_tips_send") ~= 1 then return end
+ message = string.lower(message)
+
+ if string.find(message, "spawn") then
+ minetest.after(0, function()
+ if minetest.get_player_by_name(name) then
+ minetest.chat_send_player(name, minetest.colorize("orange",
+ S("Tip! Type \"/spawn\" (without the quotes but with the slash) to get back tp the spawnpoint.")))
+ end
+ end)
+ elseif string.find(message, "escape") or string.find(message, "stuck") then
+ minetest.after(0, function()
+ if minetest.get_player_by_name(name) then
+ minetest.chat_send_player(name, minetest.colorize("orange",
+ S("Tip! Type \"/spawn\" (without the quotes but with the slash) to escape.")))
+ end
+ end)
+ end
+end)
diff --git a/newcomer_tips/mod.conf b/newcomer_tips/mod.conf
index 30ad949..4bbd383 100644
--- a/newcomer_tips/mod.conf
+++ b/newcomer_tips/mod.conf
@@ -1 +1,2 @@
name = newcomer_tips
+depends = twi_fx
diff --git a/static_spawn/init.lua b/static_spawn/init.lua
index 83d1dd8..f4a0208 100644
--- a/static_spawn/init.lua
+++ b/static_spawn/init.lua
@@ -1,106 +1,71 @@
-- 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 = {}
-
-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 6e79ea8..fbc9056 100644
--- a/static_spawn/mod.conf
+++ b/static_spawn/mod.conf
@@ -1,2 +1,2 @@
name = static_spawn
-depends = twi_fx, background_music
+depends = background_music
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Apr 16, 10:59 AM (2 d, 4 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
09/58/cf38227f2d332959b2cf774a5345
Default Alt Text
(8 KB)
Attached To
Mode
rTWIMODS Survival Server Custom Modifications
Attached
Detach File
Event Timeline
Log In to Comment