minicell bugfix
This commit is contained in:
parent
1024f8ccc5
commit
0815c6b485
@ -117,10 +117,8 @@ local function after_place_node(pos, placer)
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
local nvm = techage.get_nvm(pos)
|
local nvm = techage.get_nvm(pos)
|
||||||
local own_num = techage.add_node(pos, "techage:heatexchanger2")
|
State:node_init(pos, nvm, "")
|
||||||
State:node_init(pos, nvm, own_num)
|
|
||||||
M(pos):set_string("formspec", formspec(State, pos, nvm))
|
M(pos):set_string("formspec", formspec(State, pos, nvm))
|
||||||
M(pos):set_string("infotext", S("TA4 Heat Exchanger").." "..own_num)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_receive_fields(pos, formname, fields, player)
|
local function on_receive_fields(pos, formname, fields, player)
|
||||||
|
2
init.lua
2
init.lua
@ -186,7 +186,7 @@ else
|
|||||||
-- Test
|
-- Test
|
||||||
dofile(MP.."/recipe_checker.lua")
|
dofile(MP.."/recipe_checker.lua")
|
||||||
dofile(MP.."/.test/sink.lua")
|
dofile(MP.."/.test/sink.lua")
|
||||||
dofile(MP.."/.test/meta_node.lua")
|
--dofile(MP.."/.test/meta_node.lua")
|
||||||
|
|
||||||
-- Solar
|
-- Solar
|
||||||
dofile(MP.."/solar/minicell.lua")
|
dofile(MP.."/solar/minicell.lua")
|
||||||
|
@ -17,6 +17,7 @@ local P2P = minetest.string_to_pos
|
|||||||
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||||
local M = minetest.get_meta
|
local M = minetest.get_meta
|
||||||
local N = function(pos) return minetest.get_node(pos).name end
|
local N = function(pos) return minetest.get_node(pos).name end
|
||||||
|
local HEX = function(val) return string.format("%XH", val) end
|
||||||
|
|
||||||
local power = techage.power
|
local power = techage.power
|
||||||
local networks = techage.networks
|
local networks = techage.networks
|
||||||
|
@ -19,12 +19,7 @@ local S = techage.S
|
|||||||
|
|
||||||
local CYCLE_TIME = 2
|
local CYCLE_TIME = 2
|
||||||
local PWR_PERF = 1
|
local PWR_PERF = 1
|
||||||
local PWR_CAPA = 30 * 20 -- default day
|
local PWR_CAPA = 2400 -- ticks (2s) with 1 ku ==> 80 min = 4 game days
|
||||||
|
|
||||||
minetest.after(2, function()
|
|
||||||
-- calculate the capacity depending on the day duration
|
|
||||||
PWR_CAPA = math.max(minetest.get_gametime() / minetest.get_day_count() / 2, PWR_CAPA)
|
|
||||||
end)
|
|
||||||
|
|
||||||
local Cable = techage.ElectricCable
|
local Cable = techage.ElectricCable
|
||||||
local power = techage.power
|
local power = techage.power
|
||||||
@ -34,15 +29,18 @@ local function node_timer(pos, elapsed)
|
|||||||
nvm.capa = nvm.capa or 0
|
nvm.capa = nvm.capa or 0
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
local light = minetest.get_node_light(pos) or 0
|
local light = minetest.get_node_light(pos) or 0
|
||||||
|
local t = minetest.get_timeofday()
|
||||||
pos.y = pos.y - 1
|
pos.y = pos.y - 1
|
||||||
|
|
||||||
if light >= (minetest.LIGHT_MAX - 1) then
|
if t > 0.25 and t < 0.75 then
|
||||||
if nvm.providing then
|
if nvm.providing then
|
||||||
power.generator_stop(pos, Cable, 5)
|
power.generator_stop(pos, Cable, 5)
|
||||||
nvm.providing = false
|
nvm.providing = false
|
||||||
nvm.provided = 0
|
nvm.provided = 0
|
||||||
end
|
end
|
||||||
|
if light >= (minetest.LIGHT_MAX - 1) then
|
||||||
nvm.capa = math.min(nvm.capa + PWR_PERF * 1.2, PWR_CAPA)
|
nvm.capa = math.min(nvm.capa + PWR_PERF * 1.2, PWR_CAPA)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if nvm.capa > 0 then
|
if nvm.capa > 0 then
|
||||||
if not nvm.providing then
|
if not nvm.providing then
|
||||||
@ -88,7 +86,7 @@ local net_def = {
|
|||||||
ele1 = {
|
ele1 = {
|
||||||
sides = {D = 1},
|
sides = {D = 1},
|
||||||
ntype = "gen1",
|
ntype = "gen1",
|
||||||
nominal = PWR_CAPA,
|
nominal = PWR_PERF,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user