mirror of
https://gitlab.com/rubenwardy/awards.git
synced 2024-11-22 07:13:49 +01:00
Add luacheck
This commit is contained in:
parent
81aa0f1c82
commit
2c4da0b88a
14
.luacheckrc
Normal file
14
.luacheckrc
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
unused_args = false
|
||||||
|
allow_defined_top = true
|
||||||
|
|
||||||
|
globals = {
|
||||||
|
"minetest", "awards",
|
||||||
|
}
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
string = {fields = {"split"}},
|
||||||
|
table = {fields = {"copy", "getn"}},
|
||||||
|
"vector", "default", "ItemStack",
|
||||||
|
"dump", "sfinv", "intllib",
|
||||||
|
"unified_inventory",
|
||||||
|
}
|
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
language: generic
|
||||||
|
sudo: false
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- luarocks
|
||||||
|
before_install:
|
||||||
|
- luarocks install --local luacheck
|
||||||
|
script:
|
||||||
|
- $HOME/.luarocks/bin/luacheck --no-color .
|
||||||
|
notifications:
|
||||||
|
email: false
|
6
api.lua
6
api.lua
@ -46,8 +46,8 @@ function awards.load()
|
|||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function awards.register_trigger(name, func)
|
function awards.register_trigger(name, tfunc)
|
||||||
awards.trigger_types[name] = func
|
awards.trigger_types[name] = tfunc
|
||||||
awards.on[name] = {}
|
awards.on[name] = {}
|
||||||
awards['register_on_'..name] = function(func)
|
awards['register_on_'..name] = function(func)
|
||||||
table.insert(awards.on[name], func)
|
table.insert(awards.on[name], func)
|
||||||
@ -380,7 +380,7 @@ function awards.getFormspec(name, to, sid)
|
|||||||
formspec = formspec .. "textarea[0.5,2.7;4.8,1.45;;" ..
|
formspec = formspec .. "textarea[0.5,2.7;4.8,1.45;;" ..
|
||||||
string.format(status, minetest.formspec_escape(title)) ..
|
string.format(status, minetest.formspec_escape(title)) ..
|
||||||
";]"
|
";]"
|
||||||
|
|
||||||
if def and def.icon then
|
if def and def.icon then
|
||||||
formspec = formspec .. "image[1,0;3,3;" .. def.icon .. "]"
|
formspec = formspec .. "image[1,0;3,3;" .. def.icon .. "]"
|
||||||
end
|
end
|
||||||
|
24
triggers.lua
24
triggers.lua
@ -233,9 +233,9 @@ minetest.register_on_dignode(function(pos, oldnode, digger)
|
|||||||
local tnodedug = string.split(entry.node, ":")
|
local tnodedug = string.split(entry.node, ":")
|
||||||
local tmod = tnodedug[1]
|
local tmod = tnodedug[1]
|
||||||
local titem = tnodedug[2]
|
local titem = tnodedug[2]
|
||||||
if not tmod or not titem or not data.count[tmod] or not data.count[tmod][titem] then
|
if not (not tmod or not titem or not data.count[tmod] or
|
||||||
-- table running failed!
|
not data.count[tmod][titem]) and
|
||||||
elseif data.count[tmod][titem] > entry.target-1 then
|
data.count[tmod][titem] > entry.target-1 then
|
||||||
return entry.award
|
return entry.award
|
||||||
end
|
end
|
||||||
elseif awards.get_total_item_count(data, "count") > entry.target-1 then
|
elseif awards.get_total_item_count(data, "count") > entry.target-1 then
|
||||||
@ -260,9 +260,9 @@ minetest.register_on_placenode(function(pos, node, digger)
|
|||||||
local tnodedug = string.split(entry.node, ":")
|
local tnodedug = string.split(entry.node, ":")
|
||||||
local tmod = tnodedug[1]
|
local tmod = tnodedug[1]
|
||||||
local titem = tnodedug[2]
|
local titem = tnodedug[2]
|
||||||
if not tmod or not titem or not data.place[tmod] or not data.place[tmod][titem] then
|
if not (not tmod or not titem or not data.place[tmod] or
|
||||||
-- table running failed!
|
not data.place[tmod][titem]) and
|
||||||
elseif data.place[tmod][titem] > entry.target-1 then
|
data.place[tmod][titem] > entry.target-1 then
|
||||||
return entry.award
|
return entry.award
|
||||||
end
|
end
|
||||||
elseif awards.get_total_item_count(data, "place") > entry.target-1 then
|
elseif awards.get_total_item_count(data, "place") > entry.target-1 then
|
||||||
@ -286,9 +286,9 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
|
|||||||
local titemstring = string.split(entry.item, ":")
|
local titemstring = string.split(entry.item, ":")
|
||||||
local tmod = titemstring[1]
|
local tmod = titemstring[1]
|
||||||
local titem = titemstring[2]
|
local titem = titemstring[2]
|
||||||
if not tmod or not titem or not data.eat[tmod] or not data.eat[tmod][titem] then
|
if not (not tmod or not titem or not data.eat[tmod] or
|
||||||
-- table running failed!
|
not data.eat[tmod][titem]) and
|
||||||
elseif data.eat[tmod][titem] > entry.target-1 then
|
data.eat[tmod][titem] > entry.target-1 then
|
||||||
return entry.award
|
return entry.award
|
||||||
end
|
end
|
||||||
elseif awards.get_total_item_count(data, "eat") > entry.target-1 then
|
elseif awards.get_total_item_count(data, "eat") > entry.target-1 then
|
||||||
@ -314,9 +314,9 @@ minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv
|
|||||||
local titemcrafted = string.split(entry.item, ":")
|
local titemcrafted = string.split(entry.item, ":")
|
||||||
local tmod = titemcrafted[1]
|
local tmod = titemcrafted[1]
|
||||||
local titem = titemcrafted[2]
|
local titem = titemcrafted[2]
|
||||||
if not tmod or not titem or not data.craft[tmod] or not data.craft[tmod][titem] then
|
if not (not tmod or not titem or not data.craft[tmod] or
|
||||||
-- table running failed!
|
not data.craft[tmod][titem]) and
|
||||||
elseif data.craft[tmod][titem] > entry.target-1 then
|
data.craft[tmod][titem] > entry.target-1 then
|
||||||
return entry.award
|
return entry.award
|
||||||
end
|
end
|
||||||
elseif awards.get_total_item_count(data, "craft") > entry.target-1 then
|
elseif awards.get_total_item_count(data, "craft") > entry.target-1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user