mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-12-28 03:40:25 +01:00
Remove unused loop variables, trailing whitespace and fix mixed-whitespace indentations
This commit is contained in:
parent
2294a23582
commit
17a602a5a1
@ -47,7 +47,7 @@ local function autocraft(inventory, craft)
|
|||||||
end
|
end
|
||||||
-- consume material
|
-- consume material
|
||||||
for itemname, number in pairs(consumption) do
|
for itemname, number in pairs(consumption) do
|
||||||
for i = 1, number do -- We have to do that since remove_item does not work if count > stack_max
|
for _ = 1, number do -- We have to do that since remove_item does not work if count > stack_max
|
||||||
inventory:remove_item("src", ItemStack(itemname))
|
inventory:remove_item("src", ItemStack(itemname))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -73,7 +73,7 @@ local function run_autocrafter(pos, elapsed)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
for step = 1, math.floor(elapsed/craft_time) do
|
for _ = 1, math.floor(elapsed/craft_time) do
|
||||||
local continue = autocraft(inventory, craft)
|
local continue = autocraft(inventory, craft)
|
||||||
if not continue then return false end
|
if not continue then return false end
|
||||||
end
|
end
|
||||||
|
@ -81,7 +81,7 @@ local function tube_autoroute(pos)
|
|||||||
local basename = nodedef.basename
|
local basename = nodedef.basename
|
||||||
if nodedef.style == "old" then
|
if nodedef.style == "old" then
|
||||||
local nsurround = ""
|
local nsurround = ""
|
||||||
for i, n in ipairs(active) do
|
for _, n in ipairs(active) do
|
||||||
nsurround = nsurround..n
|
nsurround = nsurround..n
|
||||||
end
|
end
|
||||||
nctr.name = basename.."_"..nsurround
|
nctr.name = basename.."_"..nsurround
|
||||||
|
@ -114,7 +114,7 @@ local fs_helpers = {}
|
|||||||
pipeworks.fs_helpers = fs_helpers
|
pipeworks.fs_helpers = fs_helpers
|
||||||
function fs_helpers.on_receive_fields(pos, fields)
|
function fs_helpers.on_receive_fields(pos, fields)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
for field, value in pairs(fields) do
|
for field in pairs(fields) do
|
||||||
if pipeworks.string_startswith(field, "fs_helpers_cycling:") then
|
if pipeworks.string_startswith(field, "fs_helpers_cycling:") then
|
||||||
local l = field:split(":")
|
local l = field:split(":")
|
||||||
local new_value = tonumber(l[2])
|
local new_value = tonumber(l[2])
|
||||||
|
@ -65,7 +65,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
|
|
||||||
open_chests[pn] = nil
|
open_chests[pn] = nil
|
||||||
for k, v in pairs(open_chests) do
|
for _, v in pairs(open_chests) do
|
||||||
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -230,7 +230,7 @@ override.tiles = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- Add the extra groups
|
-- Add the extra groups
|
||||||
for i,v in ipairs({override_protected, override, override_open, override_protected_open}) do
|
for _,v in ipairs({override_protected, override, override_open, override_protected_open}) do
|
||||||
v.groups.tubedevice = 1
|
v.groups.tubedevice = 1
|
||||||
v.groups.tubedevice_receiver = 1
|
v.groups.tubedevice_receiver = 1
|
||||||
end
|
end
|
||||||
|
@ -42,7 +42,7 @@ minetest.register_globalstep(function(dtime)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
tube_item_count = {}
|
tube_item_count = {}
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
if entity.name == "pipeworks:tubed_item" then
|
if entity.name == "pipeworks:tubed_item" then
|
||||||
local h = minetest.hash_node_position(vector.round(entity._pos))
|
local h = minetest.hash_node_position(vector.round(entity._pos))
|
||||||
tube_item_count[h] = (tube_item_count[h] or 0) + 1
|
tube_item_count[h] = (tube_item_count[h] or 0) + 1
|
||||||
@ -393,7 +393,7 @@ if minetest.get_modpath("mesecons_mvps") then
|
|||||||
for _, n in ipairs(moved_nodes) do
|
for _, n in ipairs(moved_nodes) do
|
||||||
moved[minetest.hash_node_position(n.oldpos)] = vector.subtract(n.pos, n.oldpos)
|
moved[minetest.hash_node_position(n.oldpos)] = vector.subtract(n.pos, n.oldpos)
|
||||||
end
|
end
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
if entity.name == "pipeworks:tubed_item" then
|
if entity.name == "pipeworks:tubed_item" then
|
||||||
local pos = entity:get_pos()
|
local pos = entity:get_pos()
|
||||||
local rpos = vector.round(pos)
|
local rpos = vector.round(pos)
|
||||||
|
@ -969,7 +969,7 @@ for white = 0, 1 do
|
|||||||
can_go = function(pos, node, velocity, stack)
|
can_go = function(pos, node, velocity, stack)
|
||||||
local src = {name = nil}
|
local src = {name = nil}
|
||||||
-- add color of the incoming tube explicitly; referring to rules, in case they change later
|
-- add color of the incoming tube explicitly; referring to rules, in case they change later
|
||||||
for color, rule in pairs(rules) do
|
for _, rule in pairs(rules) do
|
||||||
if (-velocity.x == rule.x and -velocity.y == rule.y and -velocity.z == rule.z) then
|
if (-velocity.x == rule.x and -velocity.y == rule.y and -velocity.z == rule.z) then
|
||||||
src.name = rule.name
|
src.name = rule.name
|
||||||
break
|
break
|
||||||
|
@ -318,7 +318,7 @@ end
|
|||||||
function luaentity.get_objects_inside_radius(pos, radius)
|
function luaentity.get_objects_inside_radius(pos, radius)
|
||||||
local objects = {}
|
local objects = {}
|
||||||
local index = 1
|
local index = 1
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
if vector.distance(pos, entity:get_pos()) <= radius then
|
if vector.distance(pos, entity:get_pos()) <= radius then
|
||||||
objects[index] = entity
|
objects[index] = entity
|
||||||
index = index + 1
|
index = index + 1
|
||||||
@ -330,7 +330,7 @@ local move_entities_globalstep_part2 = function(dtime)
|
|||||||
if not luaentity.entities then
|
if not luaentity.entities then
|
||||||
luaentity.entities = read_entities()
|
luaentity.entities = read_entities()
|
||||||
end
|
end
|
||||||
for id, entity in pairs(luaentity.entities) do
|
for _, entity in pairs(luaentity.entities) do
|
||||||
local master = entity._attached_entities_master
|
local master = entity._attached_entities_master
|
||||||
local master_def = master and entity._attached_entities[master]
|
local master_def = master and entity._attached_entities[master]
|
||||||
local master_entity = master_def and master_def.entity
|
local master_entity = master_def and master_def.entity
|
||||||
|
@ -39,7 +39,7 @@ end
|
|||||||
local check_for_liquids_v2 = function(pos, limit)
|
local check_for_liquids_v2 = function(pos, limit)
|
||||||
local coords = make_coords_offsets(pos, false)
|
local coords = make_coords_offsets(pos, false)
|
||||||
local total = 0
|
local total = 0
|
||||||
for index, tpos in ipairs(coords) do
|
for _, tpos in ipairs(coords) do
|
||||||
if total >= limit then break end
|
if total >= limit then break end
|
||||||
local name = minetest.get_node(tpos).name
|
local name = minetest.get_node(tpos).name
|
||||||
if name == "default:water_source" then
|
if name == "default:water_source" then
|
||||||
@ -153,7 +153,7 @@ local get_neighbour_positions = function(pos, node)
|
|||||||
|
|
||||||
-- then, check each possible neighbour to see if they can be reached from this node.
|
-- then, check each possible neighbour to see if they can be reached from this node.
|
||||||
local connections = {}
|
local connections = {}
|
||||||
for index, offset in ipairs(candidates) do
|
for _, offset in ipairs(candidates) do
|
||||||
local npos = vector.add(pos, offset)
|
local npos = vector.add(pos, offset)
|
||||||
local neighbour = minetest.get_node(npos)
|
local neighbour = minetest.get_node(npos)
|
||||||
local nodename = neighbour.name
|
local nodename = neighbour.name
|
||||||
@ -317,7 +317,7 @@ flowlogic.run_transition = function(node, currentpressure)
|
|||||||
local nodename_prev = simplesetdef[1].nodename
|
local nodename_prev = simplesetdef[1].nodename
|
||||||
local result_nodename = node.name
|
local result_nodename = node.name
|
||||||
|
|
||||||
for index, element in ipairs(simplesetdef) do
|
for _, element in ipairs(simplesetdef) do
|
||||||
-- find the highest element that is below the current pressure.
|
-- find the highest element that is below the current pressure.
|
||||||
local threshold = element.threshold
|
local threshold = element.threshold
|
||||||
if threshold > currentpressure then
|
if threshold > currentpressure then
|
||||||
|
@ -106,7 +106,7 @@ register.directional_horizonal_rotate = function(nodename, doubleended)
|
|||||||
end
|
end
|
||||||
local directionfn = function(node, direction)
|
local directionfn = function(node, direction)
|
||||||
local result = false
|
local result = false
|
||||||
for index, endvec in ipairs(getends(node)) do
|
for _, endvec in ipairs(getends(node)) do
|
||||||
if vector.equals(direction, endvec) then result = true end
|
if vector.equals(direction, endvec) then result = true end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
|
@ -23,7 +23,7 @@ end
|
|||||||
local function migrate_tube_db()
|
local function migrate_tube_db()
|
||||||
local tmp_db = {}
|
local tmp_db = {}
|
||||||
tp_tube_db.version = nil
|
tp_tube_db.version = nil
|
||||||
for key, val in pairs(tp_tube_db) do
|
for _, val in pairs(tp_tube_db) do
|
||||||
if(val.channel ~= "") then -- skip unconfigured tubes
|
if(val.channel ~= "") then -- skip unconfigured tubes
|
||||||
tmp_db[hash(val)] = val
|
tmp_db[hash(val)] = val
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user