subrepo:
  subdir:   "mods/spawn"
  merged:   "c5be92a"
upstream:
  origin:   "https://github.com/cheapie/spawn.git"
  branch:   "master"
  commit:   "c5be92a"
git-subrepo:
  version:  "0.3.1"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "a7ee886"
master
dicebox 2017-02-10 18:27:50 +01:00
parent 8ee97c6f85
commit 00ea704efb
3 changed files with 55 additions and 0 deletions

11
mods/spawn/.gitrepo Normal file
View File

@ -0,0 +1,11 @@
; DO NOT EDIT (unless you know what you are doing)
;
; This subdirectory is a git "subrepo", and this file is maintained by the
; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme
;
[subrepo]
remote = https://github.com/cheapie/spawn.git
branch = master
commit = c5be92a8a7c868e2db4380ce02e879cf4e7e848b
parent = 8ee97c6f858f8b1021d7ea13fed8293a77709913
cmdver = 0.3.1

0
mods/spawn/depends.txt Normal file
View File

44
mods/spawn/init.lua Normal file
View 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,
})