small code beautification

master
theFox6 2018-04-20 17:57:27 +02:00
parent 005723114b
commit 8b73066a97
6 changed files with 14 additions and 15 deletions

View File

@ -4,4 +4,6 @@ read_globals = {
"minetest",
"dump", "vector",
"VoxelManip", "VoxelArea",
"ItemStack", "default", "doors"
table = {"copy"}
}

View File

@ -9,4 +9,5 @@ before_install:
script:
- $HOME/.luarocks/bin/luacheck --no-color .
notifications:
email: false
email:
on_failure: change

View File

@ -23,7 +23,7 @@ minetest.register_tool("working_villages:commanding_sceptre", {
job.on_resume(luaentity)
luaentity:update_infotext()
else
minetest.log("warning","unknown pause state: "..self.pause)
minetest.log("warning","unknown pause state: "..luaentity.pause)
end
end

View File

@ -1,11 +1,11 @@
working_villages.register_job("working_villages:job_empty", {
description = "working_villages job : empty",
inventory_image = "default_paper.png",
on_start = function(self) end,
on_stop = function(self) end,
on_resume = function(self) end,
on_pause = function(self) end,
on_step = function(self, dtime) end,
on_start = function() end,
on_stop = function() end,
on_resume = function() end,
on_pause = function() end,
on_step = function() end,
})
-- only a recipe of the empty job is registered.

View File

@ -21,7 +21,7 @@ actions.WALK_TO_CLEAR = {to_state=function(self, path, destination,target)
end
local MAX_WALK_TIME = 800
local FIND_PATH_TIME_INTERVAL = 50
if self.time_counters[2] >= MAX_WALK_TIME then
if self.time_counters[2] >= MAX_WALK_TIME then
--print("time over: back to searching")
working_villages.func.get_back_to_searching(self)
return
@ -83,7 +83,7 @@ actions.CLEAR = {to_state=function(self)
self:set_animation(working_villages.animation_frames.MINE)
self:set_yaw_by_direction(vector.subtract(self.target, self.object:getpos()))
end,
func = function(self, dtime)
func = function(self)
if self.time_counters[1] >= 30 then
local destnode = minetest.get_node(self.target)
minetest.remove_node(self.target)

View File

@ -56,7 +56,7 @@ local function walkable(node)
end
end
local function check_clearance(cpos, x, z, height)
local function check_clearance(cpos, x, z, height) --TODO: this is unused
for i = 1, height do
local n_name = minetest.get_node({x = cpos.x + x, y = cpos.y + i, z = cpos.z + z}).name
local c_name = minetest.get_node({x = cpos.x, y = cpos.y + i, z = cpos.z}).name
@ -116,11 +116,7 @@ function working_villages.pathfinder.find_path(pos, endpos, entity)
local current_values
-- Get one index as reference from openSet
for i, v in pairs(openSet) do
current_index = i
current_values = v
break
end
current_index, current_values = pairs(openSet)(openSet)
-- Search for lowest fCost
for i, v in pairs(openSet) do