-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.lua
68 lines (58 loc) · 2.02 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
--Version 0.3
--value for space, change the value in minetest.conf
local space = tonumber(minetest.settings:get("se_space")) or 20000
--setting for enabling physics or not
local physics = minetest.settings:get_bool("se_physics", false)
--The skybox for space, feel free to change it to however you like.
local spaceskybox = {
"sky_pos_y.png",
"sky_neg_y.png",
"sky_pos_z.png",
"sky_neg_z.png",
"sky_neg_x.png",
"sky_pos_x.png",
}
--default sky for minetest
local default_sky = {
type = "regular",
sky_color = {
day_sky = "#8cbafa",
day_horizon = "#9bc1f0",
dawn_sky = "#b4bafa",
dawn_horizon = "#bac1f0",
night_sky = "#006aff",
night_horizon = "#4090ff",
indoors = "#646464",
fog_tint_type = "default"
},
clouds = true
}
local time = 0
minetest.register_globalstep(function(dtime)
time = time + dtime
if time > 1 then
for _, player in ipairs(minetest.get_connected_players()) do
time = 0
local name = player:get_player_name()
local pos = player:getpos()
--if in space, set space skybox and physics
if minetest.get_player_by_name(name) and pos.y >= space then
player:set_sky({
base_color = "#000000",
type = "skybox",
textures = spaceskybox,
clouds = false,
})
player:set_sun({visible = false, sunrise_visible = false})
player:set_moon({visible = false})
if physics then player:set_physics_override(1, 0.6, 0.2) end
--If the player is on Earth reset to default skybox and physics
elseif minetest.get_player_by_name(name) and pos.y < space then
player:set_sky(default_sky)
player:set_moon({visible = true})
player:set_sun({visible = true})
if physics then player:set_physics_override(1, 1, 1) end
end
end
end
end)