some corrections
This commit is contained in:
parent
038df15f0e
commit
f8f2bd3102
@ -9,7 +9,7 @@
|
|||||||
* It can be used even on small servers (Raspberry PI) without lagging
|
* It can be used even on small servers (Raspberry PI) without lagging
|
||||||
* No configuration or programming of the tube network is necessary (only the station names have to be entered)
|
* No configuration or programming of the tube network is necessary (only the station names have to be entered)
|
||||||
|
|
||||||
The mod includes many different blocks for the tubes, the junctions, the stations, the pod, the ticket/booking machine and the map. It also includes a WiFi tube block for very large distances (admin feature).
|
The mod includes many different blocks for the tubes, the junctions, the stations, the pod, the ticket/booking machine and the map tool. It also includes a WiFi tube block for very large distances (admin feature).
|
||||||
|
|
||||||
|
|
||||||
Browse on: 
|
Browse on: 
|
||||||
@ -22,6 +22,13 @@ Download: 
|
[Contruction Manual](introduction.md)
|
||||||
|
|
||||||
|
|
||||||
|
## Still To Do
|
||||||
|
|
||||||
|
* recipes
|
||||||
|
* better formspec for the map tool
|
||||||
|
* performance improvements
|
||||||
|
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
default
|
default
|
||||||
|
|
||||||
|
41
booking.lua
41
booking.lua
@ -23,7 +23,6 @@ function hyperloop.update_all_booking_machines()
|
|||||||
if dataset.booking_pos ~= nil then
|
if dataset.booking_pos ~= nil then
|
||||||
local pos = minetest.string_to_pos(dataset.booking_pos)
|
local pos = minetest.string_to_pos(dataset.booking_pos)
|
||||||
minetest.registered_nodes["hyperloop:booking"].update(pos)
|
minetest.registered_nodes["hyperloop:booking"].update(pos)
|
||||||
break--------------------------TODO
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
t = minetest.get_us_time() - t
|
t = minetest.get_us_time() - t
|
||||||
@ -50,6 +49,9 @@ local function formspec(station_name)
|
|||||||
tRes[2] = "label[1,1;Destination]label[3,1;Distance]label[4.5,1;Position]label[6,1;Local Info]"
|
tRes[2] = "label[1,1;Destination]label[3,1;Distance]label[4.5,1;Position]label[6,1;Local Info]"
|
||||||
local local_pos = hyperloop.tAllStations[station_name]["pos"]
|
local local_pos = hyperloop.tAllStations[station_name]["pos"]
|
||||||
for idx,dest_name in ipairs(get_station_list(station_name)) do
|
for idx,dest_name in ipairs(get_station_list(station_name)) do
|
||||||
|
if idx >= 12 then
|
||||||
|
break
|
||||||
|
end
|
||||||
local ypos = 1 + idx*0.8
|
local ypos = 1 + idx*0.8
|
||||||
local ypos2 = ypos - 0.2
|
local ypos2 = ypos - 0.2
|
||||||
local dest_info = hyperloop.tAllStations[dest_name]["booking_info"] or ""
|
local dest_info = hyperloop.tAllStations[dest_name]["booking_info"] or ""
|
||||||
@ -114,11 +116,11 @@ minetest.register_node("hyperloop:booking", {
|
|||||||
meta:set_string("station_name", station_name)
|
meta:set_string("station_name", station_name)
|
||||||
meta:set_string("infotext", "Station: "..station_name)
|
meta:set_string("infotext", "Station: "..station_name)
|
||||||
meta:set_string("formspec", formspec(station_name))
|
meta:set_string("formspec", formspec(station_name))
|
||||||
--hyperloop.update_all_booking_machines()
|
hyperloop.change_counter = hyperloop.change_counter + 1
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(player:get_player_name(), "[Hyperloop] Error: Invalid station name!")
|
minetest.chat_send_player(player:get_player_name(), "[Hyperloop] Error: Invalid station name!")
|
||||||
end
|
end
|
||||||
-- destination selected?
|
-- destination selected?
|
||||||
elseif fields.button ~= nil then
|
elseif fields.button ~= nil then
|
||||||
local station_name = meta:get_string("station_name")
|
local station_name = meta:get_string("station_name")
|
||||||
local idx = tonumber(fields.button)
|
local idx = tonumber(fields.button)
|
||||||
@ -141,6 +143,7 @@ minetest.register_node("hyperloop:booking", {
|
|||||||
and hyperloop.tAllStations[station_name]["booking_pos"] ~= nil then
|
and hyperloop.tAllStations[station_name]["booking_pos"] ~= nil then
|
||||||
hyperloop.tAllStations[station_name]["booking_pos"] = nil
|
hyperloop.tAllStations[station_name]["booking_pos"] = nil
|
||||||
end
|
end
|
||||||
|
hyperloop.change_counter = hyperloop.change_counter + 1
|
||||||
end,
|
end,
|
||||||
|
|
||||||
update = function(pos)
|
update = function(pos)
|
||||||
@ -157,22 +160,22 @@ minetest.register_node("hyperloop:booking", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "[Hyperloop] Booking machine update",
|
label = "[Hyperloop] Booking machine update",
|
||||||
nodenames = {"hyperloop:booking"},
|
nodenames = {"hyperloop:booking"},
|
||||||
interval = 10.0, -- Run every 10 seconds
|
interval = 10.0, -- Run every 10 seconds
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local counter = meta:get_int("change_counter") or 0
|
local counter = meta:get_int("change_counter") or 0
|
||||||
if hyperloop.change_counter ~= counter then
|
if hyperloop.change_counter ~= counter then
|
||||||
local station_name = meta:get_string("station_name") or nil
|
local station_name = meta:get_string("station_name") or nil
|
||||||
if station_name ~= nil and hyperloop.tAllStations[station_name] ~= nil then
|
if station_name ~= nil and hyperloop.tAllStations[station_name] ~= nil then
|
||||||
local stations = get_station_list(station_name)
|
local stations = get_station_list(station_name)
|
||||||
meta:set_string("formspec", formspec(station_name, stations))
|
meta:set_string("formspec", formspec(station_name, stations))
|
||||||
|
end
|
||||||
|
meta:set_int("change_counter", hyperloop.change_counter)
|
||||||
|
print("booking")
|
||||||
end
|
end
|
||||||
meta:set_int("change_counter", hyperloop.change_counter)
|
|
||||||
print("booking")
|
|
||||||
end
|
end
|
||||||
end
|
})
|
||||||
})
|
|
||||||
|
|
||||||
|
231
door.lua
231
door.lua
@ -18,142 +18,125 @@
|
|||||||
-- facedir: direction to the display
|
-- facedir: direction to the display
|
||||||
-- cmnd: "close", "open", or "animate"
|
-- cmnd: "close", "open", or "animate"
|
||||||
function hyperloop.door_command(seat_pos, facedir, cmnd)
|
function hyperloop.door_command(seat_pos, facedir, cmnd)
|
||||||
-- one step forward
|
-- one step forward
|
||||||
local lcd_pos = vector.add(seat_pos, hyperloop.facedir2dir(facedir))
|
local lcd_pos = vector.add(seat_pos, hyperloop.facedir2dir(facedir))
|
||||||
-- one step left
|
-- one step left
|
||||||
local door_pos1 = vector.add(lcd_pos, hyperloop.facedir2dir(facedir + 1))
|
local door_pos1 = vector.add(lcd_pos, hyperloop.facedir2dir(facedir + 1))
|
||||||
-- one step up
|
-- one step up
|
||||||
local door_pos2 = vector.add(door_pos1, {x=0, y=1, z=0})
|
local door_pos2 = vector.add(door_pos1, {x=0, y=1, z=0})
|
||||||
|
|
||||||
local node1 = minetest.get_node(door_pos1)
|
local node1 = minetest.get_node(door_pos1)
|
||||||
local node2 = minetest.get_node(door_pos2)
|
local node2 = minetest.get_node(door_pos2)
|
||||||
|
|
||||||
-- switch from the radian following facedir to the silly original one
|
-- switch from the radian following facedir to the silly original one
|
||||||
local tbl = {[0]=0, [1]=3, [2]=2, [3]=1}
|
local tbl = {[0]=0, [1]=3, [2]=2, [3]=1}
|
||||||
facedir = (facedir + 3) % 4 -- first turn left
|
facedir = (facedir + 3) % 4 -- first turn left
|
||||||
facedir = tbl[facedir]
|
facedir = tbl[facedir]
|
||||||
|
|
||||||
if cmnd == "open" then
|
if cmnd == "open" then
|
||||||
minetest.sound_play("door", {
|
minetest.sound_play("door", {
|
||||||
pos = seat_pos,
|
pos = seat_pos,
|
||||||
gain = 0.5,
|
gain = 0.5,
|
||||||
max_hear_distance = 5,
|
max_hear_distance = 5,
|
||||||
})
|
})
|
||||||
node1.name = "air"
|
node1.name = "air"
|
||||||
minetest.swap_node(door_pos1, node1)
|
minetest.swap_node(door_pos1, node1)
|
||||||
node2.name = "air"
|
node2.name = "air"
|
||||||
minetest.swap_node(door_pos2, node2)
|
minetest.swap_node(door_pos2, node2)
|
||||||
elseif cmnd == "close" then
|
elseif cmnd == "close" then
|
||||||
minetest.sound_play("door", {
|
minetest.sound_play("door", {
|
||||||
pos = seat_pos,
|
pos = seat_pos,
|
||||||
gain = 0.5,
|
gain = 0.5,
|
||||||
max_hear_distance = 5,
|
max_hear_distance = 5,
|
||||||
})
|
})
|
||||||
node1.name = "hyperloop:doorBottom"
|
node1.name = "hyperloop:doorBottom"
|
||||||
node1.param2 = facedir
|
node1.param2 = facedir
|
||||||
minetest.swap_node(door_pos1, node1)
|
minetest.swap_node(door_pos1, node1)
|
||||||
node2.name = "hyperloop:doorTopPassive"
|
node2.name = "hyperloop:doorTopPassive"
|
||||||
node2.param2 = facedir
|
node2.param2 = facedir
|
||||||
minetest.swap_node(door_pos2, node2)
|
minetest.swap_node(door_pos2, node2)
|
||||||
elseif cmnd == "animate" then
|
elseif cmnd == "animate" then
|
||||||
node2.name = "hyperloop:doorTopActive"
|
node2.name = "hyperloop:doorTopActive"
|
||||||
node2.param2 = facedir
|
node2.param2 = facedir
|
||||||
minetest.swap_node(door_pos2, node2)
|
minetest.swap_node(door_pos2, node2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("hyperloop:doorTopPassive", {
|
minetest.register_node("hyperloop:doorTopPassive", {
|
||||||
description = "Hyperloop Door Top",
|
description = "Hyperloop Door Top",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_door1OUT.png",
|
"hyperloop_door1OUT.png",
|
||||||
"hyperloop_door1OUT.png",
|
"hyperloop_door1OUT.png",
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-8/16, -8/16, -6/16, 8/16, 8/16, 6/16},
|
fixed = {-8/16, -8/16, -5/16, 8/16, 8/16, 5/16},
|
||||||
},
|
},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
diggable = false,
|
diggable = false,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
groups = {cracky=1, not_in_creative_inventory=1},
|
groups = {cracky=1, not_in_creative_inventory=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("hyperloop:doorTopActive", {
|
minetest.register_node("hyperloop:doorTopActive", {
|
||||||
description = "Hyperloop Door Top",
|
description = "Hyperloop Door Top",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
{
|
{
|
||||||
name = "hyperloop_door1IN.png",
|
name = "hyperloop_door1IN.png",
|
||||||
animation = {
|
animation = {
|
||||||
type = "vertical_frames",
|
type = "vertical_frames",
|
||||||
aspect_w = 32,
|
aspect_w = 32,
|
||||||
aspect_h = 32,
|
aspect_h = 32,
|
||||||
length = 1.0,
|
length = 1.0,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
"hyperloop_door1OUT.png",
|
||||||
},
|
},
|
||||||
"hyperloop_door1OUT.png",
|
drawtype = "nodebox",
|
||||||
},
|
node_box = {
|
||||||
drawtype = "nodebox",
|
type = "fixed",
|
||||||
node_box = {
|
fixed = {-8/16, -8/16, -5/16, 8/16, 8/16, 5/16},
|
||||||
type = "fixed",
|
},
|
||||||
fixed = {-8/16, -8/16, -6/16, 8/16, 8/16, 6/16},
|
paramtype2 = "facedir",
|
||||||
},
|
diggable = false,
|
||||||
paramtype2 = "facedir",
|
light_source = 2,
|
||||||
diggable = false,
|
sounds = default.node_sound_metal_defaults(),
|
||||||
light_source = 2,
|
groups = {cracky=1, not_in_creative_inventory=1},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
is_ground_content = false,
|
||||||
groups = {cracky=1, not_in_creative_inventory=1},
|
})
|
||||||
is_ground_content = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("hyperloop:doorBottom", {
|
minetest.register_node("hyperloop:doorBottom", {
|
||||||
description = "Hyperloop Door Bottom",
|
description = "Hyperloop Door Bottom",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_skin_door.png",
|
"hyperloop_skin_door.png",
|
||||||
"hyperloop_door2IN.png",
|
"hyperloop_door2IN.png",
|
||||||
"hyperloop_door2OUT.png",
|
"hyperloop_door2OUT.png",
|
||||||
},
|
},
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-8/16, -8/16, -5/16, 8/16, 8/16, 5/16},
|
fixed = {-8/16, -8/16, -5/16, 8/16, 8/16, 5/16},
|
||||||
},
|
},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
diggable = false,
|
diggable = false,
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
groups = {cracky=1, not_in_creative_inventory=1},
|
groups = {cracky=1, not_in_creative_inventory=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("hyperloop:doorframe", {
|
|
||||||
description = "Hyperloop Pod Doorframe",
|
|
||||||
tiles = {
|
|
||||||
-- up, down, right, left, back, front
|
|
||||||
"hyperloop_skin_door.png^[transformR90]",
|
|
||||||
"hyperloop_skin_door.png^[transformR90]",
|
|
||||||
"hyperloop_skin_door.png",
|
|
||||||
"hyperloop_skin_door.png",
|
|
||||||
"hyperloop_skin.png",
|
|
||||||
"hyperloop_skin.png",
|
|
||||||
},
|
|
||||||
paramtype2 = "facedir",
|
|
||||||
sounds = default.node_sound_metal_defaults(),
|
|
||||||
groups = {cracky=1},
|
|
||||||
is_ground_content = false,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
6
init.lua
6
init.lua
@ -3,7 +3,7 @@
|
|||||||
Hyperloop Mod
|
Hyperloop Mod
|
||||||
=============
|
=============
|
||||||
|
|
||||||
v0.01 by JoSt
|
v0.02 by JoSt
|
||||||
|
|
||||||
Copyright (C) 2017 Joachim Stolberg
|
Copyright (C) 2017 Joachim Stolberg
|
||||||
|
|
||||||
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
History:
|
History:
|
||||||
2017-06-18 v0.01 First version
|
2017-06-18 v0.01 First version
|
||||||
|
2017-07-06 v0.02 Version on GitHub
|
||||||
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
@ -23,7 +24,7 @@ hyperloop = {
|
|||||||
change_counter = 0, -- used for booking machine updates
|
change_counter = 0, -- used for booking machine updates
|
||||||
}
|
}
|
||||||
|
|
||||||
hyperloop.debugging = true
|
hyperloop.debugging = false
|
||||||
|
|
||||||
dofile(minetest.get_modpath("hyperloop") .. "/utils.lua")
|
dofile(minetest.get_modpath("hyperloop") .. "/utils.lua")
|
||||||
dofile(minetest.get_modpath("hyperloop") .. "/tube.lua")
|
dofile(minetest.get_modpath("hyperloop") .. "/tube.lua")
|
||||||
@ -35,6 +36,5 @@ dofile(minetest.get_modpath("hyperloop") .. "/seat.lua")
|
|||||||
dofile(minetest.get_modpath("hyperloop") .. "/pod.lua")
|
dofile(minetest.get_modpath("hyperloop") .. "/pod.lua")
|
||||||
dofile(minetest.get_modpath("hyperloop") .. "/lcd.lua")
|
dofile(minetest.get_modpath("hyperloop") .. "/lcd.lua")
|
||||||
dofile(minetest.get_modpath("hyperloop") .. "/wifi.lua")
|
dofile(minetest.get_modpath("hyperloop") .. "/wifi.lua")
|
||||||
--dofile(minetest.get_modpath("hyperloop") .. "/robot.lua")
|
|
||||||
|
|
||||||
print ("[MOD] Hyperloop loaded")
|
print ("[MOD] Hyperloop loaded")
|
||||||
|
@ -15,7 +15,7 @@ Build the pod around the seat according to the following picture. To get the bes
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
The pod shell is not important for the function, the minimal equipment for testing is: the Tube line with Junction Blocks, a Pod Seat on each station, the Display in front of the seat, and the Booking Machine. The Booking Machine has to get the same station name as the Junction block and has to be placed nearby the Junction block (max. 20 blocks difference).
|
The pod shell is not important for the function, the minimal equipment for testing is: the Tube line with Junction blocks, a Pod Seat on each station, the Display in front of the seat, and the Booking Machine. The Booking Machine has to get the same station name as the Junction block and has to be placed nearby the Junction block (max. 30 blocks difference).
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
26
junction.lua
26
junction.lua
@ -72,7 +72,7 @@ minetest.register_node("hyperloop:junction", {
|
|||||||
meta:set_string("infotext", "Station "..default_name(pos))
|
meta:set_string("infotext", "Station "..default_name(pos))
|
||||||
meta:set_string("formspec", formspec)
|
meta:set_string("formspec", formspec)
|
||||||
store_routes(pos, placer)
|
store_routes(pos, placer)
|
||||||
--hyperloop.update_all_booking_machines()
|
hyperloop.change_counter = hyperloop.change_counter + 1
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, player)
|
on_receive_fields = function(pos, formname, fields, player)
|
||||||
@ -98,7 +98,7 @@ minetest.register_node("hyperloop:junction", {
|
|||||||
meta:set_string("station_name", station_name)
|
meta:set_string("station_name", station_name)
|
||||||
meta:set_string("infotext", "Station '"..station_name.."'")
|
meta:set_string("infotext", "Station '"..station_name.."'")
|
||||||
store_routes(pos, player)
|
store_routes(pos, player)
|
||||||
--hyperloop.update_all_booking_machines()
|
hyperloop.change_counter = hyperloop.change_counter + 1
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_destruct = function(pos)
|
on_destruct = function(pos)
|
||||||
@ -107,7 +107,7 @@ minetest.register_node("hyperloop:junction", {
|
|||||||
local station_name = meta:get_string("station_name")
|
local station_name = meta:get_string("station_name")
|
||||||
if hyperloop.tAllStations[station_name] ~= nil then
|
if hyperloop.tAllStations[station_name] ~= nil then
|
||||||
hyperloop.tAllStations[station_name] = nil
|
hyperloop.tAllStations[station_name] = nil
|
||||||
--hyperloop.update_all_booking_machines()
|
hyperloop.change_counter = hyperloop.change_counter + 1
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@ -125,15 +125,15 @@ minetest.register_node("hyperloop:junction", {
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
label = "[Hyperloop] Junction update",
|
label = "[Hyperloop] Junction update",
|
||||||
name = "hyperloop:update",
|
name = "hyperloop:update",
|
||||||
nodenames = {"hyperloop:junction"},
|
nodenames = {"hyperloop:junction"},
|
||||||
run_at_every_load = true,
|
run_at_every_load = true,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
if hyperloop.debugging then
|
if hyperloop.debugging then
|
||||||
print("Junction loaded")
|
print("Junction loaded")
|
||||||
|
end
|
||||||
|
store_routes(pos, nil)
|
||||||
end
|
end
|
||||||
store_routes(pos, nil)
|
})
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
|
2
pod.lua
2
pod.lua
@ -28,7 +28,7 @@ end
|
|||||||
|
|
||||||
-- to build the pod
|
-- to build the pod
|
||||||
minetest.register_node("hyperloop:pod_wall", {
|
minetest.register_node("hyperloop:pod_wall", {
|
||||||
description = "Hyperloop Pod Wall",
|
description = "Hyperloop Pod Shell",
|
||||||
tiles = {
|
tiles = {
|
||||||
-- up, down, right, left, back, front
|
-- up, down, right, left, back, front
|
||||||
"hyperloop_skin2.png",
|
"hyperloop_skin2.png",
|
||||||
|
16
seat.lua
16
seat.lua
@ -43,15 +43,15 @@ local function on_arrival(player, src_pos, src_facedir, dst_pos, snd, radiant)
|
|||||||
|
|
||||||
-- activate display
|
-- activate display
|
||||||
local station_name = meta:get_string("station_name")
|
local station_name = meta:get_string("station_name")
|
||||||
local text = " | Welcome at | | "..station_name
|
local text = " | Welcome at | | "..string.sub(station_name, 1, 13)
|
||||||
hyperloop.enter_display(dst_pos, facedir, text)
|
hyperloop.enter_display(dst_pos, facedir, text)
|
||||||
-- stop timer
|
-- stop timer
|
||||||
minetest.get_node_timer(src_pos):stop()
|
minetest.get_node_timer(src_pos):stop()
|
||||||
-- move player to the arrival station
|
-- move player to the arrival station
|
||||||
player:setpos(dst_pos)
|
if player ~= nil then
|
||||||
-- rotate player to look in correct arrival direction
|
player:setpos(dst_pos)
|
||||||
-- calculate the look correction
|
-- rotate player to look in correct arrival direction
|
||||||
if player ~= nil then -- player already gone?
|
-- calculate the look correction
|
||||||
local offs = radiant - player:get_look_horizontal()
|
local offs = radiant - player:get_look_horizontal()
|
||||||
local yaw = hyperloop.facedir2rad(facedir) + offs
|
local yaw = hyperloop.facedir2rad(facedir) + offs
|
||||||
player:set_look_yaw(yaw)
|
player:set_look_yaw(yaw)
|
||||||
@ -105,9 +105,9 @@ local function meter_to_km(dist)
|
|||||||
if dist < 1000 then
|
if dist < 1000 then
|
||||||
return tostring(dist).." m"
|
return tostring(dist).." m"
|
||||||
elseif dist < 10000 then
|
elseif dist < 10000 then
|
||||||
return tostring(math.floor(dist/1000)).."."..string.sub(tostring(math.floor(dist%1000)),1, -2).." km"
|
return string.format("%.3f km", dist/1000)
|
||||||
else
|
else
|
||||||
return tostring(math.floor(dist/1000)).."."..string.sub(tostring(math.floor(dist%1000)),1, -3).." km"
|
return string.format("%.1f km", dist/1000)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ local function on_start_travel(pos, node, clicker)
|
|||||||
|
|
||||||
-- activate display
|
-- activate display
|
||||||
local dist = hyperloop.distance(pos, dest_pos)
|
local dist = hyperloop.distance(pos, dest_pos)
|
||||||
local text = "Destination: | "..dest_name.." | Distance: | "..meter_to_km(dist).." | Arrival in: | "
|
local text = "Destination: | "..string.sub(dest_name, 1, 13).." | Distance: | "..meter_to_km(dist).." | Arrival in: | "
|
||||||
local atime
|
local atime
|
||||||
if dist < 1000 then
|
if dist < 1000 then
|
||||||
atime = 10 + math.floor(dist/100) -- 10..20 sec
|
atime = 10 + math.floor(dist/100) -- 10..20 sec
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
1
tube.lua
1
tube.lua
@ -222,6 +222,7 @@ for idx = 0,1 do
|
|||||||
groups = {cracky=2, not_in_creative_inventory=idx},
|
groups = {cracky=2, not_in_creative_inventory=idx},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
drop = "hyperloop:tube0",
|
drop = "hyperloop:tube0",
|
||||||
|
sounds = default.node_sound_metal_defaults(),
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user