Repository for the titan_moon mod.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sky.lua 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. --Version 0.2
  2. pos = {x=0, y=0, z=0}
  3. local space = 1000 --value for space, change the value to however you like.
  4. --The skybox for space, feel free to change it to however you like.
  5. local titanskybox = {
  6. "titan_sky_pos_y.png^[transform3",
  7. "titan_sky_neg_y.png^[transform1",
  8. "titan_sky_pos_z.png",
  9. "titan_sky_neg_z.png",
  10. "titan_sky_neg_x.png",
  11. "titan_sky_pos_x.png",
  12. }
  13. local spaceskybox = {
  14. "sky_pos_y.png^[transform3",
  15. "sky_neg_y.png^[transform1",
  16. "sky_pos_z.png",
  17. "sky_neg_z.png",
  18. "sky_neg_x.png",
  19. "sky_pos_x.png",
  20. }
  21. local time = 0
  22. minetest.register_globalstep(function(dtime)
  23. time = time + dtime
  24. if time > 1 then for _, player in ipairs(minetest.get_connected_players()) do
  25. time = 0
  26. local name = player:get_player_name()
  27. local pos = player:getpos()
  28. --If the player has reached Space
  29. if minetest.get_player_by_name(name) and pos.y >= space then
  30. player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
  31. --player:set_physics_override(1, 0.4, 0.1) -- speed, jump, gravity [default]
  32. player:set_sky({r = 0, g = 0, b = 0}, "skybox", spaceskybox) -- Sets skybox
  33. --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.
  34. --player:set_clouds({density = 0})
  35. player:set_clouds({
  36. density = 0,
  37. --color = "#fff0f0e5",
  38. --ambient = "#000000",
  39. --height = 120,
  40. --thickness = 16,
  41. --speed = {x = 0, y = -2},
  42. })
  43. --If the player is on Titan
  44. elseif minetest.get_player_by_name(name) and pos.y < space then
  45. player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
  46. player:set_sky({r = 239, g = 194, b = 109}, "skybox", titanskybox) -- Sets skybox
  47. --player:set_clouds({density = 0.7})
  48. player:set_clouds({
  49. density = 0.5,
  50. color = "#EFC26D", --"#c5b75f",
  51. ambient = "#000000", --"#c5b75f",
  52. height = 120,
  53. thickness = 30, --16,
  54. speed = {x = 20, y = 0}, --y used to equal -2, x used to equal 0
  55. })
  56. end
  57. end
  58. end
  59. end)
  60. --[[
  61. minetest.register_on_leaveplayer(function(player)
  62. local name = player:get_player_name()
  63. if name then
  64. player:set_sky({}, "regular", {})
  65. end
  66. end)
  67. ]]
  68. --or (minetest.get_timeofday() * 24000 < 6000 and minetest.get_timeofday() * 24000 >= 18000)
  69. --and (minetest.get_timeofday() * 24000 >= 6000 and minetest.get_timeofday() * 24000 < 18000)
  70. --https://dev.minetest.net/minetest.get_timeofday
  71. --https://dev.minetest.net/time_of_day