Fix up various bugs for 5.4.0 compat, which is minimal supported version
This commit is contained in:
parent
9e00f9b979
commit
7d06ad69d9
@ -122,7 +122,7 @@ local function useLava(meta, totalLavaUse, totalTime, runningTime, elapsed, isNe
|
||||
if remainigTime <= 0 then
|
||||
lavaUse = math.max(0, totalLavaUse - lavaUsedSoFar) -- use up all that's left
|
||||
else
|
||||
lavaUse = math.round(totalLavaUse * elapsed / totalTime)
|
||||
lavaUse = logistica.round(totalLavaUse * elapsed / totalTime)
|
||||
end
|
||||
if currAmount - lavaUse < 0 then
|
||||
return nil -- not enough lava in tank
|
||||
@ -150,7 +150,7 @@ end
|
||||
local function common_formspec(pos, meta)
|
||||
local currLava = meta:get_int(META_LAVA_IN_TANK)
|
||||
local lavaCap = get_lava_capacity(pos) or 1
|
||||
local lavaPercent = math.round(currLava / lavaCap * 100)
|
||||
local lavaPercent = logistica.round(currLava / lavaCap * 100)
|
||||
return "formspec_version[4]"..
|
||||
"size[10.5,11]"..
|
||||
logistica.ui.background_lava_furnace..
|
||||
@ -178,7 +178,7 @@ local function get_inactive_formspec(pos, meta)
|
||||
end
|
||||
|
||||
local function get_active_formspec(pos, meta, runningTime, totalTime)
|
||||
local timePercent = math.round(runningTime / totalTime * 100)
|
||||
local timePercent = logistica.round(runningTime / totalTime * 100)
|
||||
local progressImg = ""
|
||||
if timePercent > 0 then
|
||||
progressImg = "image[4,2.3;3,1;logistica_lava_furnace_arrow_bg.png^[lowpart:"..timePercent..
|
||||
|
@ -14,7 +14,7 @@ local function add_particle_effect_for_item_taken(itemPos, vaccuumPos)
|
||||
for _ = 1, NUM_PARTICLES_PER_COLLECT do
|
||||
local startPos = vector.add(itemPos, random_offset())
|
||||
local endPos = vector.add(vaccuumPos, vector.new(0, -0.45, 0))
|
||||
local vel = vector.normalize(vector.subtract(endPos, startPos)) * 2
|
||||
local vel = vector.multiply(vector.normalize(vector.subtract(endPos, startPos)), 2)
|
||||
minetest.add_particle({
|
||||
pos = startPos,
|
||||
velocity = vel,
|
||||
|
@ -10,7 +10,7 @@ minetest.register_craftitem("logistica:hyperspanner",{
|
||||
local pos = pointed_thing.under
|
||||
if not placer or not pos then return end
|
||||
local node = minetest.get_node_or_nil(pos)
|
||||
if not node or not logistica.is_machine(node.name) then return end
|
||||
if not node or not (logistica.is_machine(node.name) or logistica.is_cable(node.name)) then return end
|
||||
local network = logistica.get_network_name_or_nil(pos) or S("<NONE>")
|
||||
logistica.show_popup(
|
||||
placer:get_player_name(),
|
||||
|
@ -209,3 +209,10 @@ function logistica.table_to_list_indexed(table, func)
|
||||
for k,v in pairs(table) do index = index + 1; t[index] = func(k, v) end
|
||||
return t
|
||||
end
|
||||
|
||||
function logistica.round(x)
|
||||
if x >= 0 then
|
||||
return math.floor(x + 0.5)
|
||||
end
|
||||
return math.ceil(x - 0.5)
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user