Изменены передаваемые функции для совместимости версии 5.9.1, оптимизация кода

This commit is contained in:
Vitaliy Olkhin 2024-10-17 14:02:26 +05:00
parent fdbac0653c
commit 8c931646ae
2 changed files with 59 additions and 58 deletions

View File

@ -3015,7 +3015,7 @@ minetest.register_node("space_travel:artificial_gravity_generator", {
--if ob:get_breath() ~= 11 then
-- ob:set_breath(10)
--end
--ob:set_physics_override(1, 1, 1)
--ob:set_physics_override({1, 1, 1})
end
--minetest.get_node_timer(pos):set(0.1, 0)
return true

115
sky.lua
View File

@ -350,59 +350,60 @@ minetest.register_globalstep(function(dtime)
--Skybox code, cloud code, and physics code right here
if minetest.get_player_by_name(name) and pos.y < space_travel.yarth then --Earth sky
player:set_sky(sky_defaults.col, sky_defaults.tp, sky_defaults.tex, sky_defaults.cl)
player:set_clouds({
density = 0.4,
color = "#fff0f0e5",
ambient = "#000000",
height = 120,
thickness = 16,
speed ={x=0, z=-2},
})
if get_weightlessness(name) == true then
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_sky(sky_defaults.col, sky_defaults.tp, sky_defaults.tex, sky_defaults.cl)
player:set_clouds({
density = 0.4,
color = "#fff0f0e5",
ambient = "#000000",
height = 120,
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override({1, 1, 1}) -- speed, jump, gravity
set_weightlessness(name, false)
end
return
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
elseif minetest.get_player_by_name(name) and 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", {})
@ -414,7 +415,7 @@ minetest.register_globalstep(function(dtime)
thickness = 32,
speed ={x=0, z=10},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({1, 1, 1}) -- speed, jump, gravity
set_weightlessness(name, true)
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", {})
@ -426,36 +427,36 @@ minetest.register_globalstep(function(dtime)
thickness = 32,
speed ={x=0, z=10},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({1, 1, 1}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({1, 0.6, 0.2}) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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)
@ -465,12 +466,12 @@ minetest.register_globalstep(function(dtime)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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)
@ -482,7 +483,7 @@ minetest.register_globalstep(function(dtime)
thickness = 32,
speed ={x=0, z=-6},
})
player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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", {})
@ -494,67 +495,67 @@ minetest.register_globalstep(function(dtime)
thickness = 32,
speed ={x=0, z=-6},
})
player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
elseif minetest.get_player_by_name(name) and pos.y >= space_travel.sedna_orbit and pos.y < space_travel.asteriod_belt 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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
elseif minetest.get_player_by_name(name) and pos.y >= space_travel.asteriod_belt and pos.y < space_travel.asteriod_belt_orbit and day_time then --Minerva sky at day
player:set_sky({r=249, g=139, b=139}, "plain", {})
@ -566,7 +567,7 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
elseif minetest.get_player_by_name(name) and pos.y >= space_travel.asteriod_belt and pos.y < space_travel.asteriod_belt_orbit and (not day_time) then --Minerva sky at night
player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_night)
@ -578,12 +579,12 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
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({
@ -594,7 +595,7 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
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)
@ -606,27 +607,27 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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", {})
@ -638,7 +639,7 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
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)
@ -650,25 +651,25 @@ minetest.register_globalstep(function(dtime)
thickness = 16,
speed ={x=0, z=-2},
})
player:set_physics_override(1, 1, 1) -- speed, jump, gravity
player:set_physics_override({ 1, 1, 1 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
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
player:set_physics_override({ 1, 0.6, 0.2 }) -- speed, jump, gravity
set_weightlessness(name, true)
end
--End of important code