added files

This commit is contained in:
Red_King_Cyclops 2019-10-07 21:15:35 +00:00
parent 667efff368
commit 0d7e482fa6
5 changed files with 4429 additions and 0 deletions

3024
nodes.lua Normal file

File diff suppressed because it is too large Load Diff

61
radiation.lua Normal file
View File

@ -0,0 +1,61 @@
--Radiation effects
radiant_damage.register_radiant_damage("space_lava_heat", {
interval = 1,
range = 3,
emitted_by = {["space_travel:space_lava_source"] = 4, ["space_travel:space_lava_flowing"] = 4},
attenuated_by = {["vacuum:vacuum"] = 1},
default_attenuation = 1,
inverse_square_falloff = true, --true
above_only = false,
--on_damage = function(player_object, damage_value, pos)
--end,
})
radiant_damage.register_radiant_damage("solar_mese_heat", {
interval = 1,
range = 3,
emitted_by = {["space_travel:space_stone_solar_mese_ore"] = 4},
attenuated_by = {["vacuum:vacuum"] = 1},
default_attenuation = 1,
inverse_square_falloff = true, --true
above_only = false,
--on_damage = function(player_object, damage_value, pos)
--end,
})
radiant_damage.register_radiant_damage("lava_crystal_heat", {
interval = 1,
range = 3,
emitted_by = {["space_travel:io_stone_lava_crystal_ore"] = 4},
attenuated_by = {["vacuum:vacuum"] = 1},
default_attenuation = 1,
inverse_square_falloff = true, --true
above_only = false,
--on_damage = function(player_object, damage_value, pos)
--end,
})
radiant_damage.register_radiant_damage("space_radiation", {
interval = 1,
range = 3,
emitted_by = {
["space_travel:irradiated_space_stone"] = 4,
["space_travel:irradiated_space_dust"] = 4,
["space_travel:irradiated_space_cobble"] = 4,
["space_travel:irradiated_ice"] = 4,
["space_travel:irradiated_io_sulfur_dust"] = 4,
["space_travel:irradiated_io_stone"] = 4,
["space_travel:irradiated_io_cobble"] = 4,
},
attenuated_by = {["vacuum:vacuum"] = 1, ["space_travel:lead_block"] = 0},
default_attenuation = 1,
inverse_square_falloff = true, --true
above_only = false,
--on_damage = function(player_object, damage_value, pos)
--end,
})

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 440 KiB

611
sky.lua Normal file
View File

@ -0,0 +1,611 @@
--Skybox code, as well as cloud code and physics code
local stars_sky = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_stars_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local earth_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_earth_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local moon_sky = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_stars_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_earth_space_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local mars_night = {
"space_travel_stars_sky.png^[colorize:#cf411b11", -- +y (top)
"space_travel_stars_sky.png^[colorize:#cf411b11", -- -y (bottom)
"space_travel_stars_sky.png^[colorize:#cf411b11", -- +z (back)
"space_travel_stars_sky.png^[colorize:#cf411b11", -- -z (front)
"space_travel_stars_sky.png^[colorize:#cf411b11", -- -x (left)
"space_travel_stars_sky.png^[colorize:#cf411b11", -- +x (right)
}
local mars_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_mars_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local mercury_sky = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_sun_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local mercury_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_mercury_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_sun_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local venus_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_venus_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_dark_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local jupiter_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_jupiter_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local ganymede_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_ganymede_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_jupiter_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local callisto_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_callisto_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_jupiter_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local io_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_io_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_jupiter_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local europa_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_europa_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_jupiter_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local titan_sky = {
"space_travel_titan_sky_pos_y.png^[transform3", -- +y (top)
"space_travel_titan_sky_neg_y.png^[transform1", -- -y (bottom)
"space_travel_titan_sky_pos_z.png", -- +z (back)
"space_travel_titan_sky_neg_z.png", -- -z (front)
"space_travel_titan_sky_neg_x.png", -- -x (left)
"space_travel_titan_sky_pos_x.png", -- +x (right)
}
local saturn_space = {
"space_travel_saturn_space_sky_pos_y.png^[transform3", -- +y (top)
"space_travel_saturn_space_sky_neg_y.png^[transform1", -- -y (bottom)
"space_travel_saturn_space_sky_pos_z.png", -- +z (back)
"space_travel_saturn_space_sky_neg_z.png", -- -z (front
"space_travel_saturn_space_sky_neg_x.png", -- -x (left)
"space_travel_saturn_space_sky_pos_x.png", -- +x (right)
}
local uranus_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_uranus_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local neptune_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_neptune_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local pluto_sky = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_charon_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local pluto_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_pluto_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_charon_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local charon_sky = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_dark_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_pluto_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local charon_space = {
"space_travel_dark_sky.png", -- +y (top)
"space_travel_charon_space_sky.png", -- -y (bottom)
"space_travel_dark_sky.png", -- +z (back)
"space_travel_pluto_space_sky.png", -- -z (front)
"space_travel_dark_sky.png", -- -x (left)
"space_travel_dark_sky.png", -- +x (right)
}
local sedna_sky = {
"space_travel_cosmos_sky_pos_z.png^[colorize:#99000050",
"space_travel_cosmos_sky_neg_z.png^[transformR180^[colorize:#99000050",
"space_travel_cosmos_sky_neg_y.png^[transformR270^[colorize:#99000050",
"space_travel_cosmos_sky_pos_y.png^[transformR270^[colorize:#99000050",
"space_travel_cosmos_sky_pos_x.png^[transformR270^[colorize:#99000050",
"space_travel_cosmos_sky_neg_x.png^[transformR90^[colorize:#99000050",
}
local cosmos_sky = {
"space_travel_cosmos_sky_pos_z.png",
"space_travel_cosmos_sky_neg_z.png^[transformR180",
"space_travel_cosmos_sky_neg_y.png^[transformR270",
"space_travel_cosmos_sky_pos_y.png^[transformR270",
"space_travel_cosmos_sky_pos_x.png^[transformR270",
"space_travel_cosmos_sky_neg_x.png^[transformR90",
}
local minerva_night = {
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- +y (top)
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- -y (bottom)
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- +z (back)
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- -z (front)
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- -x (left)
"space_travel_stars_sky.png^[colorize:#f98b8b06", -- +x (right)
}
local minerva_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_minerva_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local bacchus_night = {
"space_travel_stars_sky.png^[colorize:#F08BF906", -- +y (top)
"space_travel_stars_sky.png^[colorize:#F08BF906", -- -y (bottom)
"space_travel_stars_sky.png^[colorize:#F08BF906", -- +z (back)
"space_travel_stars_sky.png^[colorize:#F08BF906", -- -z (front)
"space_travel_stars_sky.png^[colorize:#F08BF906", -- -x (left)
"space_travel_stars_sky.png^[colorize:#F08BF906", -- +x (right)
}
local bacchus_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_bacchus_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
--[[
local ourea_sky = {
"space_travel_ourea_sky.png", -- +y (top)
"space_travel_ourea_sky.png", -- -y (bottom)
"space_travel_ourea_sky.png", -- +z (back)
"space_travel_ourea_sky_front.png", -- -z (front)
"space_travel_ourea_sky.png", -- -x (left)
"space_travel_ourea_sky.png", -- +x (right)
}
]]
local ourea_sky = {
"space_travel_ourea_sky_pos_y.png^[transform3", -- +y (top)
"space_travel_ourea_sky_neg_y.png^[transform1", -- -y (bottom)
"space_travel_ourea_sky_pos_z.png", -- +z (back)
"space_travel_ourea_sky_neg_z.png", -- -z (front)
"space_travel_ourea_sky_neg_x.png", -- -x (left)
"space_travel_ourea_sky_pos_x.png", -- +x (right)
}
local caelus_space = {
"space_travel_caelus_space_sky_pos_y.png^[transform3", -- +y (top)
"space_travel_caelus_space_sky_neg_y.png^[transform1", -- -y (bottom)
"space_travel_caelus_space_sky_pos_z.png", -- +z (back)
"space_travel_caelus_space_sky_neg_z.png", -- -z (front
"space_travel_caelus_space_sky_neg_x.png", -- -x (left)
"space_travel_caelus_space_sky_pos_x.png", -- +x (right)
}
local osiris_night = {
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- +y (top)
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- -y (bottom)
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- +z (back)
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- -z (front)
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- -x (left)
"space_travel_stars_sky.png^[colorize:#f7b48a11", -- +x (right)
}
local osiris_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_osiris_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
local minthe_night = {
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- +y (top)
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- -y (bottom)
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- +z (back)
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- -z (front)
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- -x (left)
"space_travel_stars_sky.png^[colorize:#75dbaa11", -- +x (right)
}
local minthe_space = {
"space_travel_stars_sky.png", -- +y (top)
"space_travel_minthe_space_sky.png", -- -y (bottom)
"space_travel_stars_sky.png", -- +z (back)
"space_travel_stars_sky.png", -- -z (front)
"space_travel_stars_sky.png", -- -x (left)
"space_travel_stars_sky.png", -- +x (right)
}
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()
local day_time = nil
--if minetest.get_timeofday()*24000 > 6000 and minetest.get_timeofday()*24000 <= 18000 then
if minetest.get_timeofday() > 0.25 and minetest.get_timeofday() <= 0.75 then
day_time = true
--elseif minetest.get_timeofday()*24000 <= 6000 or minetest.get_timeofday()*24000 > 18000 then
elseif minetest.get_timeofday() <= 0.25 or minetest.get_timeofday() > 0.75 then
day_time = false
else
day_time = nil
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", {})
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
elseif minetest.get_player_by_name(name) and pos.y >= 1000 and pos.y < 1500 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
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
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
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
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
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
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
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
player:set_sky({r=208, g=177, b=11}, "plain", {})
player:set_clouds({
density = 0.6,
color = "#CCA526", --"#B18A21",
ambient = "#000000",
height = 6620,
thickness = 32,
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
player:set_sky({r=102, g=87, b=5}, "plain", {})
player:set_clouds({
density = 0.6,
color = "#CCA526", --"#B18A21",
ambient = "#000000",
height = 6620,
thickness = 32,
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
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
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
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
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
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
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
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
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
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
player:set_sky({r = 239, g = 194, b = 109}, "skybox", titan_sky)
player:set_clouds({
density = 0.5,
color = "#EFC26D",
ambient = "#000000",
height = 14120,
thickness = 32,
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
player:set_sky({r = 128, g = 103, b = 58}, "plain", {})
player:set_clouds({
density = 0.5,
color = "#EFC26D",
ambient = "#000000",
height = 14120,
thickness = 32,
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
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
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
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
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
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
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
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
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
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
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
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
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
player:set_sky({r=249, g=139, b=139}, "plain", {})
player:set_clouds({
density = 0.4,
color = "#FA7070",
ambient = "#000000",
height = 24120,
thickness = 16,
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
player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_night)
player:set_clouds({
density = 0.4,
color = "#FA7070",
ambient = "#000000",
height = 24120,
thickness = 16,
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
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
player:set_sky({r=240, g=139, b=249}, "plain", {})
player:set_clouds({
density = 0.4,
color = "#ED64F9",
ambient = "#000000",
height = 25620,
thickness = 16,
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
player:set_sky({r = 0, g = 0, b = 0}, "skybox", minerva_night)
player:set_clouds({
density = 0.4,
color = "#ED64F9",
ambient = "#000000",
height = 25620,
thickness = 16,
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
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
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
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
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
player:set_sky({r=247, g=180, b=138}, "plain", {})
player:set_clouds({
density = 0.4,
color = "#f79c63",
ambient = "#000000",
height = 28620,
thickness = 16,
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
player:set_sky({r = 0, g = 0, b = 0}, "skybox", osiris_night)
player:set_clouds({
density = 0.4,
color = "#f79c63",
ambient = "#000000",
height = 28620,
thickness = 16,
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
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
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
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
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
end
--End of important code
end
end
end)

733
space_drives.lua Normal file
View File

@ -0,0 +1,733 @@
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
end
if destination < 15 then
destination = 1500 * destination
elseif destination == 15 then
destination = 22000
elseif destination > 15 then
destination = 1500 * (destination - 1) + 1000
end
local new_pos = pos
new_pos.y = new_pos.y - location + destination
--if location ~= 15 and destination == 15 then
-- new_pos.y = new_pos.y - (location * 1500) + (22000)
--elseif location == 15 and destination ~= 15 then
-- new_pos.y = new_pos.y - (22000) + (destination * 1500)
--else
-- new_pos.y = new_pos.y - (location * 1500) + (destination * 1500)
--end
if location ~= -1 then
--if minetest.get_node(new_pos).name == "vacuum:vacuum" then
--end
object:set_pos(new_pos)
if object:is_player() then
local pname = object:get_player_name()
minetest.chat_send_player(pname, "You have reached your destination.")
end
else
if object:is_player() then
local pname = object:get_player_name()
minetest.chat_send_player(pname, "You are either not in a space region or not above asteriods.")
end
end
end
function space_travel.space_drive_1_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon)"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_1_formspec", formspec)
end
function space_travel.space_drive_2_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_2_formspec", formspec)
end
function space_travel.space_drive_3_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt,Venus,Mercury"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_3_formspec", formspec)
end
function space_travel.space_drive_4_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt,Venus,Mercury,Io,Europa,Ganymede,Callisto"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_4_formspec", formspec)
end
function space_travel.space_drive_5_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt,Venus,Mercury,Io,Europa,Ganymede,Callisto,Titan,Oberon,Triton"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_5_formspec", formspec)
end
function space_travel.space_drive_6_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt,Venus,Mercury,Io,Europa,Ganymede,Callisto,Titan,Oberon,Triton,Pluto,Charon,Sedna"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_6_formspec", formspec)
end
function space_travel.space_drive_7_show(name)
local info = "Travel to space region of:"
local list = "Earth,Luna (the Moon),Mars,Asteriod Belt,Venus,Mercury,Io,Europa,Ganymede,Callisto,Titan,Oberon,Triton,Pluto,Charon,Sedna,Minerva,Bacchus,Ourea,Osiris,Minthe"
local formspec = "size[3.5,5.5]"..
"label[0,-0.2;" .. info .."]"..
"textlist[0,0.5;3,5;list;" .. list .."]"
minetest.show_formspec(name, "space_travel:space_drive_7_formspec", formspec)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local pos = player:get_pos()
if formname == "space_travel:space_drive_1_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
else
--local pname = player:get_player_name()
--minetest.chat_send_player(pname, "WHAT?")
end
--local pname = player:get_player_name()
--minetest.chat_send_player(pname, "Good choice")
end
elseif formname == "space_travel:space_drive_2_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
end
end
elseif formname == "space_travel:space_drive_3_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
elseif list_number == "5" then --Venus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 4)
end
space_travel.move(player, pos, 4)
elseif list_number == "6" then --Mercury
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 3)
end
space_travel.move(player, pos, 3)
end
end
elseif formname == "space_travel:space_drive_4_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
elseif list_number == "5" then --Venus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 4)
end
space_travel.move(player, pos, 4)
elseif list_number == "6" then --Mercury
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 3)
end
space_travel.move(player, pos, 3)
elseif list_number == "7" then --Io
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 7)
end
space_travel.move(player, pos, 7)
elseif list_number == "8" then --Europa
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 8)
end
space_travel.move(player, pos, 8)
elseif list_number == "9" then --Ganymede
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 5)
end
space_travel.move(player, pos, 5)
elseif list_number == "10" then --Callisto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 6)
end
space_travel.move(player, pos, 6)
end
end
elseif formname == "space_travel:space_drive_5_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
elseif list_number == "5" then --Venus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 4)
end
space_travel.move(player, pos, 4)
elseif list_number == "6" then --Mercury
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 3)
end
space_travel.move(player, pos, 3)
elseif list_number == "7" then --Io
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 7)
end
space_travel.move(player, pos, 7)
elseif list_number == "8" then --Europa
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 8)
end
space_travel.move(player, pos, 8)
elseif list_number == "9" then --Ganymede
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 5)
end
space_travel.move(player, pos, 5)
elseif list_number == "10" then --Callisto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 6)
end
space_travel.move(player, pos, 6)
elseif list_number == "11" then --Titan
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 9)
end
space_travel.move(player, pos, 9)
elseif list_number == "12" then --Oberon
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 10)
end
space_travel.move(player, pos, 10)
elseif list_number == "13" then --Triton
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 11)
end
space_travel.move(player, pos, 11)
end
end
elseif formname == "space_travel:space_drive_6_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
elseif list_number == "5" then --Venus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 4)
end
space_travel.move(player, pos, 4)
elseif list_number == "6" then --Mercury
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 3)
end
space_travel.move(player, pos, 3)
elseif list_number == "7" then --Io
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 7)
end
space_travel.move(player, pos, 7)
elseif list_number == "8" then --Europa
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 8)
end
space_travel.move(player, pos, 8)
elseif list_number == "9" then --Ganymede
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 5)
end
space_travel.move(player, pos, 5)
elseif list_number == "10" then --Callisto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 6)
end
space_travel.move(player, pos, 6)
elseif list_number == "11" then --Titan
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 9)
end
space_travel.move(player, pos, 9)
elseif list_number == "12" then --Oberon
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 10)
end
space_travel.move(player, pos, 10)
elseif list_number == "13" then --Triton
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 11)
end
space_travel.move(player, pos, 11)
elseif list_number == "14" then --Pluto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 12)
end
space_travel.move(player, pos, 12)
elseif list_number == "15" then --Charon
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 13)
end
space_travel.move(player, pos, 13)
elseif list_number == "16" then --Sedna
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 14)
end
space_travel.move(player, pos, 14)
end
end
elseif formname == "space_travel:space_drive_7_formspec" then
if fields.list then
list_number = fields.list:sub(5,-1)
if list_number == "1" then --Earth
--Teleports the player's rocket
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 0)
end
--Teleports the player
space_travel.move(player, pos, 0)
elseif list_number == "2" then --Luna (the Moon)
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 1)
end
space_travel.move(player, pos, 1)
elseif list_number == "3" then --Mars
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 2)
end
space_travel.move(player, pos, 2)
elseif list_number == "4" then --Asteriod belt
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 15)
end
space_travel.move(player, pos, 15)
elseif list_number == "5" then --Venus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 4)
end
space_travel.move(player, pos, 4)
elseif list_number == "6" then --Mercury
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 3)
end
space_travel.move(player, pos, 3)
elseif list_number == "7" then --Io
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 7)
end
space_travel.move(player, pos, 7)
elseif list_number == "8" then --Europa
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 8)
end
space_travel.move(player, pos, 8)
elseif list_number == "9" then --Ganymede
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 5)
end
space_travel.move(player, pos, 5)
elseif list_number == "10" then --Callisto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 6)
end
space_travel.move(player, pos, 6)
elseif list_number == "11" then --Titan
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 9)
end
space_travel.move(player, pos, 9)
elseif list_number == "12" then --Oberon
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 10)
end
space_travel.move(player, pos, 10)
elseif list_number == "13" then --Triton
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 11)
end
space_travel.move(player, pos, 11)
elseif list_number == "14" then --Pluto
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 12)
end
space_travel.move(player, pos, 12)
elseif list_number == "15" then --Charon
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 13)
end
space_travel.move(player, pos, 13)
elseif list_number == "16" then --Sedna
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 14)
end
space_travel.move(player, pos, 14)
elseif list_number == "17" then --Minerva
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 16)
end
space_travel.move(player, pos, 16)
elseif list_number == "18" then --Bacchus
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 17)
end
space_travel.move(player, pos, 17)
elseif list_number == "19" then --Ourea
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 18)
end
space_travel.move(player, pos, 18)
elseif list_number == "20" then --Osiris
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 19)
end
space_travel.move(player, pos, 19)
elseif list_number == "21" then --Minthe
local attach = player:get_attach()
if attach and attach:get_luaentity() then
space_travel.move(attach, pos, 20)
end
space_travel.move(player, pos, 20)
end
end
else
return
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.")
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.")
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.")
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.")
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.")
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.")
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.")
end
end
})