From 07a87d8494d462934d67d773bb49cc55f34a83af Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 14 Sep 2024 15:14:04 -0500 Subject: Add luacheck configuration and some minor cleanups and fixes --- .luacheckrc | 6 ++++++ init.lua | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 .luacheckrc diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..faae6c7 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,6 @@ +max_line_length = 160 + +read_globals = { + "minetest", + "vector", +} diff --git a/init.lua b/init.lua index a978f36..a9f9336 100644 --- a/init.lua +++ b/init.lua @@ -89,7 +89,6 @@ minetest.register_node("handdryer:xa5",{ "handdryer_xa5_front.png", }, on_destruct = function(pos) - local posbelow = vector.add(pos,vector.new(0,-1,0)) local hash = minetest.hash_node_position(pos) local handle = sounds[hash] local meta = minetest.get_meta(pos) @@ -121,11 +120,10 @@ minetest.register_abm({ if handle then minetest.sound_stop(handle) end meta:set_int("running",1) minetest.sound_play("handdryer_xa5_start",{pos=pos,gain=0.75,max_hear_distance=20}) - minetest.after(2,function(pos,hash) - local meta = minetest.get_meta(pos) - if not meta:get_int("running") == 1 then return end + minetest.after(2,function() + if meta:get_int("running") ~= 1 then return end sounds[hash] = minetest.sound_play("handdryer_xa5_run",{pos=pos,gain=0.75,max_hear_distance=20,loop=true}) - end,pos,hash) + end) end else if handle then minetest.sound_stop(handle) end -- cgit v1.2.3