space_travel/space_drives.lua
2024-09-16 14:57:09 +05:00

732 lines
27 KiB
Lua

function space_travel.move(object,pos,destination)
--object:set_pos(pos)
local location = -1
if pos.y >= space_travel.yarth and pos.y < space_travel.yarth_orbit then --earth
location = space_travel.yarth_orbit * 0
elseif pos.y >= space_travel.luna and pos.y < space_travel.luna_orbit then --moon
location = space_travel.yarth_orbit * 1
elseif pos.y >= space_travel.mars and pos.y < space_travel.mars_orbit then --mars
location = space_travel.yarth_orbit * 2
elseif pos.y >= space_travel.mercury and pos.y < space_travel.mercury_orbit then --mercury
location = space_travel.yarth_orbit * 3
elseif pos.y >= space_travel.venus and pos.y < space_travel.venus_orbit then --venus
location = space_travel.yarth_orbit * 4
elseif pos.y >= space_travel.ganymede and pos.y < space_travel.ganymede_orbit then --ganymede
location = space_travel.yarth_orbit * 5
elseif pos.y >= space_travel.callisto and pos.y < space_travel.callisto_orbit then --callisto
location = space_travel.yarth_orbit * 6
elseif pos.y >= space_travel.io and pos.y < space_travel.io_orbit then --io
location = space_travel.yarth_orbit * 7
elseif pos.y >= space_travel.europa and pos.y < space_travel.europa_orbit then --europa
location = space_travel.yarth_orbit * 8
elseif pos.y >= space_travel.titan and pos.y < space_travel.titan_orbit then --titan
location = space_travel.yarth_orbit * 9
elseif pos.y >= space_travel.oberon and pos.y < space_travel.oberon_orbit then --oberon
location = space_travel.yarth_orbit * 10
elseif pos.y >= space_travel.triton and pos.y < space_travel.triton_orbit then --triton
location = space_travel.yarth_orbit * 11
elseif pos.y >= space_travel.pluto and pos.y < space_travel.pluto_orbit then --pluto
location = space_travel.yarth_orbit * 12
elseif pos.y >= space_travel.charon and pos.y < space_travel.charon_orbit then --charon
location = space_travel.yarth_orbit * 13
elseif pos.y >= space_travel.sedna and pos.y < space_travel.sedna_orbit then --sedna
location = space_travel.yarth_orbit * 14
elseif pos.y >= space_travel.asteriod_belt and pos.y < space_travel.asteriod_belt_orbit then --asteriod belt
location = space_travel.sedna --15
elseif pos.y >= space_travel.minerva and pos.y < space_travel.minerva_orbit then --minerva
location = space_travel.yarth_orbit * (16 - 1) + 1000
elseif pos.y >= space_travel.bacchus and pos.y < space_travel.bacchus_orbit then --bacchus
location = space_travel.yarth_orbit * (17 - 1) + 1000
elseif pos.y >= space_travel.ourea and pos.y < space_travel.ourea_orbit then --ourea
location = space_travel.yarth_orbit * (18 - 1) + 1000
elseif pos.y >= space_travel.osiris and pos.y < space_travel.osiris_orbit then --osiris
location = space_travel.yarth_orbit * (19 - 1) + 1000
elseif pos.y >= space_travel.minthe and pos.y < 30999 then --minthe
location = space_travel.yarth_orbit * (20 - 1) + 1000
end
if destination < 15 then
destination = space_travel.yarth_orbit * destination
elseif destination == 15 then
destination = space_travel.sedna
elseif destination > 15 then
destination = space_travel.yarth_orbit * (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
})