diff --git a/api/lava_furnace.lua b/api/lava_furnace.lua index 5b6af41..25d89c2 100644 --- a/api/lava_furnace.lua +++ b/api/lava_furnace.lua @@ -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.. diff --git a/logic/vaccuum_chest.lua b/logic/vaccuum_chest.lua index 7aadd9e..6a83244 100644 --- a/logic/vaccuum_chest.lua +++ b/logic/vaccuum_chest.lua @@ -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, diff --git a/tools/misc.lua b/tools/misc.lua index 73a6b87..bece21b 100644 --- a/tools/misc.lua +++ b/tools/misc.lua @@ -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("") logistica.show_popup( placer:get_player_name(), diff --git a/util/common.lua b/util/common.lua index b97f3ae..fe3b207 100644 --- a/util/common.lua +++ b/util/common.lua @@ -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