added static spawn point script
This commit is contained in:
parent
275b7690ca
commit
9e0e474f89
@ -7,6 +7,7 @@ To install, rename to "enhancements" and place in the mods/ directory.
|
|||||||
* clean-up server - unknown nodes and entities
|
* clean-up server - unknown nodes and entities
|
||||||
* [external_cmd]server chat messages from outside Minetest game
|
* [external_cmd]server chat messages from outside Minetest game
|
||||||
* detect AFK player
|
* detect AFK player
|
||||||
|
* spawn - set and go to static spawn point
|
||||||
* areas - control privilages
|
* areas - control privilages
|
||||||
|
|
||||||
External Commands
|
External Commands
|
||||||
|
7
init.lua
7
init.lua
@ -31,6 +31,13 @@ if PLAYER_AFK then
|
|||||||
print("[Mod][enhancements] PLAYER_AFK enabled")
|
print("[Mod][enhancements] PLAYER_AFK enabled")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- go to and set SPAWN_POINT
|
||||||
|
if SPAWN_POINT then
|
||||||
|
dofile(minetest.get_modpath("enhancements").."/spawn.lua")
|
||||||
|
|
||||||
|
print("[Mod][enhancements] SPAWN_POINT enabled")
|
||||||
|
end
|
||||||
|
|
||||||
-- manage privileges i areas mod - if using areas mod only for admin purposes
|
-- manage privileges i areas mod - if using areas mod only for admin purposes
|
||||||
-- WIP DONT ENABLE!
|
-- WIP DONT ENABLE!
|
||||||
if AREAS_ENHANCE and minetest.get_modpath("areas") then
|
if AREAS_ENHANCE and minetest.get_modpath("areas") then
|
||||||
|
@ -2,4 +2,5 @@ TOOLS_ENHANCE = true
|
|||||||
CLEAN_UNKNOWN = true
|
CLEAN_UNKNOWN = true
|
||||||
EXTERNAL_CMD = true
|
EXTERNAL_CMD = true
|
||||||
PLAYER_AFK = true
|
PLAYER_AFK = true
|
||||||
|
SPAWN_POINT = true
|
||||||
AREAS_ENHANCE = false
|
AREAS_ENHANCE = false
|
||||||
|
44
spawn.lua
Normal file
44
spawn.lua
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
--Spawn mod for Minetest
|
||||||
|
--Originally written by VanessaE (I think), rewritten by cheapie
|
||||||
|
--WTFPL
|
||||||
|
|
||||||
|
local spawn_spawnpos = minetest.setting_get_pos("static_spawnpoint")
|
||||||
|
|
||||||
|
minetest.register_chatcommand("spawn", {
|
||||||
|
params = "",
|
||||||
|
description = "Teleport to the spawn point",
|
||||||
|
func = function(name, param)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if not player then
|
||||||
|
return false, "Player not found"
|
||||||
|
end
|
||||||
|
if spawn_spawnpos then
|
||||||
|
player:setpos(spawn_spawnpos)
|
||||||
|
return true, "Teleporting to spawn..."
|
||||||
|
else
|
||||||
|
return false, "The spawn point is not set!"
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_chatcommand("setspawn", {
|
||||||
|
params = "",
|
||||||
|
description = "Sets the spawn point to your current position",
|
||||||
|
privs = { server=true },
|
||||||
|
func = function(name, param)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
if not player then
|
||||||
|
return false, "Player not found"
|
||||||
|
end
|
||||||
|
local pos = player:getpos()
|
||||||
|
local x = pos.x
|
||||||
|
local y = pos.y
|
||||||
|
local z = pos.z
|
||||||
|
local pos_string = x..","..y..","..z
|
||||||
|
local pos_string_2 = "Setting spawn point to ("..x..", "..y..", "..z..")"
|
||||||
|
minetest.setting_set("static_spawnpoint",pos_string)
|
||||||
|
spawn_spawnpos = pos
|
||||||
|
minetest.setting_save()
|
||||||
|
return true, pos_string_2
|
||||||
|
end,
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user