From ffe206d82ede453597d8a9d860faa32003f3143b Mon Sep 17 00:00:00 2001 From: Och Noe Date: Mon, 18 Jun 2018 17:37:28 +0200 Subject: The cause for "no fuel" while digging with filled fuel storage was found. The patch from 2017-01-21 washiding the problem instead of removing the real cause. This patch removes the real cause: the variable 'fuel_burning' can get below 0 but the code does not take this possibilitiy into account. --- util_execute_cycle.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua index b294aa2..f82c762 100644 --- a/util_execute_cycle.lua +++ b/util_execute_cycle.lua @@ -208,6 +208,14 @@ digtron.execute_dig_cycle = function(pos, clicker) local test_fuel_needed = test_build_fuel_cost + digging_fuel_cost - fuel_burning local test_fuel_burned = 0 + -- Fix for "no fuel" with fuel available + -- if fuel_burning is <0, then burn the missing fuel + if (fuel_burning<0) then + test_fuel_needed = test_fuel_needed - fuel_burning + fuel_burning = 0 + end + -- End fix + local power_from_cables = 0 if minetest.get_modpath("technic") then local power_inputs = {} @@ -580,4 +588,4 @@ digtron.execute_downward_dig_cycle = function(pos, clicker) node_to_dig, whether_to_dig = layout.nodes_dug:pop() end return pos, status_text, 0 -end \ No newline at end of file +end -- cgit v1.2.3