Change code so that no luacheck warnings are issued
This commit is contained in:
parent
cff00b97fb
commit
b6473faed3
28
.luacheckrc
Normal file
28
.luacheckrc
Normal file
@ -0,0 +1,28 @@
|
||||
unused_args = false
|
||||
|
||||
ignore = {
|
||||
"131", -- Unused global variable
|
||||
"432", -- Shadowing an upvalue argument
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
"core",
|
||||
"minetest",
|
||||
"default",
|
||||
"worldedit",
|
||||
"tubelib2",
|
||||
"intllib",
|
||||
"DIR_DELIM",
|
||||
"techage",
|
||||
|
||||
string = {fields = {"split", "trim"}},
|
||||
vector = {fields = {"add", "equals", "multiply"}},
|
||||
table = {fields = {"copy", ""}},
|
||||
}
|
||||
|
||||
globals = {
|
||||
"hyperloop",
|
||||
"ItemStack",
|
||||
"screwdriver",
|
||||
}
|
||||
|
@ -13,11 +13,11 @@
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local P = minetest.string_to_pos
|
||||
--local M = minetest.get_meta
|
||||
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
--local NS = hyperloop.NS
|
||||
|
||||
local tBlockingTime = {}
|
||||
local tBookings = {} -- open bookings: tBookings[SP(departure_pos)] = arrival_pos
|
||||
|
@ -18,7 +18,6 @@ local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
-- Used to store the Station list for each booking machine:
|
||||
-- tStationList[SP(pos)] = {pos1, pos2, ...}
|
||||
@ -95,7 +94,6 @@ end
|
||||
-- Used to update the station list for booking machine
|
||||
-- and teleport list.
|
||||
local function station_list_as_string(pos, subnet)
|
||||
local meta = M(pos)
|
||||
-- Generate a name sorted list of all connected stations
|
||||
local sortedList = Stations:station_list(pos, pos, "name")
|
||||
-- remove all junctions from the list
|
||||
@ -108,7 +106,7 @@ local function station_list_as_string(pos, subnet)
|
||||
return generate_string(sortedList)
|
||||
end
|
||||
|
||||
local naming_formspec = nil
|
||||
local naming_formspec
|
||||
|
||||
if hyperloop.subnet_enabled then
|
||||
naming_formspec = function(pos)
|
||||
|
@ -12,30 +12,12 @@
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local P = minetest.string_to_pos
|
||||
--local M = minetest.get_meta
|
||||
|
||||
hyperloop.Stations = hyperloop.Network:new()
|
||||
hyperloop.Elevators = hyperloop.Network:new()
|
||||
|
||||
|
||||
-- Check all nodes on the map and delete useless data base entries
|
||||
local function check_data_base()
|
||||
-- used for VM get_node
|
||||
local tube = tubelib2.Tube:new({})
|
||||
|
||||
hyperloop.Stations:filter(function(pos)
|
||||
local _,node = tube:get_node(pos)
|
||||
return node.name == "hyperloop:station" or node.name == "hyperloop:junction"
|
||||
end)
|
||||
|
||||
hyperloop.Elevators:filter(function(pos)
|
||||
local _,node = tube:get_node(pos)
|
||||
return node.name == "hyperloop:elevator_bottom"
|
||||
end)
|
||||
end
|
||||
|
||||
local storage = minetest.get_mod_storage()
|
||||
hyperloop.Stations:deserialize(storage:get_string("Stations"))
|
||||
hyperloop.Elevators:deserialize(storage:get_string("Elevators"))
|
||||
|
3
deco.lua
3
deco.lua
@ -15,13 +15,12 @@
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local tilesL = {"hyperloop_alpsL.png", "hyperloop_seaL.png", "hyperloop_agyptL.png"}
|
||||
local tilesR = {"hyperloop_alpsR.png", "hyperloop_seaR.png", "hyperloop_agyptR.png"}
|
||||
|
||||
-- determine facedir and pos on the right hand side from the given pos
|
||||
function right_hand_side(pos, placer)
|
||||
local function right_hand_side(pos, placer)
|
||||
local facedir = hyperloop.get_facedir(placer)
|
||||
pos = hyperloop.new_pos(pos, facedir, "1R", 0)
|
||||
return facedir,pos
|
||||
|
6
door.lua
6
door.lua
@ -11,13 +11,12 @@
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
--local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
--local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
--- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
-- Open the door for an emergency
|
||||
local function door_on_punch(pos, node, puncher, pointed_thing)
|
||||
@ -40,7 +39,6 @@ local function door_command(door_pos1, facedir, cmnd)
|
||||
|
||||
local node1 = minetest.get_node(door_pos1)
|
||||
local node2 = minetest.get_node(door_pos2)
|
||||
local meta = minetest.get_meta(door_pos1)
|
||||
if cmnd == "open" then
|
||||
minetest.sound_play("door", {
|
||||
pos = door_pos1,
|
||||
|
@ -17,7 +17,6 @@ local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
-- To store elevator floors and formspecs
|
||||
local Cache = {}
|
||||
@ -65,8 +64,8 @@ Shaft:register_on_tube_update(function(node, pos, out_dir, peer_pos, peer_in_dir
|
||||
-- switch to elevator_bottom node
|
||||
pos = Shaft:get_pos(pos, 5)
|
||||
elseif peer_pos then
|
||||
local _,node = Shaft:get_node(peer_pos)
|
||||
if node.name == "hyperloop:elevator_top" then
|
||||
local _,node1 = Shaft:get_node(peer_pos)
|
||||
if node1.name == "hyperloop:elevator_top" then
|
||||
peer_pos = Shaft:get_pos(peer_pos, 5)
|
||||
end
|
||||
end
|
||||
@ -463,11 +462,11 @@ minetest.register_node("hyperloop:elevator_bottom", {
|
||||
|
||||
-- formspec
|
||||
local meta = minetest.get_meta(pos)
|
||||
local formspec = "size[6,4]"..
|
||||
local fs = "size[6,4]"..
|
||||
"label[0,0;"..S("Please insert floor name").."]" ..
|
||||
"field[0.5,1.5;5,1;floor;"..S("Floor name")..";"..S("Base").."]" ..
|
||||
"button_exit[2,3;2,1;exit;"..S("Save").."]"
|
||||
meta:set_string("formspec", formspec)
|
||||
meta:set_string("formspec", fs)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
|
||||
-- add upper part of the car
|
||||
|
@ -11,13 +11,12 @@
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
--local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
--local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local Tube = hyperloop.Tube
|
||||
local Stations = hyperloop.Stations
|
||||
|
2
lcd.lua
2
lcd.lua
@ -12,8 +12,6 @@
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
|
||||
-- load characters map
|
||||
local chars_file = io.open(minetest.get_modpath("hyperloop").."/characters.data", "r")
|
||||
|
5
map.lua
5
map.lua
@ -12,12 +12,11 @@
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local P = minetest.string_to_pos
|
||||
--local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local Stations = hyperloop.Stations
|
||||
|
||||
|
15
migrate.lua
15
migrate.lua
@ -22,7 +22,6 @@ local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local Tube = hyperloop.Tube
|
||||
local Shaft = hyperloop.Shaft
|
||||
@ -126,7 +125,7 @@ local function convert_legary_nodes(self, pos, dir)
|
||||
end
|
||||
|
||||
local function convert_line(self, pos, dir)
|
||||
local fpos,fdir = convert_legary_nodes(self, pos, dir)
|
||||
convert_legary_nodes(self, pos, dir)
|
||||
self:tool_repair_tube(pos)
|
||||
end
|
||||
|
||||
@ -139,8 +138,8 @@ local function set_pairing(pos, peer_pos)
|
||||
M(pos):set_int("tube_dir", Tube:get_primary_dir(pos))
|
||||
M(peer_pos):set_int("tube_dir", Tube:get_primary_dir(peer_pos))
|
||||
|
||||
local tube_dir1 = Tube:store_teleport_data(pos, peer_pos)
|
||||
local tube_dir2 = Tube:store_teleport_data(peer_pos, pos)
|
||||
Tube:store_teleport_data(pos, peer_pos)
|
||||
Tube:store_teleport_data(peer_pos, pos)
|
||||
end
|
||||
|
||||
|
||||
@ -195,8 +194,8 @@ end
|
||||
|
||||
local function search_wifi_node(pos, dir)
|
||||
local convert_next_tube = function(pos, dir)
|
||||
local npos, node = Tube:get_node(pos, dir)
|
||||
local dir1, dir2, num = next_node_on_the_way_to_a_wifi_node(npos)
|
||||
local npos, _ = Tube:get_node(pos, dir)
|
||||
local dir1, dir2, _ = next_node_on_the_way_to_a_wifi_node(npos)
|
||||
if dir1 then
|
||||
if tubelib2.Turn180Deg[dir] == dir1 then
|
||||
return npos, dir2
|
||||
@ -220,7 +219,7 @@ end
|
||||
local function search_wifi_node_in_all_dirs(pos)
|
||||
-- check all positions
|
||||
for dir = 1, 6 do
|
||||
local npos, node = Tube:get_node(pos, dir)
|
||||
local _, node = Tube:get_node(pos, dir)
|
||||
if node and node.name == "hyperloop:tube1" then
|
||||
search_wifi_node(pos, dir)
|
||||
end
|
||||
@ -230,7 +229,7 @@ end
|
||||
local function convert_tube_line(pos)
|
||||
-- check all positions
|
||||
for dir = 1, 6 do
|
||||
local npos, node = Tube:get_node(pos, dir)
|
||||
local _, node = Tube:get_node(pos, dir)
|
||||
if node and node.name == "hyperloop:tube1" then
|
||||
convert_line(Tube, pos, dir)
|
||||
end
|
||||
|
@ -14,7 +14,7 @@
|
||||
-- for lazy programmers
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local M = minetest.get_meta
|
||||
|
||||
-- Convert to list and add pos based on key string
|
||||
local function table_to_list(table)
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
minetest.register_craftitem("hyperloop:hypersteel_ingot", {
|
||||
description = S("Hypersteel Ingot"),
|
||||
|
6
seat.lua
6
seat.lua
@ -11,16 +11,14 @@
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
--local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
--local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
local I, _ = dofile( minetest.get_modpath("hyperloop").."/intllib.lua")
|
||||
|
||||
local Stations = hyperloop.Stations
|
||||
local PlayerNameTags = {}
|
||||
|
||||
local function enter_display(tStation, text)
|
||||
|
@ -12,12 +12,11 @@
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
--local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local Tube = hyperloop.Tube
|
||||
local Stations = hyperloop.Stations
|
||||
@ -111,7 +110,7 @@ end
|
||||
|
||||
local function check_space(pos, facedir, placer)
|
||||
for _,item in ipairs(AssemblyPlan) do
|
||||
local y, path, node_name = item[1], item[2], item[4]
|
||||
local y, path, _ = item[1], item[2], item[4]
|
||||
pos = hyperloop.new_pos(pos, facedir, path, y)
|
||||
if minetest.is_protected(pos, placer:get_player_name()) then
|
||||
hyperloop.chat(placer, S("Area is protected!"))
|
||||
@ -229,7 +228,7 @@ local function destroy_station(pos, player_name)
|
||||
-- remove nodes
|
||||
local _pos = table.copy(pos)
|
||||
for _,item in ipairs(AssemblyPlan) do
|
||||
local y, path, node_name = item[1], item[2], item[4]
|
||||
local y, path, _ = item[1], item[2], item[4]
|
||||
_pos = hyperloop.new_pos(_pos, station.facedir, path, y)
|
||||
minetest.remove_node(_pos)
|
||||
end
|
||||
|
18
tube.lua
18
tube.lua
@ -11,27 +11,11 @@
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local function station_name(pos)
|
||||
local dataSet = hyperloop.get_station(pos)
|
||||
if dataSet then
|
||||
if dataSet.junction == true then
|
||||
return S("Junction at ")..SP(pos)
|
||||
elseif dataSet.name ~= nil then
|
||||
return S("Station '")..dataSet.name.."' at "..SP(pos)
|
||||
else
|
||||
return S("Station at ")..SP(pos)
|
||||
end
|
||||
end
|
||||
return S("Open end at ")..minetest.pos_to_string(pos)
|
||||
end
|
||||
|
||||
function hyperloop.check_network_level(pos, player)
|
||||
if hyperloop.free_tube_placement_enabled then
|
||||
|
@ -12,12 +12,11 @@
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
--local P = minetest.string_to_pos
|
||||
--local M = minetest.get_meta
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
local Shaft = hyperloop.Shaft
|
||||
local Tube = hyperloop.Tube
|
||||
@ -52,7 +51,7 @@ local function repair_tubes(itemstack, placer, pointed_thing)
|
||||
max_hear_distance=5,
|
||||
loop=false})
|
||||
else
|
||||
local dir1, dir2, fpos1, fpos2, fdir1, fdir2, cnt1, cnt2 =
|
||||
dir1, dir2, fpos1, fpos2, fdir1, fdir2, cnt1, cnt2 =
|
||||
Tube:tool_repair_tube(pos, placer, pointed_thing)
|
||||
if fpos1 and fpos2 then
|
||||
if cnt1 + cnt2 >= Shaft.max_tube_length then
|
||||
@ -100,10 +99,6 @@ local function remove_tube(itemstack, placer, pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
local function dump_data_base(pos)
|
||||
print(dump(hyperloop.tDatabase))
|
||||
end
|
||||
|
||||
-- Tool for tube workers to crack a protected tube line
|
||||
minetest.register_node("hyperloop:tube_crowbar", {
|
||||
description = S("Hyperloop Tube Crowbar"),
|
||||
|
@ -14,7 +14,7 @@
|
||||
local PI = 3.1415926
|
||||
|
||||
-- for lazy programmers
|
||||
local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
--local SP = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
|
||||
|
@ -17,7 +17,6 @@ local Waypoints = {}
|
||||
|
||||
-- Load support for intllib.
|
||||
local S = hyperloop.S
|
||||
local NS = hyperloop.NS
|
||||
|
||||
minetest.register_node("hyperloop:waypoint", {
|
||||
description = S("Hyperloop Waypoint"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user