Adapt to networks v0.08

This commit is contained in:
Joachim Stolberg 2021-07-06 21:37:29 +02:00
parent da15e05496
commit 086594e24c
15 changed files with 22 additions and 16 deletions

View File

@ -175,7 +175,7 @@ local function after_dig_node3(pos, oldnode)
techage.del_mem(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if nvm.running then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -127,7 +127,7 @@ local function after_dig_node(pos, oldnode)
techage.del_mem(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -227,7 +227,7 @@ local function on_receive_fields(pos, formname, fields, player)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
local function get_storage_data(pos, tlib2)
local function get_storage_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
nvm.capa_max = nvm.capa_max or 1
if techage.is_running(nvm) then

View File

@ -164,7 +164,7 @@ local function after_dig_node(pos, oldnode, oldmetadata, digger)
Cable:after_dig_node(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -36,6 +36,9 @@ elseif minetest.global_exists("lcdlib") and lcdlib.version < 1.0 then
elseif minetest.global_exists("safer_lua") and safer_lua.version < 1.0 then
minetest.log("error", "[techage] Techage requires safer_lua version 1.0 or newer!")
return
elseif minetest.global_exists("networks") and networks.version < 0.08 then
minetest.log("error", "[techage] Techage requires networks version 0.08 or newer!")
return
end
-- Test MT 5.4 new string mode

View File

@ -158,7 +158,7 @@ local function on_rightclick(pos, node, clicker)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / nvm.max_power, perf = nvm.max_power, capa = nvm.max_power * 2}

View File

@ -121,7 +121,7 @@ local function after_dig_node(pos, oldnode)
techage.del_mem(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 4}

View File

@ -158,7 +158,7 @@ minetest.register_node("techage:ta2_winch", {
techage.del_mem(pos)
end,
get_storage_data = function(pos, tlib2)
get_storage_data = function(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
nvm.capa = nvm.capa or 1
if nvm.running then

View File

@ -87,7 +87,7 @@ local function on_receive_fields(pos, formname, fields, player)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
local function get_storage_data(pos, tlib2)
local function get_storage_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if nvm.running then
return {level = (nvm.capa or 0) / PWR_CAPA, capa = PWR_CAPA}

View File

@ -72,7 +72,7 @@ local function node_timer_off(pos, elapsed)
return true
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if nvm.running then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -77,7 +77,7 @@ local function node_timer_off(pos, elapsed)
return true
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if nvm.running then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -164,7 +164,7 @@ local function on_rightclick(pos, node, clicker)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if nvm.running and techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -112,10 +112,13 @@ local function after_dig_node(pos, oldnode, oldmetadata, digger)
techage.del_mem(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}
-- check for secondary/generator side
if outdir == M(pos):get_int("outdir") then
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}
end
end
end

View File

@ -110,7 +110,7 @@ local function after_dig_node(pos, oldnode, oldmetadata, digger)
techage.del_mem(pos)
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}

View File

@ -174,7 +174,7 @@ local function on_receive_fields(pos, formname, fields, player)
M(pos):set_string("formspec", formspec(State, pos, nvm))
end
local function get_generator_data(pos, tlib2)
local function get_generator_data(pos, outdir, tlib2)
local nvm = techage.get_nvm(pos)
if techage.is_running(nvm) then
return {level = (nvm.load or 0) / PWR_PERF, perf = PWR_PERF, capa = PWR_PERF * 2}