diff options
author | cheapie <no-email-for-you@example.com> | 2024-09-14 17:12:48 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-09-14 17:12:48 -0500 |
commit | d03d15d798dea924c911b198ef715ab7a3c22602 (patch) | |
tree | 0f50061a5e58656ab9d96d65aed31bb18850218b | |
parent | 468ff25e42e308c327a5174ef192bccc10dbb22b (diff) | |
download | elevatorparts-d03d15d798dea924c911b198ef715ab7a3c22602.tar elevatorparts-d03d15d798dea924c911b198ef715ab7a3c22602.tar.gz elevatorparts-d03d15d798dea924c911b198ef715ab7a3c22602.tar.bz2 elevatorparts-d03d15d798dea924c911b198ef715ab7a3c22602.tar.xz elevatorparts-d03d15d798dea924c911b198ef715ab7a3c22602.zip |
Add luacheck configuration and some minor cleanup
-rw-r--r-- | .luacheckrc | 8 | ||||
-rw-r--r-- | init.lua | 75 |
2 files changed, 53 insertions, 30 deletions
diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..d27d3f4 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,8 @@ +max_line_length = 160 + +read_globals = { + "minetest", + "vector", + "digilines", + "digistuff", +} @@ -1,3 +1,8 @@ +local upbuttontex = "[combine:64x64".. + ":0,0=elevatorparts_generic_bg.png".. + ":22,24=elevatorparts_callbutton_bg.png".. + ":24,35=elevatorparts_callbutton_up.png" + minetest.register_node("elevatorparts:callbutton_up",{ description = "Up Call Button (unprogrammed)", groups = { @@ -9,7 +14,7 @@ minetest.register_node("elevatorparts:callbutton_up",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png", + upbuttontex, }, paramtype = "light", paramtype2 = "facedir", @@ -62,7 +67,7 @@ minetest.register_node("elevatorparts:callbutton_up_off",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png", + upbuttontex, }, drop = "elevatorparts:callbutton_up", paramtype = "light", @@ -78,10 +83,10 @@ minetest.register_node("elevatorparts:callbutton_up_off",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, digiline = { receptor = {}, @@ -112,7 +117,7 @@ minetest.register_node("elevatorparts:callbutton_up_on",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_up.png:33,36=elevatorparts_callbutton_light.png", + upbuttontex..":33,36=elevatorparts_callbutton_light.png", }, drop = "elevatorparts:callbutton_up", paramtype = "light", @@ -128,10 +133,10 @@ minetest.register_node("elevatorparts:callbutton_up_on",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, digiline = { receptor = {}, @@ -150,6 +155,11 @@ minetest.register_node("elevatorparts:callbutton_up_on",{ _digistuff_channelcopier_fieldname = "channel", }) +local downbuttontex = "[combine:64x64".. + ":0,0=elevatorparts_generic_bg.png".. + ":22,24=elevatorparts_callbutton_bg.png".. + ":24,35=elevatorparts_callbutton_down.png" + minetest.register_node("elevatorparts:callbutton_down",{ description = "Down Call Button (unprogrammed)", groups = { @@ -161,7 +171,7 @@ minetest.register_node("elevatorparts:callbutton_down",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png", + downbuttontex, }, paramtype = "light", paramtype2 = "facedir", @@ -214,7 +224,7 @@ minetest.register_node("elevatorparts:callbutton_down_off",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png", + downbuttontex, }, drop = "elevatorparts:callbutton_down", paramtype = "light", @@ -230,10 +240,10 @@ minetest.register_node("elevatorparts:callbutton_down_off",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -264,7 +274,7 @@ minetest.register_node("elevatorparts:callbutton_down_on",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,35=elevatorparts_callbutton_down.png:33,36=elevatorparts_callbutton_light.png", + downbuttontex..":33,36=elevatorparts_callbutton_light.png", }, drop = "elevatorparts:callbutton_down", paramtype = "light", @@ -280,10 +290,10 @@ minetest.register_node("elevatorparts:callbutton_down_on",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -302,6 +312,12 @@ minetest.register_node("elevatorparts:callbutton_down_on",{ _digistuff_channelcopier_fieldname = "channel", }) +local bothbuttontex = "[combine:64x64".. + ":0,0=elevatorparts_generic_bg.png".. + ":22,24=elevatorparts_callbutton_bg.png".. + ":24,28=elevatorparts_callbutton_up.png".. + ":24,43=elevatorparts_callbutton_down.png" + minetest.register_node("elevatorparts:callbutton_both",{ description = "Up and Down Call Buttons (unprogrammed)", groups = { @@ -313,7 +329,7 @@ minetest.register_node("elevatorparts:callbutton_both",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png", + bothbuttontex, }, paramtype = "light", paramtype2 = "facedir", @@ -367,7 +383,7 @@ minetest.register_node("elevatorparts:callbutton_both_off",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png", + bothbuttontex, }, drop = "elevatorparts:callbutton_both", paramtype = "light", @@ -383,10 +399,10 @@ minetest.register_node("elevatorparts:callbutton_both_off",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -420,7 +436,7 @@ minetest.register_node("elevatorparts:callbutton_both_upon",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,29=elevatorparts_callbutton_light.png", + bothbuttontex..":33,29=elevatorparts_callbutton_light.png", }, drop = "elevatorparts:callbutton_both", paramtype = "light", @@ -436,10 +452,10 @@ minetest.register_node("elevatorparts:callbutton_both_upon",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -473,7 +489,7 @@ minetest.register_node("elevatorparts:callbutton_both_downon",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,44=elevatorparts_callbutton_light.png", + bothbuttontex..":33,44=elevatorparts_callbutton_light.png", }, drop = "elevatorparts:callbutton_both", paramtype = "light", @@ -489,10 +505,10 @@ minetest.register_node("elevatorparts:callbutton_both_downon",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -526,7 +542,7 @@ minetest.register_node("elevatorparts:callbutton_both_on",{ "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", "elevatorparts_generic_bg.png", - "[combine:64x64:0,0=elevatorparts_generic_bg.png:22,24=elevatorparts_callbutton_bg.png:24,28=elevatorparts_callbutton_up.png:24,43=elevatorparts_callbutton_down.png:33,29=elevatorparts_callbutton_light.png:33,44=elevatorparts_callbutton_light.png", + bothbuttontex..":33,29=elevatorparts_callbutton_light.png:33,44=elevatorparts_callbutton_light.png", }, drop = "elevatorparts:callbutton_both", paramtype = "light", @@ -542,10 +558,10 @@ minetest.register_node("elevatorparts:callbutton_both_on",{ }, }, on_punch = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"up_press") end, on_rightclick = function(pos) - digiline:receptor_send(pos,digiline.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") + digilines.receptor_send(pos,digilines.rules.default,minetest.get_meta(pos):get_string("channel"),"down_press") end, digiline = { receptor = {}, @@ -637,7 +653,6 @@ local function updateDisplay(pos) local meta = minetest.get_meta(pos) local text = meta:get_string("text") local entity = minetest.add_entity(pos,"elevatorparts:pi_entity") - local nname = minetest.get_node(pos).name local fdir = minetest.facedir_to_dir(minetest.get_node(pos).param2) local uparrow = meta:get_int("uparrow") > 0 local downarrow = meta:get_int("downarrow") > 0 @@ -1395,8 +1410,8 @@ minetest.register_craft({ }, }) -if minetest.get_modpath("digistuff") then - for _,filename in ipairs(minetest.get_dir_list(minetest.get_modpath("elevatorparts")..DIR_DELIM.."sounds",false)) do +if minetest.global_exists("digistuff") and type(digistuff.register_nb_sound) == "function" then + for _,filename in ipairs(minetest.get_dir_list(minetest.get_modpath("elevatorparts").."/sounds",false)) do local name = string.sub(filename,1,-5) digistuff.register_nb_sound(name,name) end |