summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2024-09-14 16:06:40 -0500
committercheapie <no-email-for-you@example.com>2024-09-14 16:06:40 -0500
commit3a9d53aec441f8f592af8e9946a9d1780ca8a89f (patch)
treed16f31f9266454a626c4670cf3c4e735b8c5d584
parent5733785f3f467b4e279296357e536e8fb267e228 (diff)
downloadmesecons_carts-3a9d53aec441f8f592af8e9946a9d1780ca8a89f.tar
mesecons_carts-3a9d53aec441f8f592af8e9946a9d1780ca8a89f.tar.gz
mesecons_carts-3a9d53aec441f8f592af8e9946a9d1780ca8a89f.tar.bz2
mesecons_carts-3a9d53aec441f8f592af8e9946a9d1780ca8a89f.tar.xz
mesecons_carts-3a9d53aec441f8f592af8e9946a9d1780ca8a89f.zip
Add luacheck configuration and some minor cleanupsHEADmaster
-rw-r--r--.luacheckrc9
-rw-r--r--init.lua46
2 files changed, 32 insertions, 23 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..9c01bd7
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,9 @@
+max_line_length = 160
+
+read_globals = {
+ "minetest",
+ "carts",
+ "mesecon",
+ "vector",
+ "digilines",
+}
diff --git a/init.lua b/init.lua
index fae5faf..b91ec71 100644
--- a/init.lua
+++ b/init.lua
@@ -61,7 +61,7 @@ carts:register_rail("mesecons_carts:power_rail_off", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_on = function(pos,node)
+ action_on = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:power_rail_on"})
end,
},
@@ -81,7 +81,7 @@ carts:register_rail("mesecons_carts:power_rail_on", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_off = function(pos,node)
+ action_off = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:power_rail_off"})
end,
},
@@ -100,7 +100,7 @@ carts:register_rail("mesecons_carts:power_rail_strong_off", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_on = function(pos,node)
+ action_on = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:power_rail_strong_on"})
end,
},
@@ -120,7 +120,7 @@ carts:register_rail("mesecons_carts:power_rail_strong_on", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_off = function(pos,node)
+ action_off = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:power_rail_strong_off"})
end,
},
@@ -139,7 +139,7 @@ carts:register_rail("mesecons_carts:brake_rail_off", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_on = function(pos,node)
+ action_on = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:brake_rail_on"})
end,
},
@@ -159,7 +159,7 @@ carts:register_rail("mesecons_carts:brake_rail_on", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_off = function(pos,node)
+ action_off = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:brake_rail_off"})
end,
},
@@ -178,7 +178,7 @@ carts:register_rail("mesecons_carts:brake_rail_strong_off", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_on = function(pos,node)
+ action_on = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:brake_rail_strong_on"})
end,
},
@@ -198,7 +198,7 @@ carts:register_rail("mesecons_carts:brake_rail_strong_on", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_off = function(pos,node)
+ action_off = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:brake_rail_strong_off"})
end,
},
@@ -318,7 +318,7 @@ carts:register_rail("mesecons_carts:startstop_rail_off", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_on = function(pos,node)
+ action_on = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:startstop_rail_on"})
restart_cart(pos)
end,
@@ -339,7 +339,7 @@ carts:register_rail("mesecons_carts:startstop_rail_on", {
mesecons = {
effector = {
rules = mesecons_rules,
- action_off = function(pos,node)
+ action_off = function(pos)
minetest.swap_node(pos,{name = "mesecons_carts:startstop_rail_off"})
end,
},
@@ -409,7 +409,7 @@ minetest.register_craft({
},
})
-if minetest.get_modpath("digilines") then
+if minetest.global_exists("digilines") then
local digilines_rules = {
{x = 1,y = 0,z = 0,},
{x = -1,y = 0,z = 0,},
@@ -426,7 +426,7 @@ if minetest.get_modpath("digilines") then
{x = 0,y = -1,z = 0,},
{x = 0,y = 1,z = 0,},
}
-
+
carts:register_rail("mesecons_carts:mese_digi_cond_rail_off", {
description = "Mesecons and Digilines Conducting Rail",
tiles = {
@@ -475,7 +475,7 @@ if minetest.get_modpath("digilines") then
},
},
}, {})
-
+
carts:register_rail("mesecons_carts:digi_cond_rail", {
description = "Digilines Conducting Rail",
tiles = {
@@ -491,8 +491,8 @@ if minetest.get_modpath("digilines") then
},
},
}, {})
-
- local function digilinesrail_onstep(cart,dtime)
+
+ local function digilinesrail_onstep(cart)
local cartpos = cart.object:get_pos()
local trackpos = {}
trackpos.x = math.floor(cartpos.x + 0.5)
@@ -506,10 +506,10 @@ if minetest.get_modpath("digilines") then
response.pos = {x = cartpos.x,y = cartpos.y,z = cartpos.z,}
response.velocity = {x = velocity.x,z = velocity.z,}
response.driver = cart.driver
- digiline:receptor_send(trackpos,digilines_rules,trackmeta:get_string("channel"),response)
+ digilines.receptor_send(trackpos,digilines_rules,trackmeta:get_string("channel"),response)
end
-
- local function digilinesrail_handle_digilines(pos,node,channel,msg)
+
+ local function digilinesrail_handle_digilines(pos,_,channel,msg)
local trackmeta = minetest.get_meta(pos)
if channel ~= trackmeta:get_string("channel") then return end
if msg == "grab" then
@@ -554,7 +554,7 @@ if minetest.get_modpath("digilines") then
end
end
end
-
+
carts:register_rail("mesecons_carts:digilines_rail_idle", {
description = "Digilines-Controlled Rail",
tiles = {
@@ -570,7 +570,7 @@ if minetest.get_modpath("digilines") then
meta:set_string("channel","")
meta:set_string("velocity",minetest.serialize(vector.new(0,0,0)))
end,
- on_receive_fields = function(pos, formname, fields, sender)
+ on_receive_fields = function(pos,_,fields,sender)
if not fields.channel then return end
local name = sender:get_player_name()
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
@@ -590,7 +590,7 @@ if minetest.get_modpath("digilines") then
},
groups = carts:get_rail_groups(),
}, {on_step = digilinesrail_onstep,})
-
+
for i=1,15,1 do
carts:register_rail("mesecons_carts:digilines_rail_pwr_"..i, {
description = string.format("Digilines-Controlled Rail (powered, strength %d - you hacker you!)",i),
@@ -608,7 +608,7 @@ if minetest.get_modpath("digilines") then
meta:set_string("channel","")
meta:set_string("velocity",minetest.serialize(vector.new(0,0,0)))
end,
- on_receive_fields = function(pos, formname, fields, sender)
+ on_receive_fields = function(pos,_,fields,sender)
if not fields.channel then return end
local name = sender:get_player_name()
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then
@@ -644,7 +644,7 @@ if minetest.get_modpath("digilines") then
meta:set_string("channel","")
meta:set_string("velocity",minetest.serialize(vector.new(0,0,0)))
end,
- on_receive_fields = function(pos, formname, fields, sender)
+ on_receive_fields = function(pos,_,fields,sender)
if not fields.channel then return end
local name = sender:get_player_name()
if minetest.is_protected(pos,name) and not minetest.check_player_privs(name,{protection_bypass=true}) then