mirror of
https://cheapiesystems.com/git/mesecons_carts
synced 2025-01-04 11:47:36 +01:00
Add luacheck configuration and some minor cleanups
This commit is contained in:
parent
5733785f3f
commit
3a9d53aec4
9
.luacheckrc
Normal file
9
.luacheckrc
Normal file
@ -0,0 +1,9 @@
|
||||
max_line_length = 160
|
||||
|
||||
read_globals = {
|
||||
"minetest",
|
||||
"carts",
|
||||
"mesecon",
|
||||
"vector",
|
||||
"digilines",
|
||||
}
|
34
init.lua
34
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,},
|
||||
@ -492,7 +492,7 @@ 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
|
||||
@ -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
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user