Personhood.
[places.git] / init.lua
1 local spawn_spawnpos = minetest.setting_get_pos("static_spawnpoint")
2 local execution_pos = {x=-310,y=0,z=-40}
3
4 places = {}
5
6 places.register_place = function (name, pos, command)
7 if not command then
8 command = name
9 end
10 minetest.register_chatcommand(command, {
11 params = "",
12 description = "Teleport to "..name,
13 func = function(nm, param)
14 local player = minetest.get_player_by_name(nm)
15 if not player then
16 return false, "Player not found"
17 end
18 if xban and xban.get_property(nm, "jailed") then
19 player:setpos(execution_pos)
20 return true, "Nice try! You can't escape!"
21 end
22 player:setpos(pos)
23 return true, "Teleporting to "..name.."..."
24 end,
25 })
26 end
27
28
29 if spawn_spawnpos then
30 places.register_place("Spawn", spawn_spawnpos, "spawn")
31 end
32 places.register_place("Origin", {x=0, y=0, z=0}, "origin")
33 places.register_place("South Forest", {x=285, y=9, z=-2047}, "sf")
34 places.register_place("Personhood", {x=1532, y=28, z=2971}, "ph")
35
36 -- minetest.register_chatcommand("spawn", {
37 -- params = "",
38 -- description = "Teleport to the spawn point",
39 -- func = function(name, param)
40 -- local player = minetest.get_player_by_name(name)
41 -- if not player then
42 -- return false, "Player not found"
43 -- end
44 -- if spawn_spawnpos then
45 -- player:setpos(spawn_spawnpos)
46 -- return true, "Teleporting to spawn..."
47 -- else
48 -- return false, "The spawn point is not set!"
49 -- end
50 -- end,
51 -- })
52
53 -- minetest.register_chatcommand("origin", {
54 -- params = "",
55 -- privs = {teleport = true},
56 -- description = "Teleport to (0,0,0)",
57 -- func = function(name, param)
58 -- local player = minetest.get_player_by_name(name)
59 -- if not player then
60 -- return false, "Player not found"
61 -- end
62 -- player:setpos({x=0, y=0, z=0})
63 -- return true, "Teleporting to origin..."
64 -- end,
65 -- })
66
67
68 minetest.register_on_newplayer(function(player)
69 player:setpos({x=0, y=-1, z=0})
70 end
71 )