43 lines
935 B
Lua
43 lines
935 B
Lua
rgt_realms = {
|
|
realms = {
|
|
void = {
|
|
sky = {
|
|
type = "plain",
|
|
base_color = "#000"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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
|
|
})
|