diff options
author | cheapie <no-email-for-you@example.com> | 2024-09-14 17:42:44 -0500 |
---|---|---|
committer | cheapie <no-email-for-you@example.com> | 2024-09-14 17:42:44 -0500 |
commit | 70ab3cd06da8e8211536963e08680b664965335a (patch) | |
tree | b0ccaee94b9397a2e3dd9baebc1972fbf8c66350 /firealarm_panel | |
parent | 4d417ddcb2be62e568ae3f11c58bcb156d5d6a35 (diff) | |
download | firealarm-70ab3cd06da8e8211536963e08680b664965335a.tar firealarm-70ab3cd06da8e8211536963e08680b664965335a.tar.gz firealarm-70ab3cd06da8e8211536963e08680b664965335a.tar.bz2 firealarm-70ab3cd06da8e8211536963e08680b664965335a.tar.xz firealarm-70ab3cd06da8e8211536963e08680b664965335a.zip |
Add luacheck configuration, migrate depends.txt to mod.conf, and some assorted cleanup
Diffstat (limited to 'firealarm_panel')
-rw-r--r-- | firealarm_panel/depends.txt | 1 | ||||
-rw-r--r-- | firealarm_panel/init.lua | 89 | ||||
-rw-r--r-- | firealarm_panel/mod.conf | 3 |
3 files changed, 56 insertions, 37 deletions
diff --git a/firealarm_panel/depends.txt b/firealarm_panel/depends.txt deleted file mode 100644 index d4798ab..0000000 --- a/firealarm_panel/depends.txt +++ /dev/null @@ -1 +0,0 @@ -firealarm_common diff --git a/firealarm_panel/init.lua b/firealarm_panel/init.lua index 44b3195..71c8bc6 100644 --- a/firealarm_panel/init.lua +++ b/firealarm_panel/init.lua @@ -102,7 +102,6 @@ end local function supervisory(pos,initiator) local devInfo = firealarm.getDevInfo("panel",pos) - local posHash = minetest.hash_node_position(pos) local initiatorHash = minetest.hash_node_position(initiator) for _,i in ipairs(devInfo.supervisory) do if i.initiator == initiatorHash then return end @@ -119,7 +118,6 @@ end local function trouble(pos,initiator) local devInfo = firealarm.getDevInfo("panel",pos) - local posHash = minetest.hash_node_position(pos) local initiatorHash = minetest.hash_node_position(initiator) for _,i in ipairs(devInfo.trouble) do if i.initiator == initiatorHash then return end @@ -204,7 +202,7 @@ local function handleFields(pos,_,fields,sender) local devParams = {} devParams.name = fields.name devInfo.associatedNotificationDevices[minetest.hash_node_position(targetPos)] = devParams - end + end else targetInfo = firealarm.getDevInfo("annunciator",targetPos) if targetInfo then @@ -218,7 +216,7 @@ local function handleFields(pos,_,fields,sender) devInfo.associatedAnnunciators = {} end devInfo.associatedAnnunciators[minetest.hash_node_position(targetPos)] = devParams - end + end else minetest.chat_send_player(name,"Not a valid fire alarm device") end @@ -291,16 +289,16 @@ minetest.register_node(":firealarm:panel",{ }, after_place_node = function(pos) firealarm.setDevInfo("panel",pos,{ - associatedSignalingDevices = {}, - associatedNotificationDevices = {}, - associatedAnnunciators = {}, - removeMenuDevList = {}, - alarm = {}, - supervisory = {}, - trouble = {}, - acked = false, - silenced = false, - screen = "main", + associatedSignalingDevices = {}, + associatedNotificationDevices = {}, + associatedAnnunciators = {}, + removeMenuDevList = {}, + alarm = {}, + supervisory = {}, + trouble = {}, + acked = false, + silenced = false, + screen = "main", }) setFormspec(pos) end, @@ -321,9 +319,11 @@ minetest.register_node(":firealarm:panel_alarm",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_alarm.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_alarm.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -357,9 +357,11 @@ minetest.register_node(":firealarm:panel_supervisory",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_supervisory.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_supervisory.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -393,9 +395,11 @@ minetest.register_node(":firealarm:panel_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_trouble.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -429,9 +433,12 @@ minetest.register_node(":firealarm:panel_alarm_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_alarm.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_alarm.png".. + ":0,64=firealarm_panel_led_trouble.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -465,9 +472,12 @@ minetest.register_node(":firealarm:panel_alarm_supervisory",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_alarm.png:0,64=firealarm_panel_led_supervisory.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_alarm.png".. + ":0,64=firealarm_panel_led_supervisory.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -501,9 +511,12 @@ minetest.register_node(":firealarm:panel_supervisory_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_supervisory.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_supervisory.png".. + ":0,64=firealarm_panel_led_trouble.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -537,9 +550,13 @@ minetest.register_node(":firealarm:panel_alarm_supervisory_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_panel_front_normal.png:0,64=firealarm_panel_front_normal.png:0,64=firealarm_panel_led_alarm.png:0,64=firealarm_panel_led_supervisory.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_front_normal.png".. + ":0,64=firealarm_panel_led_alarm.png".. + ":0,64=firealarm_panel_led_supervisory.png".. + ":0,64=firealarm_panel_led_trouble.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -594,7 +611,7 @@ function firealarm.panelABM(pos) end end end - for i,v in pairs(devInfo.associatedAnnunciators) do + for i in pairs(devInfo.associatedAnnunciators) do local dev = firealarm.getDevInfo("annunciator",minetest.get_position_from_hash(i)) if not dev then trouble(pos,minetest.get_position_from_hash(i)) diff --git a/firealarm_panel/mod.conf b/firealarm_panel/mod.conf new file mode 100644 index 0000000..af9efe7 --- /dev/null +++ b/firealarm_panel/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_panel +depends = firealarm_common +description = Panel |