mirror of
https://github.com/minetest-mods/digtron.git
synced 2024-07-15 03:49:28 +02:00
Ensure rounding never brings fuel_burning display below 0
This commit is contained in:
parent
dedc22adc4
commit
5008943d94
@ -88,7 +88,7 @@ end
|
|||||||
digtron.execute_dig_cycle = function(pos, clicker)
|
digtron.execute_dig_cycle = function(pos, clicker)
|
||||||
local meta = minetest.get_meta(pos)
|
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 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)
|
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)
|
fuel_burning = fuel_burning + digtron.burn(layout.fuelstores, -fuel_burning, false)
|
||||||
end
|
end
|
||||||
meta:set_float("fuel_burning", fuel_burning)
|
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
|
-- Eyecandy
|
||||||
for _, particles in pairs(particle_systems) do
|
for _, particles in pairs(particle_systems) do
|
||||||
@ -364,7 +364,7 @@ end
|
|||||||
digtron.execute_downward_dig_cycle = function(pos, clicker)
|
digtron.execute_downward_dig_cycle = function(pos, clicker)
|
||||||
local meta = minetest.get_meta(pos)
|
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 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)
|
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)
|
fuel_burning = fuel_burning + digtron.burn(layout.fuelstores, -fuel_burning, false)
|
||||||
end
|
end
|
||||||
meta:set_float("fuel_burning", fuel_burning)
|
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
|
-- Eyecandy
|
||||||
for _, particles in pairs(particle_systems) do
|
for _, particles in pairs(particle_systems) do
|
||||||
|
Loading…
Reference in New Issue
Block a user