Some bugfixes
This commit is contained in:
parent
b0e7e97dab
commit
49350278c0
@ -84,7 +84,7 @@ local function can_start(pos, nvm)
|
||||
if diameter then
|
||||
nvm.capa_max = PWR_CAPA[tonumber(diameter)] or 0
|
||||
if nvm.capa_max ~= 0 then
|
||||
nvm.capa = math.min(nvm.capa, nvm.capa_max)
|
||||
nvm.capa = math.min(nvm.capa or 0, nvm.capa_max)
|
||||
local owner = M(pos):get_string("owner") or ""
|
||||
return heatexchanger1_cmnd(pos, "volume", owner)
|
||||
else
|
||||
|
@ -85,6 +85,7 @@ end
|
||||
|
||||
local function stop_node(pos, nvm, state)
|
||||
nvm.provided = 0
|
||||
nvm.running = nil -- legacy
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
power.start_storage_calc(pos, Cable, outdir)
|
||||
end
|
||||
|
@ -213,7 +213,7 @@ function techage.generator_settings(tier, available)
|
||||
},
|
||||
{
|
||||
type = "dropdown",
|
||||
choices = "40% - 60%,60% - 80%,80% - 100%",
|
||||
choices = "0% - 20%,20% - 40%,40% - 60%,60% - 80%,80% - 100%,90% - 100%",
|
||||
name = "termpoint",
|
||||
label = S("Charge termination"),
|
||||
tooltip = S("Range in which the generator reduces its power"),
|
||||
@ -237,7 +237,7 @@ function techage.generator_settings(tier, available)
|
||||
},
|
||||
{
|
||||
type = "dropdown",
|
||||
choices = "40% - 60%,60% - 80%,80% - 100%",
|
||||
choices = "0% - 20%,20% - 40%,40% - 60%,60% - 80%,80% - 100%,90% - 100%",
|
||||
name = "termpoint",
|
||||
label = S("Charge termination"),
|
||||
tooltip = S("Range in which the generator reduces its power"),
|
||||
@ -250,7 +250,13 @@ end
|
||||
|
||||
function techage.evaluate_charge_termination(nvm, meta)
|
||||
local termpoint = meta:get_string("termpoint")
|
||||
if termpoint == "40% - 60%" then
|
||||
if termpoint == "0% - 20%" then
|
||||
meta:set_string("termpoint1", 0.0)
|
||||
meta:set_string("termpoint2", 0.2)
|
||||
elseif termpoint == "20% - 40%" then
|
||||
meta:set_string("termpoint1", 0.2)
|
||||
meta:set_string("termpoint2", 0.4)
|
||||
elseif termpoint == "40% - 60%" then
|
||||
meta:set_string("termpoint1", 0.4)
|
||||
meta:set_string("termpoint2", 0.6)
|
||||
elseif termpoint == "60% - 80%" then
|
||||
@ -259,6 +265,9 @@ function techage.evaluate_charge_termination(nvm, meta)
|
||||
elseif termpoint == "80% - 100%" then
|
||||
meta:set_string("termpoint1", 0.8)
|
||||
meta:set_string("termpoint2", 1.0)
|
||||
elseif termpoint == "90% - 100%" then
|
||||
meta:set_string("termpoint1", 0.9)
|
||||
meta:set_string("termpoint2", 1.0)
|
||||
else
|
||||
meta:set_string("termpoint", "80% - 100%")
|
||||
meta:set_string("termpoint1", 0.8)
|
||||
|
@ -30,7 +30,7 @@ local COUNTDOWN_TICKS = 1
|
||||
local function determine_power(pos, nvm)
|
||||
-- determine DC node position
|
||||
local outdir = M(pos):get_int("leftdir")
|
||||
local netw = networks.get_network_table(pos, Solar, outdir, true) or {}
|
||||
local netw = networks.get_network_table(pos, Solar, outdir) or {}
|
||||
local num_inv = #(netw.con or {})
|
||||
local max_power = 0
|
||||
for _, power in ipairs(control.request(pos, Solar, outdir, "junc", "power")) do
|
||||
@ -100,6 +100,7 @@ end
|
||||
|
||||
local function stop_node(pos, nvm, state)
|
||||
nvm.provided = 0
|
||||
nvm.running = nil -- legacy
|
||||
local outdir = M(pos):get_int("outdir")
|
||||
power.start_storage_calc(pos, Cable, outdir)
|
||||
end
|
||||
|
@ -81,14 +81,15 @@ end
|
||||
local function add_rotor(pos, nvm, force)
|
||||
if (force and not nvm.error) or check_rotor(pos, nvm) then
|
||||
local hash = minetest.hash_node_position(pos)
|
||||
if not Rotors[hash] then
|
||||
local node = minetest.get_node(pos)
|
||||
local npos, yaw = pos_and_yaw(pos, node.param2)
|
||||
local obj = minetest.add_entity(npos, "techage:rotor_ent")
|
||||
obj:set_animation({x = 0, y = 119}, 0, 0, true)
|
||||
obj:set_rotation(yaw)
|
||||
Rotors[hash] = obj
|
||||
if Rotors[hash] then
|
||||
Rotors[hash]:remove()
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
local npos, yaw = pos_and_yaw(pos, node.param2)
|
||||
local obj = minetest.add_entity(npos, "techage:rotor_ent")
|
||||
obj:set_animation({x = 0, y = 119}, 0, 0, true)
|
||||
obj:set_rotation(yaw)
|
||||
Rotors[hash] = obj
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user