mirror of
				https://github.com/minetest-mods/mesecons.git
				synced 2025-11-04 04:55:26 +01:00 
			
		
		
		
	add .luacheckrc and gh action
				
					
				
			This commit is contained in:
		
							
								
								
									
										17
									
								
								.github/workflows/luacheck.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								.github/workflows/luacheck.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
name: luacheck
 | 
			
		||||
 | 
			
		||||
on: [push, pull_request]
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - name: apt
 | 
			
		||||
      run: sudo apt-get install -y luarocks
 | 
			
		||||
    - name: luacheck install
 | 
			
		||||
      run: luarocks install --local luacheck
 | 
			
		||||
    - name: luacheck run
 | 
			
		||||
      run: $HOME/.luarocks/bin/luacheck ./
 | 
			
		||||
							
								
								
									
										30
									
								
								.luacheckrc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								.luacheckrc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
 | 
			
		||||
globals = {
 | 
			
		||||
	"mesecon",
 | 
			
		||||
	"minetest"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
-- ignore unused vars
 | 
			
		||||
unused = false
 | 
			
		||||
 | 
			
		||||
read_globals = {
 | 
			
		||||
	-- Stdlib
 | 
			
		||||
	string = {fields = {"split"}},
 | 
			
		||||
	table = {fields = {"copy", "getn"}},
 | 
			
		||||
 | 
			
		||||
	-- Minetest
 | 
			
		||||
	"vector", "ItemStack",
 | 
			
		||||
	"dump", "VoxelArea",
 | 
			
		||||
 | 
			
		||||
	-- system
 | 
			
		||||
	"DIR_DELIM",
 | 
			
		||||
 | 
			
		||||
	-- deps
 | 
			
		||||
	"default", "screwdriver"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ignore = {
 | 
			
		||||
	"631", -- line too long
 | 
			
		||||
	"621", -- inconsistent indendation
 | 
			
		||||
	"542", -- empty if branch
 | 
			
		||||
}
 | 
			
		||||
@@ -405,7 +405,7 @@ yc.command_print = function(params, eeprom, L)
 | 
			
		||||
		if param:sub(1,1) == '"' and param:sub(#param, #param) == '"' then
 | 
			
		||||
			s = s..param:sub(2, #param-1)
 | 
			
		||||
		else
 | 
			
		||||
			r = yc.command_parsecondition(param, L, eeprom)
 | 
			
		||||
			local r = yc.command_parsecondition(param, L, eeprom)
 | 
			
		||||
			if r == "1" or r == "0" then
 | 
			
		||||
				s = s..r
 | 
			
		||||
			else return nil end
 | 
			
		||||
@@ -543,12 +543,13 @@ yc.command_parsecondition = function(cond, L, eeprom)
 | 
			
		||||
	cond = string.gsub(cond, "!0", "1")
 | 
			
		||||
	cond = string.gsub(cond, "!1", "0")
 | 
			
		||||
 | 
			
		||||
	local i = 2
 | 
			
		||||
	local l = string.len(cond)
 | 
			
		||||
	i = 2
 | 
			
		||||
	l = string.len(cond)
 | 
			
		||||
	while i<=l do
 | 
			
		||||
		local s = cond:sub(i,i)
 | 
			
		||||
		local b = tonumber(cond:sub(i-1, i-1))
 | 
			
		||||
		local a = tonumber(cond:sub(i+1, i+1))
 | 
			
		||||
		local buf
 | 
			
		||||
		if cond:sub(i+1, i+1) == nil then break end
 | 
			
		||||
		if s == "=" then
 | 
			
		||||
			if a==nil then return nil end
 | 
			
		||||
@@ -562,8 +563,8 @@ yc.command_parsecondition = function(cond, L, eeprom)
 | 
			
		||||
		i = i + 1
 | 
			
		||||
	end
 | 
			
		||||
 | 
			
		||||
	local i = 2
 | 
			
		||||
	local l = string.len(cond)
 | 
			
		||||
	i = 2
 | 
			
		||||
	l = string.len(cond)
 | 
			
		||||
	while i<=l do
 | 
			
		||||
		local s = cond:sub(i,i)
 | 
			
		||||
		local b = tonumber(cond:sub(i-1, i-1))
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ local function get_pistonspec_name(name, part)
 | 
			
		||||
		return
 | 
			
		||||
	end
 | 
			
		||||
	for spec_name, spec in pairs(specs) do
 | 
			
		||||
		for part, value in pairs(spec)  do
 | 
			
		||||
		for _, value in pairs(spec)  do
 | 
			
		||||
			if name == value then
 | 
			
		||||
				return spec_name, part
 | 
			
		||||
			end
 | 
			
		||||
@@ -462,8 +462,8 @@ end
 | 
			
		||||
 | 
			
		||||
local function piston_get_stopper(node, dir, stack, stackid)
 | 
			
		||||
	local pistonspec = get_pistonspec(node.name, "onname")
 | 
			
		||||
	local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
 | 
			
		||||
	local pusherpos = vector.add(stack[stackid].pos, dir)
 | 
			
		||||
	local inverted_dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
 | 
			
		||||
	local pusherpos = vector.add(stack[stackid].pos, inverted_dir)
 | 
			
		||||
	local pushernode = minetest.get_node(pusherpos)
 | 
			
		||||
	if pistonspec.pusher == pushernode.name then
 | 
			
		||||
		for _, s in ipairs(stack) do
 | 
			
		||||
 
 | 
			
		||||
@@ -50,8 +50,8 @@ function mesecon.register_pressure_plate(basename, description, textures_off, te
 | 
			
		||||
	if not groups then
 | 
			
		||||
		groups = {}
 | 
			
		||||
	end
 | 
			
		||||
	local groups_off = table.copy(groups)
 | 
			
		||||
	local groups_on = table.copy(groups)
 | 
			
		||||
	groups_off = table.copy(groups)
 | 
			
		||||
	groups_on = table.copy(groups)
 | 
			
		||||
	groups_on.not_in_creative_inventory = 1
 | 
			
		||||
 | 
			
		||||
	mesecon.register_node(basename, {
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ minetest.register_node("mesecons_random:ghoststone_active", {
 | 
			
		||||
	}},
 | 
			
		||||
	on_construct = function(pos)
 | 
			
		||||
		-- remove shadow
 | 
			
		||||
		shadowpos = vector.add(pos, vector.new(0, 1, 0))
 | 
			
		||||
		local shadowpos = vector.add(pos, vector.new(0, 1, 0))
 | 
			
		||||
		if (minetest.get_node(shadowpos).name == "air") then
 | 
			
		||||
			minetest.dig_node(shadowpos)
 | 
			
		||||
		end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user