From c6611fdedec29f30ab430a308bf15ca5e742fc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Mon, 30 Mar 2020 19:25:32 +0200 Subject: [PATCH] Fix no fuel bug, fix rotation axles and simple controllers being single-use. --- util_execute_cycle.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua index 7c36ae2..eea6476 100644 --- a/util_execute_cycle.lua +++ b/util_execute_cycle.lua @@ -226,6 +226,13 @@ 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 + -- 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 + + local power_from_cables = 0 if minetest.get_modpath("technic") then if layout.power_connectors ~= nil then @@ -247,6 +254,11 @@ digtron.execute_dig_cycle = function(pos, clicker) test_fuel_burned = test_fuel_burned + digtron.tap_batteries(layout.battery_holders, test_fuel_needed, true) end end + if (fuel_burning<0) then + test_fuel_needed = test_fuel_needed - fuel_burning + fuel_burning = 0 + end + if (test_fuel_needed < test_fuel_burned) then exhaust = 0 -- all power needs met by electricity, don't blow smoke else