luacheck activation + a couple of fixes
This commit is contained in:
parent
6b28fdd04c
commit
f2c15725a1
19
.luacheckrc
Normal file
19
.luacheckrc
Normal file
@ -0,0 +1,19 @@
|
||||
unused_args = false
|
||||
allow_defined_top = true
|
||||
|
||||
globals = {
|
||||
"minetest",
|
||||
"core"
|
||||
}
|
||||
|
||||
read_globals = {
|
||||
string = {fields = {"split"}},
|
||||
table = {fields = {"copy", "getn"}},
|
||||
|
||||
-- Builtin
|
||||
"vector", "ItemStack",
|
||||
"dump", "DIR_DELIM", "VoxelArea", "Settings",
|
||||
|
||||
-- MTG
|
||||
"default", "sfinv", "creative",
|
||||
}
|
13
init.lua
13
init.lua
@ -155,7 +155,7 @@ local get_and_set_initial_slots = function(storage, mode_value, key, default_val
|
||||
if not result then
|
||||
core.settings:set(key, current)
|
||||
else
|
||||
result = math.floor(result)
|
||||
current = math.floor(result) -- fix result to current
|
||||
end
|
||||
|
||||
elseif mode_value == MODES.world then
|
||||
@ -266,7 +266,7 @@ hb.slots.set = function(name, slots)
|
||||
end
|
||||
|
||||
show_info = function(arg)
|
||||
normalize = function(request)
|
||||
local normalize = function(request)
|
||||
local rc = {mode = true, slots = true, version = true}
|
||||
if type(request) ~= 'table' then
|
||||
return rc
|
||||
@ -381,7 +381,10 @@ hb.mode.command = function(name, mode)
|
||||
core.settings:set(hb.mode.key, mode)
|
||||
end
|
||||
hb.mode.current = mode
|
||||
hb.slots.current = get_and_set_initial_slots(MOD_STORAGE, hb.mode.current, hb.slots.key, DEFAULT.slots[hb.mode.current])
|
||||
hb.slots.current = get_and_set_initial_slots(MOD_STORAGE,
|
||||
hb.mode.current,
|
||||
hb.slots.key,
|
||||
DEFAULT.slots[hb.mode.current])
|
||||
hb.slots.set(name, hb.slots.current)
|
||||
core.log("warning", "[MOD] hotbar v" .. VERSION .. ": " .. message)
|
||||
core.chat_send_player(name, message)
|
||||
@ -417,5 +420,7 @@ minetest.register_chatcommand("hotbar", {
|
||||
-- privs = {interact = true},
|
||||
-- })
|
||||
|
||||
core.log("action", "[MOD] hotbar v" .. VERSION .. " operating in " .. hb.mode.current .. " mode. Slots number is set to " .. hb.slots.current .. ".")
|
||||
core.log("action",
|
||||
"[MOD] hotbar v" .. VERSION .. " operating in " .. hb.mode.current ..
|
||||
" mode. Slots number is set to " .. hb.slots.current .. ".")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user