diff --git a/crafting_recipes.lua b/crafting_recipes.lua index 008b1ad..ecad1ff 100644 --- a/crafting_recipes.lua +++ b/crafting_recipes.lua @@ -493,84 +493,85 @@ minetest.register_craft({ }) --Space Drive recipes +if minetest.get_modpath("rocket") then + minetest.register_craft({ + output = 'space_travel:space_drive_engine', + recipe = { + {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, + {'default:steel_ingot', 'default:mese', 'default:steel_ingot'}, + {'default:mese_crystal', 'rocket:rocket_thruster', 'default:mese_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_engine', - recipe = { - {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, - {'default:steel_ingot', 'default:mese', 'default:steel_ingot'}, - {'default:mese_crystal', 'rocket:rocket_thruster', 'default:mese_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:warp_drive_engine', + recipe = { + {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, + {'default:gold_ingot', 'space_travel:dark_matter_crystal_block', 'default:gold_ingot'}, + {'space_travel:dark_matter_crystal', 'rocket:rocket_thruster', 'space_travel:dark_matter_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:warp_drive_engine', - recipe = { - {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, - {'default:gold_ingot', 'space_travel:dark_matter_crystal_block', 'default:gold_ingot'}, - {'space_travel:dark_matter_crystal', 'rocket:rocket_thruster', 'space_travel:dark_matter_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_1', + recipe = { + {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, + {'default:steel_ingot', 'space_travel:space_drive_engine', 'default:steel_ingot'}, + {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_1', - recipe = { - {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, - {'default:steel_ingot', 'space_travel:space_drive_engine', 'default:steel_ingot'}, - {'default:mese_crystal', 'default:steel_ingot', 'default:mese_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_2', + recipe = { + {'space_travel:lunar_spinel_gem', 'space_travel:titanium_ingot', 'space_travel:lunar_spinel_gem'}, + {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, + {'space_travel:lunar_spinel_gem', 'space_travel:titanium_ingot', 'space_travel:lunar_spinel_gem'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_2', - recipe = { - {'space_travel:lunar_spinel_gem', 'space_travel:titanium_ingot', 'space_travel:lunar_spinel_gem'}, - {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, - {'space_travel:lunar_spinel_gem', 'space_travel:titanium_ingot', 'space_travel:lunar_spinel_gem'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_3', + recipe = { + {'space_travel:martian_ice_crystal', 'space_travel:titanium_ingot', 'space_travel:martian_ice_crystal'}, + {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, + {'space_travel:martian_ice_crystal', 'space_travel:titanium_ingot', 'space_travel:martian_ice_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_3', - recipe = { - {'space_travel:martian_ice_crystal', 'space_travel:titanium_ingot', 'space_travel:martian_ice_crystal'}, - {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, - {'space_travel:martian_ice_crystal', 'space_travel:titanium_ingot', 'space_travel:martian_ice_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_4', + recipe = { + {'space_travel:solar_mese_crystal', 'space_travel:lead_ingot', 'space_travel:solar_mese_crystal'}, + {'space_travel:lead_ingot', 'space_travel:space_drive_engine', 'space_travel:lead_ingot'}, + {'space_travel:solar_mese_crystal', 'space_travel:lead_ingot', 'space_travel:solar_mese_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_4', - recipe = { - {'space_travel:solar_mese_crystal', 'space_travel:lead_ingot', 'space_travel:solar_mese_crystal'}, - {'space_travel:lead_ingot', 'space_travel:space_drive_engine', 'space_travel:lead_ingot'}, - {'space_travel:solar_mese_crystal', 'space_travel:lead_ingot', 'space_travel:solar_mese_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_5', + recipe = { + {'space_travel:lava_crystal', 'space_travel:lead_ingot', 'space_travel:lava_crystal'}, + {'space_travel:lead_ingot', 'space_travel:space_drive_engine', 'space_travel:lead_ingot'}, + {'space_travel:lava_crystal', 'space_travel:lead_ingot', 'space_travel:lava_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_5', - recipe = { - {'space_travel:lava_crystal', 'space_travel:lead_ingot', 'space_travel:lava_crystal'}, - {'space_travel:lead_ingot', 'space_travel:space_drive_engine', 'space_travel:lead_ingot'}, - {'space_travel:lava_crystal', 'space_travel:lead_ingot', 'space_travel:lava_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_6', + recipe = { + {'space_travel:titan_alien_crystal', 'space_travel:titanium_ingot', 'space_travel:titan_alien_crystal'}, + {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, + {'space_travel:titan_alien_crystal', 'space_travel:titanium_ingot', 'space_travel:titan_alien_crystal'}, + } + }) -minetest.register_craft({ - output = 'space_travel:space_drive_6', - recipe = { - {'space_travel:titan_alien_crystal', 'space_travel:titanium_ingot', 'space_travel:titan_alien_crystal'}, - {'space_travel:titanium_ingot', 'space_travel:space_drive_engine', 'space_travel:titanium_ingot'}, - {'space_travel:titan_alien_crystal', 'space_travel:titanium_ingot', 'space_travel:titan_alien_crystal'}, - } -}) - -minetest.register_craft({ - output = 'space_travel:space_drive_7', - recipe = { - {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, - {'default:gold_ingot', 'space_travel:warp_drive_engine', 'default:gold_ingot'}, - {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, - } -}) + minetest.register_craft({ + output = 'space_travel:space_drive_7', + recipe = { + {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, + {'default:gold_ingot', 'space_travel:warp_drive_engine', 'default:gold_ingot'}, + {'space_travel:dark_matter_crystal', 'default:gold_ingot', 'space_travel:dark_matter_crystal'}, + } + }) +end \ No newline at end of file diff --git a/sky.lua b/sky.lua index 0ea2537..4d50735 100644 --- a/sky.lua +++ b/sky.lua @@ -316,6 +316,18 @@ minetest.register_on_joinplayer(function(player) sky_defaults.col, sky_defaults.tp, sky_defaults.tex, sky_defaults.cl = player:get_sky() end) +local player_weightlessness = {} +local function set_weightlessness(name, par) + player_weightlessness[name] = par +end + +local function get_weightlessness(name) + if type(player_weightlessness[name]) ~= 'nil' then + return player_weightlessness[name] + end + return false +end + minetest.register_globalstep(function(dtime) time = time + dtime if time > 1 then @@ -347,39 +359,51 @@ minetest.register_globalstep(function(dtime) thickness = 16, speed ={x=0, z=-2}, }) - player:set_physics_override(1, 1, 1) -- speed, jump, gravity + if get_weightlessness(name) == true then + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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", {}) player:set_clouds({ @@ -391,6 +415,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=10}, }) 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", {}) player:set_clouds({ @@ -402,6 +427,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=10}, }) 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}) @@ -410,34 +436,42 @@ minetest.register_globalstep(function(dtime) 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 + 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 + 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 + 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 + 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 + 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) player:set_clouds({density = 0}) 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_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 + 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 + 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) player:set_clouds({ @@ -449,6 +483,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-6}, }) 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", {}) player:set_clouds({ @@ -460,54 +495,67 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-6}, }) 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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", {}) player:set_clouds({ @@ -519,6 +567,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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) player:set_clouds({ @@ -530,6 +579,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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}) @@ -545,6 +595,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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) player:set_clouds({ @@ -556,22 +607,27 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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 + 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 + 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 + 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 + 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", {}) player:set_clouds({ @@ -583,6 +639,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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) player:set_clouds({ @@ -594,6 +651,7 @@ minetest.register_globalstep(function(dtime) speed ={x=0, z=-2}, }) 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}) @@ -602,6 +660,7 @@ minetest.register_globalstep(function(dtime) 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 + 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}) @@ -610,6 +669,7 @@ minetest.register_globalstep(function(dtime) 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 + set_weightlessness(name, true) end --End of important code end diff --git a/space_drives.lua b/space_drives.lua index 105849e..335ef31 100644 --- a/space_drives.lua +++ b/space_drives.lua @@ -632,100 +632,102 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end end) -minetest.register_tool("space_travel:space_drive_1", { - description = "Tier I Basic Space Drive\n\nCan fly to the Moon.", - inventory_image = "space_travel_space_drive_1.png", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_1_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") +if minetest.get_modpath("rocket") then + minetest.register_tool("space_travel:space_drive_1", { + description = "Tier I Basic Space Drive\n\nCan fly to the Moon.", + inventory_image = "space_travel_space_drive_1.png", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_1_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_2", { - description = "Tier II Lunar Drive\n\nGo to Mars on your first interplanetary voyage.\nYou can also go to the asteriod belt.", - inventory_image = "space_travel_space_drive_2.png", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_2_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_2", { + description = "Tier II Lunar Drive\n\nGo to Mars on your first interplanetary voyage.\nYou can also go to the asteriod belt.", + inventory_image = "space_travel_space_drive_2.png", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_2_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_3", { - description = "Tier III Martian Drive\n\nYou can now visit the inner solar system.", - inventory_image = "space_travel_space_drive_3.png^[colorize:#cf411b66", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_3_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_3", { + description = "Tier III Martian Drive\n\nYou can now visit the inner solar system.", + inventory_image = "space_travel_space_drive_3.png^[colorize:#cf411b66", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_3_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_4", { - description = "Tier IV Solar Drive\n\nGo to the Jupiter system on your first trip\ninto the outer solar system.", - inventory_image = "space_travel_space_drive_4.png", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_4_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_4", { + description = "Tier IV Solar Drive\n\nGo to the Jupiter system on your first trip\ninto the outer solar system.", + inventory_image = "space_travel_space_drive_4.png", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_4_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_5", { - description = "Tier V Lava Drive\n\nYou can now visit the rest of the gas giant systems.\nThe most notable location is Titan.", - inventory_image = "space_travel_space_drive_5.png", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_5_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_5", { + description = "Tier V Lava Drive\n\nYou can now visit the rest of the gas giant systems.\nThe most notable location is Titan.", + inventory_image = "space_travel_space_drive_5.png", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_5_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_6", { - description = "Tier VI Titan Drive\n\nYou can now explore the edge of the solar system\nand visit trans-neptunian objects.", - inventory_image = "space_travel_space_drive_6.png^[colorize:#ebb34766", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_6_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_6", { + description = "Tier VI Titan Drive\n\nYou can now explore the edge of the solar system\nand visit trans-neptunian objects.", + inventory_image = "space_travel_space_drive_6.png^[colorize:#ebb34766", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_6_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) -minetest.register_tool("space_travel:space_drive_7", { - description = "Tier VII Warp Drive\n\nYou can now travel interstellar.\nSeek out strange new worlds and life forms.", - inventory_image = "space_travel_space_drive_7.png", - on_use = function(itemstack, user, pointed_thing) - local name = user:get_player_name() - local attach = user:get_attach() - if attach and attach:get_luaentity() then - space_travel.space_drive_7_show(name) - else - minetest.chat_send_player(name, "You are not in a space shuttle.") + minetest.register_tool("space_travel:space_drive_7", { + description = "Tier VII Warp Drive\n\nYou can now travel interstellar.\nSeek out strange new worlds and life forms.", + inventory_image = "space_travel_space_drive_7.png", + on_use = function(itemstack, user, pointed_thing) + local name = user:get_player_name() + local attach = user:get_attach() + if attach and attach:get_luaentity() then + space_travel.space_drive_7_show(name) + else + minetest.chat_send_player(name, "You are not in a space shuttle.") + end end - end -}) + }) +end \ No newline at end of file