Page MenuHome1F616EMO Bugtracker

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/spawn/mod.conf b/spawn/mod.conf
deleted file mode 100644
index 446665e..0000000
--- a/spawn/mod.conf
+++ /dev/null
@@ -1 +0,0 @@
-name = spawn
\ No newline at end of file
diff --git a/spawn/LICENSE b/static_spawn/LICENSE
similarity index 100%
rename from spawn/LICENSE
rename to static_spawn/LICENSE
diff --git a/spawn/init.lua b/static_spawn/init.lua
similarity index 59%
rename from spawn/init.lua
rename to static_spawn/init.lua
index 6388905..7a18359 100644
--- a/spawn/init.lua
+++ b/static_spawn/init.lua
@@ -1,42 +1,69 @@
--- twi_mods/spawn/init.lua
+-- 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
+ 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.")
+ return false, S("Spawn point not set. Consult moderators to set a proper static spawnpoint.")
end
player:set_pos(spawn_pos)
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
})
\ No newline at end of file
diff --git a/static_spawn/mod.conf b/static_spawn/mod.conf
new file mode 100644
index 0000000..6e03886
--- /dev/null
+++ b/static_spawn/mod.conf
@@ -0,0 +1 @@
+name = static_spawn
\ No newline at end of file

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jun 10, 1:34 PM (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e6/6c/b7d712b3b9f578d87f2fdb6a01e5
Default Alt Text
(3 KB)

Event Timeline