51 lines
1.2 KiB
Lua
51 lines
1.2 KiB
Lua
rgt_realms = {
|
|
realms = {
|
|
void = {
|
|
name = "void",
|
|
label = "Void",
|
|
sky = {
|
|
type = "plain",
|
|
base_color = "#000"
|
|
}
|
|
},
|
|
surface = {
|
|
name = "surface",
|
|
label = "Surface",
|
|
max = vector.new(-31000, -5000, -31000),
|
|
min = vector.new(31000, 1000, 31000)
|
|
}
|
|
}
|
|
}
|
|
local ns = rgt_realms
|
|
|
|
function ns.register_realm(def)
|
|
ns.realms[def.name] = def
|
|
end
|
|
|
|
function ns.get_realm_at_pos(pos)
|
|
for name, x in pairs(ns.realms) do
|
|
if name ~= "void" and vector.in_area(pos, x.min, x.max) then
|
|
return name
|
|
end
|
|
end
|
|
return "void"
|
|
end
|
|
|
|
function ns.update_realm(m)
|
|
local realm = ns.realms[ns.get_realm_at_pos(m.object:get_pos())]
|
|
if realm.sky then
|
|
m.object:set_sky(realm.sky)
|
|
end
|
|
end
|
|
|
|
function ns.check_position(m)
|
|
|
|
end
|
|
|
|
|
|
minetest.register_chatcommand("realm", {
|
|
func = function(name, args)
|
|
minetest.get_player_by_name(name):set_pos(ns.realms["outback"].min +(ns.realms["outback"].max -ns.realms["outback"].min) /2)
|
|
ns.update_realm(rgt.players[name])
|
|
end
|
|
})
|