This commit is contained in:
Joachim Stolberg 2019-10-11 20:08:38 +02:00
parent 4df55a7ce7
commit 10c1700270
5 changed files with 27 additions and 16 deletions

View File

@ -66,7 +66,6 @@ local State = techage.NodeStates:new({
local function node_timer(pos, elapsed)
local mem = tubelib2.get_mem(pos)
print("akku", mem.running, mem.delivered, mem.capa)
if mem.running then
mem.delivered = power.secondary_alive(pos, mem, mem.capa, PWR_CAPA)
mem.capa = mem.capa - mem.delivered

View File

@ -37,6 +37,7 @@ local function collect_network_data(pos, mem)
stor = {},
elec = {},
fcel = {},
other = {},
}
local add = function(kind, attr, val)
data[kind][attr] = (data[kind][attr] or 0) + (val or 0)
@ -79,6 +80,10 @@ local function collect_network_data(pos, mem)
add("elec", "num", 1)
add("elec", "nomi", -(mem.pwr_could_need or 0))
add("elec", "curr", -(mem.consumed or 0))
elseif mem.pwr_needed and mem.pwr_needed > 0 and (mem.pwr_node_alive_cnt or 0) > 0 then
add("other", "num", 1)
add("other", "nomi", -mem.pwr_needed)
add("other", "curr", mem.pwr_state == 3 and -mem.pwr_needed)
end
end
)
@ -91,15 +96,12 @@ local function formspec(pos)
local get = function(kind)
return (data[kind].num or 0).." / "..(data[kind].curr or 0).." ku / "..(data[kind].nomi or 0).. " ku"
end
local get = function(kind)
return (data[kind].num or 0).." / "..(data[kind].curr or 0).." ku / "..(data[kind].nomi or 0).. " ku"
end
local alarm = ""
if nnodes > (techage.MAX_NUM_NODES - 50) then
alarm = " (max. "..(techage.MAX_NUM_NODES).." !!!)"
end
return "size[10,7.5]"..
return "size[9.5,8.2]"..
default.gui_bg..
default.gui_bg_img..
default.gui_slots..
@ -112,8 +114,9 @@ local function formspec(pos)
"label[0,4.2;"..S("TA4 Energy Storage")..":]".. "label[5,4.2;"..get("stor").."]"..
"label[0,4.9;"..S("TA4 Electrolyzer")..":]".. "label[5,4.9;"..get("elec").."]"..
"label[0,5.6;"..S("TA4 Fuel Cell")..":]".. "label[5,5.6;"..get("fcel").."]"..
"label[0,6.3;"..S("Number of nodes").." : "..nnodes..alarm.."]"..
"button[2.5,6.8;2,1;update;"..S("Update").."]"
"label[0,6.3;"..S("Other consumers")..":]".. "label[5,6.3;"..get("other").."]"..
"label[0,7;"..S("Number of nodes").." : "..nnodes..alarm.."]"..
"button[2.5,7.5;2,1;update;"..S("Update").."]"
end
local function update_formspec(pos)

View File

@ -23,8 +23,8 @@ local PWR_PERF = 60
local GRVL_CAPA = 700
local PWR_CAPA = {
[3] = GRVL_CAPA * 3 * 3 * 3, -- 18900 Cyc = 630 min = 31.5 Tage bei einem ku, oder 31,5 * 24 kuh = 756 kuh = 12,6 h bei 60 ku
[4] = GRVL_CAPA * 5 * 5 * 5, -- ~2.5 days
[5] = GRVL_CAPA * 7 * 7 * 7, -- ~6 days
[5] = GRVL_CAPA * 5 * 5 * 5, -- ~2.5 days
[7] = GRVL_CAPA * 7 * 7 * 7, -- ~6 days
}
local Cable = techage.ElectricCable
@ -114,7 +114,6 @@ local function charging(pos, mem, is_charging)
end
local function delivering(pos, mem, delivered)
print("delivering", delivered, mem.had_delivered)
if mem.capa <= 0 then
return
end
@ -162,13 +161,17 @@ local function can_start(pos, mem, state)
local diameter = inlet_cmnd(pos, "diameter")
if diameter then
mem.capa_max = PWR_CAPA[tonumber(diameter)] or 0
print(diameter, mem.capa_max)
local owner = M(pos):get_string("owner") or ""
if inlet_cmnd(pos, "volume", owner) then
error_info(pos, "")
return true
if mem.capa_max ~= 0 then
local owner = M(pos):get_string("owner") or ""
if inlet_cmnd(pos, "volume", owner) then
error_info(pos, "")
return true
else
error_info(pos, "storage volume error")
return false
end
else
error_info(pos, "storage volume error")
error_info(pos, "wrong storage diameter: "..diameter)
return false
end
else

View File

@ -201,6 +201,9 @@ else
dofile(MP.."/energy_storage/inlet.lua")
dofile(MP.."/energy_storage/nodes.lua")
-- Chemistry
--dofile(MP.."/chemistry/reaktor.lua")
-- Hydrogen
dofile(MP.."/hydrogen/hydrogen.lua")
dofile(MP.."/hydrogen/electrolyzer.lua")

View File

@ -105,6 +105,7 @@ minetest.register_node("techage:ta4_solar_module", {
end,
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver.disallow,
groups = {cracky=2, crumbly=2, choppy=2},
is_ground_content = false,
})
@ -131,6 +132,7 @@ minetest.register_node("techage:ta4_solar_carrier", {
},
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver.disallow,
groups = {cracky=2, crumbly=2, choppy=2},
is_ground_content = false,
})
@ -156,6 +158,7 @@ minetest.register_node("techage:ta4_solar_carrierB", {
},
paramtype = "light",
paramtype2 = "facedir",
on_rotate = screwdriver.disallow,
groups = {cracky=2, crumbly=2, choppy=2},
is_ground_content = false,
})