From a43e7d880d2f89172d79cdc7166b1ce3066b4590 Mon Sep 17 00:00:00 2001 From: Vitaliy Olkhin Date: Mon, 16 Sep 2024 14:57:09 +0500 Subject: [PATCH] Mod fixes and modifications --- .gitignore | 2 +- init.lua | 44 +++++++++++++++++++ sky.lua | 109 +++++++++++++++++++++++++---------------------- space_drives.lua | 92 +++++++++++++++++++-------------------- 4 files changed, 149 insertions(+), 98 deletions(-) diff --git a/.gitignore b/.gitignore index 0667445..43045ec 100644 --- a/.gitignore +++ b/.gitignore @@ -39,5 +39,5 @@ luac.out *.i*86 *.x86_64 *.hex - +.idea/ diff --git a/init.lua b/init.lua index 446dadc..f88bbf5 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,47 @@ +space_travel = {} +space_travel.yarth = tonumber(minetest.settings:get('yarth') or 4000) +space_travel.yarth_orbit = tonumber(minetest.settings:get('yarth_orbit') or 4500) +space_travel.luna = tonumber(minetest.settings:get('luna') or 5500) +space_travel.luna_orbit = tonumber(minetest.settings:get('luna_orbit') or 6000) +space_travel.mars = tonumber(minetest.settings:get('mars') or 7000) +space_travel.mars_orbit = tonumber(minetest.settings:get('mars_orbit') or 7500) +space_travel.mercury = tonumber(minetest.settings:get('mercury') or 8000) +space_travel.mercury_orbit = tonumber(minetest.settings:get('mercury_orbit') or 8500) +space_travel.venus = tonumber(minetest.settings:get('venus') or 9000) +space_travel.venus_orbit = tonumber(minetest.settings:get('venus_orbit') or 9500) +space_travel.ganymede = tonumber(minetest.settings:get('ganymede') or 10000) +space_travel.ganymede_orbit = tonumber(minetest.settings:get('ganymede_orbit') or 10500) +space_travel.callisto = tonumber(minetest.settings:get('callisto') or 11000) +space_travel.callisto_orbit = tonumber(minetest.settings:get('callisto_orbit') or 11500) +space_travel.io = tonumber(minetest.settings:get('io') or 12000) +space_travel.io_orbit = tonumber(minetest.settings:get('io_orbit') or 12500) +space_travel.europa = tonumber(minetest.settings:get('europa') or 13000) +space_travel.europa_orbit = tonumber(minetest.settings:get('europa_orbit') or 13500) +space_travel.titan = tonumber(minetest.settings:get('titan') or 14500) +space_travel.titan_orbit = tonumber(minetest.settings:get('titan_orbit') or 15000) +space_travel.oberon = tonumber(minetest.settings:get('oberon') or 16000) +space_travel.oberon_orbit = tonumber(minetest.settings:get('oberon_orbit') or 16500) +space_travel.triton = tonumber(minetest.settings:get('triton') or 17500) +space_travel.triton_orbit = tonumber(minetest.settings:get('triton_orbit') or 18000) +space_travel.pluto = tonumber(minetest.settings:get('pluto') or 19000) +space_travel.pluto_orbit = tonumber(minetest.settings:get('pluto_orbit') or 19500) +space_travel.charon = tonumber(minetest.settings:get('charon') or 20500) +space_travel.charon_orbit = tonumber(minetest.settings:get('charon_orbit') or 21000) +space_travel.sedna = tonumber(minetest.settings:get('sedna') or 22000) +space_travel.sedna_orbit = tonumber(minetest.settings:get('sedna_orbit') or 22500) +space_travel.asteriod_belt = tonumber(minetest.settings:get('asteriod_belt') or 23000) +space_travel.asteriod_belt_orbit = tonumber(minetest.settings:get('asteriod_belt_orbit') or 23500) +space_travel.minerva = tonumber(minetest.settings:get('minerva') or 24500) +space_travel.minerva_orbit = tonumber(minetest.settings:get('minerva_orbit') or 25000) +space_travel.bacchus = tonumber(minetest.settings:get('bacchus') or 26000) +space_travel.bacchus_orbit = tonumber(minetest.settings:get('bacchus_orbit') or 26500) +space_travel.ourea = tonumber(minetest.settings:get('ourea') or 27500) +space_travel.ourea_orbit = tonumber(minetest.settings:get('ourea_orbit') or 28000) +space_travel.osiris = tonumber(minetest.settings:get('osiris') or 29000) +space_travel.osiris_orbit = tonumber(minetest.settings:get('osiris_orbit') or 29500) +space_travel.minthe = tonumber(minetest.settings:get('minthe') or 30500) +space_travel.minthe_orbit = tonumber(minetest.settings:get('minthe_orbit') or 31000) + dofile(minetest.get_modpath("space_travel") .. "/sky.lua") dofile(minetest.get_modpath("space_travel") .. "/nodes.lua") dofile(minetest.get_modpath("space_travel") .. "/radiation.lua") diff --git a/sky.lua b/sky.lua index 10ff8ed..b96b725 100644 --- a/sky.lua +++ b/sky.lua @@ -309,6 +309,12 @@ local minthe_space = { } local time = 0 +sky_defaults = {} + + +minetest.register_on_joinplayer(function(player) + sky_defaults.col, sky_defaults.tp, sky_defaults.tex, sky_defaults.cl = player:get_sky() +end) minetest.register_globalstep(function(dtime) time = time + dtime @@ -331,8 +337,11 @@ minetest.register_globalstep(function(dtime) end --Skybox code, cloud code, and physics code right here - if minetest.get_player_by_name(name) and pos.y < 1000 then --Earth sky - player:set_sky({}, "regular", {}) + if minetest.get_player_by_name(name) and pos.y < space_travel.yarth then --Earth sky + minetest.chat_send_all(surface_effect.dump(pos.y)) + + --player:set_sky({}, "regular", {}) + player:set_sky(sky_defaults.col, sky_defaults.tp, sky_defaults.tex, sky_defaults.cl) player:set_clouds({ density = 0.4, color = "#fff0f0e5", @@ -342,39 +351,39 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 1000 and pos.y < 1500 then --Earth orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.yarth and pos.y < space_travel.yarth_orbit then --Earth orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", earth_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 1500 and pos.y < 2500 then --Moon sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.yarth_orbit and pos.y < space_travel.luna then --Moon sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", moon_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 2500 and pos.y < 3000 then --Moon orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.luna and pos.y < space_travel.luna_orbit then --Moon orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", moon_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 3000 and pos.y < 4000 and day_time then --Mars sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.luna_orbit and pos.y < space_travel.mars and day_time then --Mars sky at day player:set_sky({r=219, g=168, b=117}, "plain", {}) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 3000 and pos.y < 4000 and (not day_time) then --Mars sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.luna_orbit and pos.y < space_travel.mars and (not day_time) then --Mars sky at night player:set_sky({r = 0, g = 0, b = 0}, "skybox", mars_night) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 4000 and pos.y < 4500 then --Mars orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.mars and pos.y < space_travel.mars_orbit then --Mars orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", mars_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 4500 and pos.y < 5500 then --Mercury sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.mars_orbit and pos.y < space_travel.mercury then --Mercury sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", mercury_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 5500 and pos.y < 6000 then --Mercury orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.mercury and pos.y < space_travel.mercury_orbit then --Mercury orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", mercury_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 6000 and pos.y < 7000 and day_time then --Venus sky at day + elseif minetest.get_player_by_name(name) and pos.y >= pos.y < space_travel.mercury and pos.y < space_travel.venus and day_time then --Venus sky at day player:set_sky({r=208, g=177, b=11}, "plain", {}) player:set_clouds({ density = 0.6, @@ -385,7 +394,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=10}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 6000 and pos.y < 7000 and (not day_time) then --Venus sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.mercury and pos.y < space_travel.venus and (not day_time) then --Venus sky at night player:set_sky({r=102, g=87, b=5}, "plain", {}) player:set_clouds({ density = 0.6, @@ -396,43 +405,43 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=10}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 7000 and pos.y < 7500 then --Venus orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.venus and pos.y < space_travel.venus_orbit then --Venus orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", venus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 7500 and pos.y < 8500 then --Ganymede sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.mercury and pos.y < space_travel.ganymede then --Ganymede sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", jupiter_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 8500 and pos.y < 9000 then --Ganymede orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.ganymede and pos.y < space_travel.ganymede_orbit then --Ganymede orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", ganymede_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 9000 and pos.y < 10000 then --Callisto sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.ganymede_orbit and pos.y < space_travel.callisto then --Callisto sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", jupiter_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 10000 and pos.y < 10500 then --Callisto orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.callisto and pos.y < space_travel.callisto_orbit then --Callisto orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", callisto_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 10500 and pos.y < 11500 then --Io sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.callisto_orbit and pos.y < space_travel.io then --Io sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", jupiter_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 11500 and pos.y < 12000 then --Io orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.io and pos.y < space_travel.io_orbit then --Io orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", io_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 12000 and pos.y < 13000 then --Europa sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.io_orbit and pos.y < space_travel.europa then --Europa sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", jupiter_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 13000 and pos.y < 13500 then --Europa orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.europa and pos.y < space_travel.europa_orbit then --Europa orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", europa_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 13500 and pos.y < 14500 and day_time then --Titan sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.europa_orbit and pos.y < space_travel.titan and day_time then --Titan sky at day player:set_sky({r = 239, g = 194, b = 109}, "skybox", titan_sky) player:set_clouds({ density = 0.5, @@ -443,7 +452,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-6}, }) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 13500 and pos.y < 14500 and (not day_time) then --Titan sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.europa_orbit and pos.y < space_travel.titan and (not day_time) then --Titan sky at night player:set_sky({r = 128, g = 103, b = 58}, "plain", {}) player:set_clouds({ density = 0.5, @@ -454,55 +463,55 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-6}, }) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 14500 and pos.y < 15000 then --Titan orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.titan and pos.y < space_travel.titan_orbit then --Titan orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", saturn_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 15000 and pos.y < 16000 then --Oberon sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.titan_orbit and pos.y < space_travel.oberon then --Oberon sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", uranus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 16000 and pos.y < 16500 then --Oberon orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.oberon and pos.y < space_travel.oberon_orbit then --Oberon orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", uranus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 16500 and pos.y < 17500 then --Triton sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.oberon_orbit and pos.y < space_travel.triton then --Triton sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", neptune_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 17500 and pos.y < 18000 then --Triton orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.triton and pos.y < space_travel.triton_orbit then --Triton orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", neptune_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 18000 and pos.y < 19000 then --Pluto sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.triton_orbit and pos.y < space_travel.pluto then --Pluto sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", pluto_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 19000 and pos.y < 19500 then --Pluto orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.pluto and pos.y < space_travel.pluto_orbit then --Pluto orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", pluto_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 19500 and pos.y < 20500 then --Charon sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.pluto_orbit and pos.y < space_travel.charon then --Charon sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", charon_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 20500 and pos.y < 21000 then --Charon orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.charon and pos.y < space_travel.charon_orbit then --Charon orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", charon_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 21000 and pos.y < 22000 then --Sedna sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.charon_orbit and pos.y < space_travel.sedna then --Sedna sky player:set_sky({r = 118, g = 84, b = 84}, "skybox", sedna_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 22000 and pos.y < 22500 then --Sedna orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.sedna and pos.y < space_travel.sedna_orbit then --Sedna orbit player:set_sky({r = 118, g = 84, b = 84}, "skybox", sedna_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 22500 and pos.y < 23500 then --Asteriod belt sky + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.sedna_orbit and pos.y < space_travel.asteriod_aelt then --Asteriod belt sky player:set_sky({r = 0, g = 0, b = 0}, "skybox", cosmos_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 23500 and pos.y < 24500 and day_time then --Minerva sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.asteriod_aelt and pos.y < space_travel.asteriod_aelt_orbit and day_time then --Minerva sky at day player:set_sky({r=249, g=139, b=139}, "plain", {}) player:set_clouds({ density = 0.4, @@ -513,7 +522,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 23500 and pos.y < 24500 and (not day_time) then --Minerva sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.asteriod_aelt and pos.y < space_travel.asteriod_aelt_orbit and (not day_time) then --Minerva sky at night player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_night) player:set_clouds({ density = 0.4, @@ -524,11 +533,11 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 24500 and pos.y < 25000 then --Minerva orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.minerva and pos.y < space_travel.minerva_orbit then --Minerva orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 25000 and pos.y < 26000 and day_time then --Bacchus sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.minerva_orbit and pos.y < space_travel.bacchus and day_time then --Bacchus sky at day player:set_sky({r=240, g=139, b=249}, "plain", {}) player:set_clouds({ density = 0.4, @@ -539,7 +548,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 25000 and pos.y < 26000 and (not day_time) then --Bacchus sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.minerva_orbit and pos.y < space_travel.bacchus and (not day_time) then --Bacchus sky at night player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_night) player:set_clouds({ density = 0.4, @@ -550,23 +559,23 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 26000 and pos.y < 26500 then --Bacchus orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.bacchus and pos.y < space_travel.bacchus_orbit then --Bacchus orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", bacchus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 26500 and pos.y < 27500 and day_time then --Ourea sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.bacchus_orbit and pos.y < space_travel.ourea and day_time then --Ourea sky at day player:set_sky({r = 0, g = 0, b = 0}, "skybox", ourea_sky) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 26500 and pos.y < 27500 and (not day_time) then --Ourea night at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.bacchus_orbit and pos.y < space_travel.ourea and (not day_time) then --Ourea night at day player:set_sky({r = 0, g = 0, b = 0}, "skybox", caelus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 27500 and pos.y < 28000 then --Ourea orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.ourea and pos.y < space_travel.ourea_orbit then --Ourea orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", caelus_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 28000 and pos.y < 29000 and day_time then --Osiris sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.ourea_orbit and pos.y < space_travel.osiris and day_time then --Osiris sky at day player:set_sky({r=247, g=180, b=138}, "plain", {}) player:set_clouds({ density = 0.4, @@ -577,7 +586,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 28000 and pos.y < 29000 and (not day_time) then --Osiris sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.ourea_orbit and pos.y < space_travel.osiris and (not day_time) then --Osiris sky at night player:set_sky({r = 0, g = 0, b = 0}, "skybox", osiris_night) player:set_clouds({ density = 0.4, @@ -588,19 +597,19 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) player:set_physics_override(1, 1, 1) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 29000 and pos.y < 29500 then --Osiris orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.osiris and pos.y < space_travel.osiris_orbit then --Osiris orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", osiris_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 29500 and pos.y < 30500 and day_time then --Minthe sky at day + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.osiris_orbit and pos.y < space_travel.minthe and day_time then --Minthe sky at day player:set_sky({r=117, g=219, b=170}, "plain", {}) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 29500 and pos.y < 30500 and (not day_time) then --Minthe sky at night + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.osiris_orbit and pos.y < space_travel.minthe and (not day_time) then --Minthe sky at night player:set_sky({r = 0, g = 0, b = 0}, "skybox", minthe_night) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity - elseif minetest.get_player_by_name(name) and pos.y >= 30500 and pos.y < 31000 then --Minthe orbit + elseif minetest.get_player_by_name(name) and pos.y >= space_travel.minthe and pos.y < space_travel.minthe_orbit then --Minthe orbit player:set_sky({r = 0, g = 0, b = 0}, "skybox", minthe_space) player:set_clouds({density = 0}) player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity diff --git a/space_drives.lua b/space_drives.lua index 3b8572a..bdd5fa2 100644 --- a/space_drives.lua +++ b/space_drives.lua @@ -1,57 +1,55 @@ -space_travel = {} - function space_travel.move(object,pos,destination) --object:set_pos(pos) local location = -1 - if pos.y >= 1000 and pos.y < 1500 then --earth - location = 1500 * 0 - elseif pos.y >= 2500 and pos.y < 3000 then --moon - location = 1500 * 1 - elseif pos.y >= 4000 and pos.y < 4500 then --mars - location = 1500 * 2 - elseif pos.y >= 5500 and pos.y < 6000 then --mercury - location = 1500 * 3 - elseif pos.y >= 7000 and pos.y < 7500 then --venus - location = 1500 * 4 - elseif pos.y >= 8500 and pos.y < 9000 then --ganymede - location = 1500 * 5 - elseif pos.y >= 10000 and pos.y < 10500 then --callisto - location = 1500 * 6 - elseif pos.y >= 11500 and pos.y < 12000 then --io - location = 1500 * 7 - elseif pos.y >= 13000 and pos.y < 13500 then --europa - location = 1500 * 8 - elseif pos.y >= 14500 and pos.y < 15000 then --titan - location = 1500 * 9 - elseif pos.y >= 16000 and pos.y < 16500 then --oberon - location = 1500 * 10 - elseif pos.y >= 17500 and pos.y < 18000 then --triton - location = 1500 * 11 - elseif pos.y >= 19000 and pos.y < 19500 then --pluto - location = 1500 * 12 - elseif pos.y >= 20500 and pos.y < 21000 then --charon - location = 1500 * 13 - elseif pos.y >= 22000 and pos.y < 22500 then --sedna - location = 1500 * 14 - elseif pos.y >= 23000 and pos.y < 23500 then --asteriod belt - location = 22000 --15 - elseif pos.y >= 24500 and pos.y < 25000 then --minerva - location = 1500 * (16 - 1) + 1000 - elseif pos.y >= 26000 and pos.y < 26500 then --bacchus - location = 1500 * (17 - 1) + 1000 - elseif pos.y >= 27500 and pos.y < 28000 then --ourea - location = 1500 * (18 - 1) + 1000 - elseif pos.y >= 29000 and pos.y < 29500 then --osiris - location = 1500 * (19 - 1) + 1000 - elseif pos.y >= 29500 and pos.y < 30999 then --minthe - location = 1500 * (20 - 1) + 1000 + if pos.y >= space_travel.yarth and pos.y < space_travel.yarth_orbit then --earth + location = space_travel.yarth_orbit * 0 + elseif pos.y >= space_travel.luna and pos.y < space_travel.luna_orbit then --moon + location = space_travel.yarth_orbit * 1 + elseif pos.y >= space_travel.mars and pos.y < space_travel.mars_orbit then --mars + location = space_travel.yarth_orbit * 2 + elseif pos.y >= space_travel.mercury and pos.y < space_travel.mercury_orbit then --mercury + location = space_travel.yarth_orbit * 3 + elseif pos.y >= space_travel.venus and pos.y < space_travel.venus_orbit then --venus + location = space_travel.yarth_orbit * 4 + elseif pos.y >= space_travel.ganymede and pos.y < space_travel.ganymede_orbit then --ganymede + location = space_travel.yarth_orbit * 5 + elseif pos.y >= space_travel.callisto and pos.y < space_travel.callisto_orbit then --callisto + location = space_travel.yarth_orbit * 6 + elseif pos.y >= space_travel.io and pos.y < space_travel.io_orbit then --io + location = space_travel.yarth_orbit * 7 + elseif pos.y >= space_travel.europa and pos.y < space_travel.europa_orbit then --europa + location = space_travel.yarth_orbit * 8 + elseif pos.y >= space_travel.titan and pos.y < space_travel.titan_orbit then --titan + location = space_travel.yarth_orbit * 9 + elseif pos.y >= space_travel.oberon and pos.y < space_travel.oberon_orbit then --oberon + location = space_travel.yarth_orbit * 10 + elseif pos.y >= space_travel.triton and pos.y < space_travel.triton_orbit then --triton + location = space_travel.yarth_orbit * 11 + elseif pos.y >= space_travel.pluto and pos.y < space_travel.pluto_orbit then --pluto + location = space_travel.yarth_orbit * 12 + elseif pos.y >= space_travel.charon and pos.y < space_travel.charon_orbit then --charon + location = space_travel.yarth_orbit * 13 + elseif pos.y >= space_travel.sedna and pos.y < space_travel.sedna_orbit then --sedna + location = space_travel.yarth_orbit * 14 + elseif pos.y >= space_travel.asteriod_belt and pos.y < space_travel.asteriod_belt_orbit then --asteriod belt + location = space_travel.sedna --15 + elseif pos.y >= space_travel.minerva and pos.y < space_travel.minerva_orbit then --minerva + location = space_travel.yarth_orbit * (16 - 1) + 1000 + elseif pos.y >= space_travel.bacchus and pos.y < space_travel.bacchus_orbit then --bacchus + location = space_travel.yarth_orbit * (17 - 1) + 1000 + elseif pos.y >= space_travel.ourea and pos.y < space_travel.ourea_orbit then --ourea + location = space_travel.yarth_orbit * (18 - 1) + 1000 + elseif pos.y >= space_travel.osiris and pos.y < space_travel.osiris_orbit then --osiris + location = space_travel.yarth_orbit * (19 - 1) + 1000 + elseif pos.y >= space_travel.minthe and pos.y < 30999 then --minthe + location = space_travel.yarth_orbit * (20 - 1) + 1000 end if destination < 15 then - destination = 1500 * destination + destination = space_travel.yarth_orbit * destination elseif destination == 15 then - destination = 22000 + destination = space_travel.sedna elseif destination > 15 then - destination = 1500 * (destination - 1) + 1000 + destination = space_travel.yarth_orbit * (destination - 1) + 1000 end local new_pos = pos new_pos.y = new_pos.y - location + destination