summaryrefslogtreecommitdiff
path: root/luaentity.lua
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 /luaentity.lua
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
Diffstat (limited to 'luaentity.lua')
-rw-r--r--luaentity.lua18
1 files changed, 9 insertions, 9 deletions
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