Enable the use of hyperloop networks for other mods

master
Joachim Stolberg 2022-01-03 11:49:04 +01:00
parent 964d6dc258
commit fa17cd87ab
7 changed files with 25 additions and 10 deletions

View File

@ -54,7 +54,7 @@ minetest.register_on_shutdown(function()
end)
-- delete data base entries without corresponding nodes
minetest.after(5, check_data_base)
--minetest.after(5, check_data_base)
-- store data after one hour
minetest.after(60*60, update_mod_storage)

View File

@ -35,13 +35,14 @@
2020-03-12 v2.05 minetest translator added (thanks to acmgit/Clyde)
2020-06-14 v2.06 The default value for `hyperloop_free_tube_placement_enabled` is now true
2021-02-07 v2.07 tube_crowbar: Add tube length check
2021-11-01 v2.08 Enable the use of hyperloop networks for other mods
]]--
hyperloop = {}
-- Version for compatibility checks, see history
hyperloop.version = 2.06
hyperloop.version = 2.08
if minetest.global_exists("techage") and techage.version < 0.06 then
error("[hyperloop] Hyperloop requires techage version 0.06 or newer!")
@ -71,7 +72,7 @@ else
hyperloop.wifi_enabled = minetest.settings:get_bool("hyperloop_wifi_enabled")
hyperloop.wifi_crafting_enabled = minetest.settings:get_bool("hyperloop_wifi_crafting_enabled")
hyperloop.free_tube_placement_enabled = minetest.settings:get_bool("hyperloop_free_tube_placement_enabled", true)
hyperloop.subnet_enabled = minetest.settings:get_bool("hyperloop_subnet_enabled")
hyperloop.subnet_enabled = minetest.settings:get_bool("hyperloop_subnet_enabled", true)
dofile(minetest.get_modpath("hyperloop") .. "/network.lua")
dofile(minetest.get_modpath("hyperloop") .. "/data_base.lua")

View File

@ -28,12 +28,18 @@ Tube:register_on_tube_update(function(node, pos, out_dir, peer_pos, peer_in_dir)
if out_dir <= 5 then
Stations:update_connections(pos, out_dir, peer_pos)
local s = hyperloop.get_connection_string(pos)
M(pos):set_string("infotext", S("Station connected with ")..s)
M(pos):set_string("infotext", S("Station connected to ")..s)
end
elseif node.name == "hyperloop:junction" then
Stations:update_connections(pos, out_dir, peer_pos)
local s = hyperloop.get_connection_string(pos)
M(pos):set_string("infotext", S("Junction connected with ")..s)
M(pos):set_string("infotext", S("Junction connected to ")..s)
elseif Tube.secondary_node_names[node.name] then
if out_dir == 5 then
Stations:update_connections(pos, out_dir, peer_pos)
local s = hyperloop.get_connection_string(pos)
M(pos):set_string("conn_to", s)
end
end
end)

View File

@ -57,8 +57,8 @@ Save=Speichern
### junction.lua ###
Station connected with =Station verbunden mit
Junction connected with =Anschlussstelle verbunden mit
Station connected to =Station verbunden mit
Junction connected to =Anschlussstelle verbunden mit
Hyperloop Junction Block=Hyperloop Anschlussstelle
Hyperloop Pillar=Hyperloop Stütze
@ -77,7 +77,7 @@ Dist.=Entf.
Station/Junction=Station/Anschlussstelle
Position=Position
Owner=Besitzer
Conn. with=Verb. mit
Conn. to=Verb. mit
Close=Schließen
Hyperloop Station Book=Hyperloop Stationsbuch

View File

@ -37,7 +37,7 @@ local function generate_string(sortedList)
"label[1.8,0;"..S("Station/Junction").."]"..
"label[5.4,0;"..S("Position").."]"..
"label[7.9,0;"..S("Owner").."]"..
"label[10,0;"..S("Conn. with").."]"}
"label[10,0;"..S("Conn. to").."]"}
for idx,dataSet in ipairs(sortedList) do
if idx == 23 then
break

View File

@ -278,3 +278,11 @@ function Network:serialize()
return minetest.serialize(self)
end
-- Return a pos/item table with all network nodes, the node at pos is connected with
function Network:get_node_table(pos)
local tRes = {}
local key = S(pos)
get_stations(self.tStations, key, tRes)
tRes[key] = nil
return tRes
end

View File

@ -12,4 +12,4 @@ hyperloop_free_tube_placement_enabled (free tube placement enabled) bool false
# The ticket block has an additional field for specifying a subnet name.
# Stations with the same subnet name (optional) represent an isolated
# subnet within the Hyperloop network.
hyperloop_subnet_enabled (enable building of subnets) bool false
hyperloop_subnet_enabled (enable building of subnets) bool true