diff --git a/ta2_energy_storage/ta2_clutch.lua b/ta2_energy_storage/ta2_clutch.lua index 55dda22..08f3123 100644 --- a/ta2_energy_storage/ta2_clutch.lua +++ b/ta2_energy_storage/ta2_clutch.lua @@ -32,7 +32,7 @@ end local function start_node(pos, nvm, state) local outdir = M(pos):get_int("outdir") - switch_axles(pos, true) + --switch_axles(pos, true) nvm.load = 0 power.start_storage_calc(pos, Axle, outdir) outdir = networks.Flip[outdir] @@ -41,7 +41,7 @@ end local function stop_node(pos, nvm, state) local outdir = M(pos):get_int("outdir") - switch_axles(pos, false) + --switch_axles(pos, false) power.start_storage_calc(pos, Axle, outdir) outdir = networks.Flip[outdir] power.start_storage_calc(pos, Axle, outdir) @@ -58,6 +58,7 @@ local State = techage.NodeStates:new({ }) local function node_timer(pos, elapsed) + local t = minetest.get_us_time() local nvm = techage.get_nvm(pos) local outdir2 = M(pos):get_int("outdir") local outdir1 = networks.Flip[outdir2] @@ -66,7 +67,10 @@ local function node_timer(pos, elapsed) if not power_flow then power.start_storage_calc(pos, Axle, outdir1) power.start_storage_calc(pos, Axle, outdir2) + switch_axles(pos, data.curr_load1 ~= 0) end + t = minetest.get_us_time() - t + print("node_timer", t, power_flow, dump(data)) return true end diff --git a/ta2_energy_storage/ta2_winch.lua b/ta2_energy_storage/ta2_winch.lua index a75bb1d..42b5e56 100644 --- a/ta2_energy_storage/ta2_winch.lua +++ b/ta2_energy_storage/ta2_winch.lua @@ -42,7 +42,7 @@ local function chest_load(nvm, pos) nvm.stored_items[i] = {name = stack:get_name(), count = stack:get_count()} amount = amount + stack:get_count() end - return amount + return amount * 3 end local function chest_full(pos) @@ -140,20 +140,19 @@ minetest.register_node("techage:ta2_winch", { remove_chest(pos) nvm.running = true power.start_storage_calc(pos, Axle, outdir) - elseif not nvm.running then - techage.renew_rope(pos, 50) - elseif nvm.running and nvm.load == 0 and not power.power_available(pos, Axle, outdir) then + elseif nvm.running and nvm.load < 2 and not power.power_available(pos, Axle, outdir) then add_chest(pos) nvm.running = false power.start_storage_calc(pos, Axle, outdir) end if nvm.running then - local val = power.get_storage_load(pos, Axle, outdir, nvm.capa) or 0 - if val > 0 then - nvm.load = val + nvm.load = power.get_storage_load(pos, Axle, outdir, nvm.capa) or 0 + if nvm.load > 2 then add_chest_entity(pos, nvm) end + else + techage.renew_rope(pos, 50) end return true end,