summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOch Noe <och_noe@forksworld.de>2018-06-18 17:37:28 +0200
committerOch Noe <och_noe@forksworld.de>2018-06-18 17:37:28 +0200
commitffe206d82ede453597d8a9d860faa32003f3143b (patch)
tree1facc34c51c0df07eff191ba2d211fc14a2ad7b8
parent0cb8d2dc3333e6e885c0470c3dcfe3d349dadac6 (diff)
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.
-rw-r--r--util_execute_cycle.lua10
1 files changed, 9 insertions, 1 deletions
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