This mod adds a simple coded interchangeable skybox which adds Space to a regular minetest world, adding certain realism when going into higher altitudes.
When on earth
When in space (Currently activates at Y = 1000)
Screenshots were taken from one of my WIP servers, please focus on the skybox changes instead of the other things that are shown in these images.
NOTE: This mod is still work in progress, would like volunteers to help me test this mod entirely.
If you have any further Ideas for this mod feel free to share them here.
NOTE: I've tested this on one of my public minetest servers during my spare time, so far it works very well.
The skybox images that I was using as a placeholder to test the mod is from Xonotic, please give credit to Cuinn Herrick if you are using his images.
Credits: Kudos to Amaz for helping me adding a check timer code and paramat for reviewing the code.
Source Code License: WTFPL
Dependencies: None
Requires: Minetest 0.4.11 or Higher
Version: 0.2
- Version:0.1: First Release
Version:0.2: Added Fixes + Check Timer
- TODO: Make generated debree for space.
Raw Source Code:
- Code: Select all
--Version 0.2
pos = {x=0, y=0, z=0}
local space = 1000 --value for space, change the value to however you like.
--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",
}
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 the player has reached Space
if minetest.get_player_by_name(name) and pos.y >= space then
player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
player:set_sky({}, "skybox", spaceskybox) -- Sets skybox
--If the player is on Earth
elseif minetest.get_player_by_name(name) and pos.y < space then
player:set_physics_override(1, 1, 1) -- speed, jump, gravity [default]
player:set_sky({}, "regular", {}) -- Sets skybox, in this case it sets the skybox to it's default setting if and only if the player's Y value is less than the value of space.
end
end
end
end)
minetest.register_on_leaveplayer(function(player)
local name = player:get_player_name()
if name then
player:set_sky({}, "regular", {})
end
end)