some corrections

This commit is contained in:
Joachim Stolberg 2017-07-06 20:05:17 +02:00
parent 038df15f0e
commit f8f2bd3102
10 changed files with 168 additions and 174 deletions

View File

@ -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: ![GitHub](https://github.com/joe7575/Minetest-Hyperloop) Browse on: ![GitHub](https://github.com/joe7575/Minetest-Hyperloop)
@ -22,6 +22,13 @@ Download: ![GitHub](https://github.com/joe7575/Minetest-Hyperloop/archive/master
[Contruction Manual](introduction.md) [Contruction Manual](introduction.md)
## Still To Do
* recipes
* better formspec for the map tool
* performance improvements
## Dependencies ## Dependencies
default default

View File

@ -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,7 +116,7 @@ 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
@ -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)

View File

@ -76,7 +76,7 @@ minetest.register_node("hyperloop:doorTopPassive", {
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,
@ -107,7 +107,7 @@ minetest.register_node("hyperloop:doorTopActive", {
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,
@ -140,20 +140,3 @@ minetest.register_node("hyperloop:doorBottom", {
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,
})

View File

@ -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")

View File

@ -15,7 +15,7 @@ Build the pod around the seat according to the following picture. To get the bes
![Image](https://github.com/joe7575/Minetest-Hyperloop/blob/master/img/intro04.png) ![Image](https://github.com/joe7575/Minetest-Hyperloop/blob/master/img/intro04.png)
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).
![Image](https://github.com/joe7575/Minetest-Hyperloop/blob/master/img/intro02.png) ![Image](https://github.com/joe7575/Minetest-Hyperloop/blob/master/img/intro02.png)

View File

@ -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,

View File

@ -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",

View File

@ -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
if player ~= nil then
player:setpos(dst_pos) player:setpos(dst_pos)
-- rotate player to look in correct arrival direction -- rotate player to look in correct arrival direction
-- calculate the look correction -- calculate the look correction
if player ~= nil then -- player already gone?
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

View File

@ -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