summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2021-02-05 18:03:54 +0000
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2021-02-05 18:03:54 +0000
commitf0ef43823cb198a3f426d7d1db88d42f5079fbbd (patch)
tree27f0ebea3b8ac8f36eea8fb58d38947fab81e31d
parent2294a235826810864c1dbae7db644dfbc4722e6c (diff)
parent17a602a5a1d3b0362152222dc62c102c399ec4a4 (diff)
downloadpipeworks-f0ef43823cb198a3f426d7d1db88d42f5079fbbd.tar
pipeworks-f0ef43823cb198a3f426d7d1db88d42f5079fbbd.tar.gz
pipeworks-f0ef43823cb198a3f426d7d1db88d42f5079fbbd.tar.bz2
pipeworks-f0ef43823cb198a3f426d7d1db88d42f5079fbbd.tar.xz
pipeworks-f0ef43823cb198a3f426d7d1db88d42f5079fbbd.zip
Merge branch 'm_unused_loop_vars' into 'master'
Remove unused loop variables, trailing whitespace and fix mixed-whitespace indentations See merge request VanessaE/pipeworks!34
-rw-r--r--autocrafter.lua4
-rw-r--r--autoplace_tubes.lua2
-rw-r--r--common.lua2
-rw-r--r--compat-chests.lua4
-rw-r--r--devices.lua8
-rw-r--r--flowing_logic.lua12
-rw-r--r--item_transport.lua4
-rw-r--r--legacy.lua6
-rw-r--r--lua_tube.lua2
-rw-r--r--luaentity.lua18
-rw-r--r--pressure_logic/abms.lua6
-rw-r--r--pressure_logic/flowable_node_registry_install.lua2
-rw-r--r--teleport_tube.lua4
-rw-r--r--trashcan.lua12
14 files changed, 43 insertions, 43 deletions
diff --git a/autocrafter.lua b/autocrafter.lua
index 92b8eca..313e178 100644
--- a/autocrafter.lua
+++ b/autocrafter.lua
@@ -47,7 +47,7 @@ local function autocraft(inventory, craft)
end
-- consume material
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))
end
end
@@ -73,7 +73,7 @@ local function run_autocrafter(pos, elapsed)
return false
end
- for step = 1, math.floor(elapsed/craft_time) do
+ for _ = 1, math.floor(elapsed/craft_time) do
local continue = autocraft(inventory, craft)
if not continue then return false end
end
diff --git a/autoplace_tubes.lua b/autoplace_tubes.lua
index 51ee383..8348430 100644
--- a/autoplace_tubes.lua
+++ b/autoplace_tubes.lua
@@ -81,7 +81,7 @@ local function tube_autoroute(pos)
local basename = nodedef.basename
if nodedef.style == "old" then
local nsurround = ""
- for i, n in ipairs(active) do
+ for _, n in ipairs(active) do
nsurround = nsurround..n
end
nctr.name = basename.."_"..nsurround
diff --git a/common.lua b/common.lua
index a2a8cea..120a32f 100644
--- a/common.lua
+++ b/common.lua
@@ -114,7 +114,7 @@ local fs_helpers = {}
pipeworks.fs_helpers = fs_helpers
function fs_helpers.on_receive_fields(pos, fields)
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
local l = field:split(":")
local new_value = tonumber(l[2])
diff --git a/compat-chests.lua b/compat-chests.lua
index c2c2020..2da00ea 100644
--- a/compat-chests.lua
+++ b/compat-chests.lua
@@ -65,7 +65,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local node = minetest.get_node(pos)
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
return true
end
@@ -230,7 +230,7 @@ override.tiles = {
}
-- 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_receiver = 1
end
diff --git a/devices.lua b/devices.lua
index 3ddd3bf..a96767b 100644
--- a/devices.lua
+++ b/devices.lua
@@ -187,11 +187,11 @@ for s in ipairs(states) do
paramtype = "light",
paramtype2 = "facedir",
selection_box = {
- type = "fixed",
+ type = "fixed",
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
collision_box = {
- type = "fixed",
+ type = "fixed",
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
groups = dgroups,
@@ -233,11 +233,11 @@ minetest.register_node(nodename_valve_loaded, {
paramtype = "light",
paramtype2 = "facedir",
selection_box = {
- type = "fixed",
+ type = "fixed",
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
collision_box = {
- type = "fixed",
+ type = "fixed",
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
},
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
diff --git a/flowing_logic.lua b/flowing_logic.lua
index 0c80a77..55c3ac7 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -60,8 +60,8 @@ pipeworks.check_for_inflows = function(pos,node)
end
end
end
- if newnode then
- minetest.add_node(pos,{name=newnode, param2 = node.param2})
+ if newnode then
+ minetest.add_node(pos,{name=newnode, param2 = node.param2})
minetest.get_meta(pos):set_string("source",minetest.pos_to_string(source))
end
end
@@ -75,15 +75,15 @@ pipeworks.check_sources = function(pos,node)
newnode = string.gsub(node.name,"loaded","empty")
end
- if newnode then
- minetest.add_node(pos,{name=newnode, param2 = node.param2})
+ if newnode then
+ minetest.add_node(pos,{name=newnode, param2 = node.param2})
minetest.get_meta(pos):set_string("source","")
end
end
pipeworks.spigot_check = function(pos, node)
local belowname = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}).name
- if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
+ if belowname and (belowname == "air" or belowname == "default:water_flowing" or belowname == "default:water_source") then
local spigotname = minetest.get_node(pos).name
local fdir=node.param2 % 4
local check = {
@@ -113,7 +113,7 @@ end
pipeworks.fountainhead_check = function(pos, node)
local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name
- if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
+ if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then
local fountainhead_name = minetest.get_node(pos).name
local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z})
if near_node and string.find(near_node.name, "_loaded") then
diff --git a/item_transport.lua b/item_transport.lua
index 4c179cc..f302bca 100644
--- a/item_transport.lua
+++ b/item_transport.lua
@@ -42,7 +42,7 @@ minetest.register_globalstep(function(dtime)
return
end
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
local h = minetest.hash_node_position(vector.round(entity._pos))
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
moved[minetest.hash_node_position(n.oldpos)] = vector.subtract(n.pos, n.oldpos)
end
- for id, entity in pairs(luaentity.entities) do
+ for _, entity in pairs(luaentity.entities) do
if entity.name == "pipeworks:tubed_item" then
local pos = entity:get_pos()
local rpos = vector.round(pos)
diff --git a/legacy.lua b/legacy.lua
index 25f48d2..72f8cb4 100644
--- a/legacy.lua
+++ b/legacy.lua
@@ -1,6 +1,6 @@
local S = minetest.get_translator("pipeworks")
-if not minetest.get_modpath("auto_tree_tap") and
+if not minetest.get_modpath("auto_tree_tap") and
minetest.get_modpath("technic") then
minetest.register_abm({
@@ -38,10 +38,10 @@ if not minetest.get_modpath("auto_tree_tap") and
after_place_node = function (pos, placer)
pipeworks.scan_for_tube_objects(pos, placer)
local placer_pos = placer:get_pos()
-
+
--correct for the player's height
if placer:is_player() then placer_pos.y = placer_pos.y + 1.5 end
-
+
--correct for 6d facedir
if placer_pos then
local dir = {
diff --git a/lua_tube.lua b/lua_tube.lua
index 543c388..59288cd 100644
--- a/lua_tube.lua
+++ b/lua_tube.lua
@@ -969,7 +969,7 @@ for white = 0, 1 do
can_go = function(pos, node, velocity, stack)
local src = {name = nil}
-- 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
src.name = rule.name
break
diff --git a/luaentity.lua b/luaentity.lua
index 6e75eeb..fa4e0f2 100644
--- a/luaentity.lua
+++ b/luaentity.lua
@@ -9,16 +9,16 @@ local filename = minetest.get_worldpath().."/luaentities"
local function read_file()
local f = io.open(filename, "r")
if f == nil then return {} end
- local t = f:read("*all")
- f:close()
+ local t = f:read("*all")
+ f:close()
if t == "" or t == nil then return {} end
return minetest.deserialize(t) or {}
end
local function write_file(tbl)
local f = io.open(filename, "w")
- f:write(minetest.serialize(tbl))
- f:close()
+ f:write(minetest.serialize(tbl))
+ f:close()
end
local function read_entities()
@@ -36,7 +36,7 @@ local function read_entities()
y=math.min(30927,y)
z=math.min(30927,z)
- entity.start_pos.x = x
+ entity.start_pos.x = x
entity.start_pos.y = y
entity.start_pos.z = z
@@ -211,7 +211,7 @@ local entitydef_default = {
end
end,
get_velocity = function(self)
- return vector.new(self._velocity)
+ return vector.new(self._velocity)
end,
set_velocity = function(self, velocity)
self._velocity = vector.new(velocity)
@@ -289,7 +289,7 @@ function luaentity.add_entity(pos, name)
_acceleration = {x = 0, y = 0, z = 0},
_attached_entities = {},
}
-
+
local prototype = luaentity.registered_entities[name]
setmetatable(entity, prototype) -- Default to prototype for other methods
luaentity.entities[index] = entity
@@ -318,7 +318,7 @@ end
function luaentity.get_objects_inside_radius(pos, radius)
local objects = {}
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
objects[index] = entity
index = index + 1
@@ -330,7 +330,7 @@ local move_entities_globalstep_part2 = function(dtime)
if not luaentity.entities then
luaentity.entities = read_entities()
end
- for id, entity in pairs(luaentity.entities) do
+ for _, entity in pairs(luaentity.entities) do
local master = entity._attached_entities_master
local master_def = master and entity._attached_entities[master]
local master_entity = master_def and master_def.entity
diff --git a/pressure_logic/abms.lua b/pressure_logic/abms.lua
index 47e8949..b69fa60 100644
--- a/pressure_logic/abms.lua
+++ b/pressure_logic/abms.lua
@@ -39,7 +39,7 @@ end
local check_for_liquids_v2 = function(pos, limit)
local coords = make_coords_offsets(pos, false)
local total = 0
- for index, tpos in ipairs(coords) do
+ for _, tpos in ipairs(coords) do
if total >= limit then break end
local name = minetest.get_node(tpos).name
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.
local connections = {}
- for index, offset in ipairs(candidates) do
+ for _, offset in ipairs(candidates) do
local npos = vector.add(pos, offset)
local neighbour = minetest.get_node(npos)
local nodename = neighbour.name
@@ -317,7 +317,7 @@ flowlogic.run_transition = function(node, currentpressure)
local nodename_prev = simplesetdef[1].nodename
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.
local threshold = element.threshold
if threshold > currentpressure then
diff --git a/pressure_logic/flowable_node_registry_install.lua b/pressure_logic/flowable_node_registry_install.lua
index 7f671a8..b561ca6 100644
--- a/pressure_logic/flowable_node_registry_install.lua
+++ b/pressure_logic/flowable_node_registry_install.lua
@@ -106,7 +106,7 @@ register.directional_horizonal_rotate = function(nodename, doubleended)
end
local directionfn = function(node, direction)
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
end
return result
diff --git a/teleport_tube.lua b/teleport_tube.lua
index 0e4f53c..0883c62 100644
--- a/teleport_tube.lua
+++ b/teleport_tube.lua
@@ -23,7 +23,7 @@ end
local function migrate_tube_db()
local tmp_db = {}
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
tmp_db[hash(val)] = val
end
@@ -193,7 +193,7 @@ pipeworks.register_tube("pipeworks:teleport_tube", {
minetest.chat_send_player(sender_name, S("Sorry, channel '@1' is reserved for exclusive use by @2",
new_channel, name))
return
-
+
--channels starting with '[name];' can be used by other players, but cannot be received from
elseif mode == ";" and (fields.cr1 or (can_receive ~= 0 and not fields.cr0)) then
minetest.chat_send_player(sender_name, S("Sorry, receiving from channel '@1' is reserved for @2",
diff --git a/trashcan.lua b/trashcan.lua
index fb9a788..20f3fb4 100644
--- a/trashcan.lua
+++ b/trashcan.lua
@@ -1,7 +1,7 @@
local S = minetest.get_translator("pipeworks")
minetest.register_node("pipeworks:trashcan", {
- description = S("Trash Can"),
- drawtype = "normal",
+ description = S("Trash Can"),
+ drawtype = "normal",
tiles = {
"pipeworks_trashcan_bottom.png",
"pipeworks_trashcan_bottom.png",
@@ -9,15 +9,15 @@ minetest.register_node("pipeworks:trashcan", {
"pipeworks_trashcan_side.png",
"pipeworks_trashcan_side.png",
"pipeworks_trashcan_side.png",
- },
- groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
+ },
+ groups = {snappy = 3, tubedevice = 1, tubedevice_receiver = 1},
tube = {
insert_object = function(pos, node, stack, direction)
return ItemStack("")
end,
connect_sides = {left = 1, right = 1, front = 1, back = 1, top = 1, bottom = 1},
priority = 1, -- Lower than anything else
- },
+ },
on_construct = function(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
@@ -33,7 +33,7 @@ minetest.register_node("pipeworks:trashcan", {
"listring[]")
meta:set_string("infotext", S("Trash Can"))
meta:get_inventory():set_size("trash", 1)
- end,
+ end,
after_place_node = pipeworks.after_place,
after_dig_node = pipeworks.after_dig,
on_metadata_inventory_put = function(pos, listname, index, stack, player)