Added direct teleport into exec chamber
[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
35 -- minetest.register_chatcommand("spawn", {
36 -- params = "",
37 -- description = "Teleport to the spawn point",
38 -- func = function(name, param)
39 -- local player = minetest.get_player_by_name(name)
40 -- if not player then
41 -- return false, "Player not found"
42 -- end
43 -- if spawn_spawnpos then
44 -- player:setpos(spawn_spawnpos)
45 -- return true, "Teleporting to spawn..."
46 -- else
47 -- return false, "The spawn point is not set!"
48 -- end
49 -- end,
50 -- })
51
52 -- minetest.register_chatcommand("origin", {
53 -- params = "",
54 -- privs = {teleport = true},
55 -- description = "Teleport to (0,0,0)",
56 -- func = function(name, param)
57 -- local player = minetest.get_player_by_name(name)
58 -- if not player then
59 -- return false, "Player not found"
60 -- end
61 -- player:setpos({x=0, y=0, z=0})
62 -- return true, "Teleporting to origin..."
63 -- end,
64 -- })
65
66
67 minetest.register_on_newplayer(function(player)
68 player:setpos({x=0, y=-1, z=0})
69 end
70 )