diff options
author | FaceDeer <derksenmobile@gmail.com> | 2017-01-21 01:46:44 -0700 |
---|---|---|
committer | FaceDeer <derksenmobile@gmail.com> | 2017-01-21 01:46:44 -0700 |
commit | 5008943d94bf12e6eda7ffaec197f8c6771d8f9b (patch) | |
tree | ef33e355d43a7942a9b1a21beeefc97dde74404b | |
parent | dedc22adc4f54a69b0c6294aae337eac39608bac (diff) |
Ensure rounding never brings fuel_burning display below 0
-rw-r--r-- | util_execute_cycle.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util_execute_cycle.lua b/util_execute_cycle.lua index 855c2d6..78bf386 100644 --- a/util_execute_cycle.lua +++ b/util_execute_cycle.lua @@ -88,7 +88,7 @@ end digtron.execute_dig_cycle = function(pos, clicker) local meta = minetest.get_meta(pos) local fuel_burning = meta:get_float("fuel_burning") -- get amount of burned fuel left over from last cycle - local status_text = string.format("Heat remaining in controller furnace: %d", fuel_burning) + local status_text = string.format("Heat remaining in controller furnace: %d", math.max(0, fuel_burning)) local layout = DigtronLayout.create(pos, clicker) @@ -290,7 +290,7 @@ digtron.execute_dig_cycle = function(pos, clicker) fuel_burning = fuel_burning + digtron.burn(layout.fuelstores, -fuel_burning, false) end meta:set_float("fuel_burning", fuel_burning) - status_text = status_text .. string.format("Heat remaining in controller furnace: %d", fuel_burning) + status_text = status_text .. string.format("Heat remaining in controller furnace: %d", math.max(0, fuel_burning)) -- Eyecandy for _, particles in pairs(particle_systems) do @@ -364,7 +364,7 @@ end digtron.execute_downward_dig_cycle = function(pos, clicker) local meta = minetest.get_meta(pos) local fuel_burning = meta:get_float("fuel_burning") -- get amount of burned fuel left over from last cycle - local status_text = string.format("Heat remaining in controller furnace: %d", fuel_burning) + local status_text = string.format("Heat remaining in controller furnace: %d", math.max(0, fuel_burning)) local layout = DigtronLayout.create(pos, clicker) @@ -472,7 +472,7 @@ digtron.execute_downward_dig_cycle = function(pos, clicker) fuel_burning = fuel_burning + digtron.burn(layout.fuelstores, -fuel_burning, false) end meta:set_float("fuel_burning", fuel_burning) - status_text = status_text .. string.format("Heat remaining in controller furnace: %d", fuel_burning) + status_text = status_text .. string.format("Heat remaining in controller furnace: %d", math.max(0, fuel_burning)) -- Eyecandy for _, particles in pairs(particle_systems) do |