diff options
-rw-r--r-- | .luacheckrc | 11 | ||||
-rw-r--r-- | firealarm_annunciator/depends.txt | 2 | ||||
-rw-r--r-- | firealarm_annunciator/init.lua | 61 | ||||
-rw-r--r-- | firealarm_annunciator/mod.conf | 3 | ||||
-rw-r--r-- | firealarm_common/depends.txt | 0 | ||||
-rw-r--r-- | firealarm_common/init.lua | 6 | ||||
-rw-r--r-- | firealarm_common/mod.conf | 2 | ||||
-rw-r--r-- | firealarm_hornstrobe/depends.txt | 1 | ||||
-rw-r--r-- | firealarm_hornstrobe/init.lua | 9 | ||||
-rw-r--r-- | firealarm_hornstrobe/mod.conf | 3 | ||||
-rw-r--r-- | firealarm_meseconsio/depends.txt | 2 | ||||
-rw-r--r-- | firealarm_meseconsio/mod.conf | 3 | ||||
-rw-r--r-- | firealarm_panel/depends.txt | 1 | ||||
-rw-r--r-- | firealarm_panel/init.lua | 89 | ||||
-rw-r--r-- | firealarm_panel/mod.conf | 3 | ||||
-rw-r--r-- | firealarm_pullstation/depends.txt | 1 | ||||
-rw-r--r-- | firealarm_pullstation/init.lua | 5 | ||||
-rw-r--r-- | firealarm_pullstation/mod.conf | 3 | ||||
-rw-r--r-- | firealarm_smokedetector/depends.txt | 1 | ||||
-rw-r--r-- | firealarm_smokedetector/init.lua | 5 | ||||
-rw-r--r-- | firealarm_smokedetector/mod.conf | 3 |
21 files changed, 136 insertions, 78 deletions
diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..d8a8ea9 --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,11 @@ +max_line_length = 160 + +globals = { + "firealarm", +} + +read_globals = { + "minetest", + "vector", + "mesecon", +} diff --git a/firealarm_annunciator/depends.txt b/firealarm_annunciator/depends.txt deleted file mode 100644 index e8acc00..0000000 --- a/firealarm_annunciator/depends.txt +++ /dev/null @@ -1,2 +0,0 @@ -firealarm_common -firealarm_panel diff --git a/firealarm_annunciator/init.lua b/firealarm_annunciator/init.lua index 190b8d2..de43500 100644 --- a/firealarm_annunciator/init.lua +++ b/firealarm_annunciator/init.lua @@ -121,9 +121,11 @@ minetest.register_node(":firealarm:annunciator_alarm",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_alarm.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_panel_led_alarm.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -161,9 +163,11 @@ minetest.register_node(":firealarm:annunciator_supervisory",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_supervisory.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_panel_led_supervisory.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -201,9 +205,11 @@ minetest.register_node(":firealarm:annunciator_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_panel_led_trouble.png", + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, @@ -241,9 +247,12 @@ minetest.register_node(":firealarm:annunciator_alarm_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_alarm.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_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, @@ -281,9 +290,12 @@ minetest.register_node(":firealarm:annunciator_alarm_supervisory",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_alarm.png:0,64=firealarm_panel_led_supervisory.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_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, @@ -321,9 +333,12 @@ minetest.register_node(":firealarm:annunciator_supervisory_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_front_normal.png:0,64=firealarm_panel_led_supervisory.png:0,64=firealarm_panel_led_trouble.png", - animation = - { + name = "[combine:64x128".. + ":0,0=firealarm_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_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, @@ -361,9 +376,13 @@ minetest.register_node(":firealarm:annunciator_alarm_supervisory_trouble",{ "firealarm_panel_sides.png", "firealarm_panel_sides.png", { - name = "[combine:64x128:0,0=firealarm_annunciator_front_normal.png:0,64=firealarm_annunciator_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_annunciator_front_normal.png".. + ":0,64=firealarm_annunciator_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, diff --git a/firealarm_annunciator/mod.conf b/firealarm_annunciator/mod.conf new file mode 100644 index 0000000..9c9eb89 --- /dev/null +++ b/firealarm_annunciator/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_annunciator +depends = firealarm_common,firealarm_panel +description = Annunciator diff --git a/firealarm_common/depends.txt b/firealarm_common/depends.txt deleted file mode 100644 index e69de29..0000000 --- a/firealarm_common/depends.txt +++ /dev/null diff --git a/firealarm_common/init.lua b/firealarm_common/init.lua index b8806b3..622b2f2 100644 --- a/firealarm_common/init.lua +++ b/firealarm_common/init.lua @@ -12,10 +12,10 @@ function firealarm.loadNode(pos) end function firealarm.loadDevLists() - local path = minetest.get_worldpath()..DIR_DELIM.."firealarm_devices" + local path = minetest.get_worldpath().."/firealarm_devices" local file = io.open(path,"r") if not file then - minetest.log("error","Unable to open fire alarm devices table for reading. ".. + minetest.log("warning","Unable to open fire alarm devices table for reading. ".. "This is normal on the first start.") firealarm.saveDevLists() return @@ -32,7 +32,7 @@ function firealarm.loadDevLists() end function firealarm.saveDevLists() - local path = minetest.get_worldpath()..DIR_DELIM.."firealarm_devices" + local path = minetest.get_worldpath().."/firealarm_devices" local file = io.open(path,"w") if not file then minetest.log("error","Unable to open fire alarm devices table for writing") diff --git a/firealarm_common/mod.conf b/firealarm_common/mod.conf new file mode 100644 index 0000000..a9b3951 --- /dev/null +++ b/firealarm_common/mod.conf @@ -0,0 +1,2 @@ +name = firealarm_common +description = Base diff --git a/firealarm_hornstrobe/depends.txt b/firealarm_hornstrobe/depends.txt deleted file mode 100644 index d4798ab..0000000 --- a/firealarm_hornstrobe/depends.txt +++ /dev/null @@ -1 +0,0 @@ -firealarm_common diff --git a/firealarm_hornstrobe/init.lua b/firealarm_hornstrobe/init.lua index 750eca4..1ba635b 100644 --- a/firealarm_hornstrobe/init.lua +++ b/firealarm_hornstrobe/init.lua @@ -54,8 +54,7 @@ minetest.register_node(":firealarm:hornstrobe_on",{ "firealarm_hornstrobe_back.png", { name = hornstrobeOnFrontTexture, - animation = - { + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, @@ -133,8 +132,7 @@ minetest.register_node(":firealarm:remotestrobe_on",{ "firealarm_hornstrobe_back.png", { name = remoteStrobeOnFrontTexture, - animation = - { + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, @@ -204,8 +202,7 @@ minetest.register_node(":firealarm:hornstrobe_old_on",{ "firealarm_hornstrobe_back.png", { name = oldHornStrobeOnFrontTexture, - animation = - { + animation = { type = "vertical_frames", aspect_w = 64, aspect_h = 64, diff --git a/firealarm_hornstrobe/mod.conf b/firealarm_hornstrobe/mod.conf new file mode 100644 index 0000000..db548d6 --- /dev/null +++ b/firealarm_hornstrobe/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_hornstrobe +description = Horns/Strobes +depends = firealarm_common diff --git a/firealarm_meseconsio/depends.txt b/firealarm_meseconsio/depends.txt deleted file mode 100644 index 72bf846..0000000 --- a/firealarm_meseconsio/depends.txt +++ /dev/null @@ -1,2 +0,0 @@ -firealarm_common -mesecons diff --git a/firealarm_meseconsio/mod.conf b/firealarm_meseconsio/mod.conf new file mode 100644 index 0000000..a159048 --- /dev/null +++ b/firealarm_meseconsio/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_meseconsio +description = Mesecons I/O +depends = firealarm_common,mesecons 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 diff --git a/firealarm_pullstation/depends.txt b/firealarm_pullstation/depends.txt deleted file mode 100644 index d4798ab..0000000 --- a/firealarm_pullstation/depends.txt +++ /dev/null @@ -1 +0,0 @@ -firealarm_common diff --git a/firealarm_pullstation/init.lua b/firealarm_pullstation/init.lua index 88ad7ac..649554b 100644 --- a/firealarm_pullstation/init.lua +++ b/firealarm_pullstation/init.lua @@ -28,7 +28,10 @@ minetest.register_node(":firealarm:pullstation_off",{ minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z)) end, on_rightclick = function(pos,node,clicker) - if minetest.is_protected(pos,clicker:get_player_name()) and not minetest.check_player_privs(clicker,"protection_bypass") and not minetest.check_player_privs(clicker,"firealarm") then + if minetest.is_protected(pos,clicker:get_player_name()) + and not minetest.check_player_privs(clicker,"protection_bypass") + and not minetest.check_player_privs(clicker,"firealarm") + then minetest.record_protection_violation(pos,clicker:get_player_name()) return end diff --git a/firealarm_pullstation/mod.conf b/firealarm_pullstation/mod.conf new file mode 100644 index 0000000..e50ebef --- /dev/null +++ b/firealarm_pullstation/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_pullstation +depends = firealarm_common +description = Manual Pull Station diff --git a/firealarm_smokedetector/depends.txt b/firealarm_smokedetector/depends.txt deleted file mode 100644 index d4798ab..0000000 --- a/firealarm_smokedetector/depends.txt +++ /dev/null @@ -1 +0,0 @@ -firealarm_common diff --git a/firealarm_smokedetector/init.lua b/firealarm_smokedetector/init.lua index db9df1b..dc67a1b 100644 --- a/firealarm_smokedetector/init.lua +++ b/firealarm_smokedetector/init.lua @@ -17,8 +17,7 @@ minetest.register_node(":firealarm:smokedetector_off",{ "firealarm_smokedetector_sides.png", { name = smokeDetectorOffBottomTexture, - animation = - { + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, @@ -40,7 +39,7 @@ minetest.register_node(":firealarm:smokedetector_off",{ {-0.075,0.35,-0.075,0.075,0.4,0.075}, }, }, - on_punch = function(pos,node,player) + on_punch = function(pos,_,player) local name = player:get_player_name() minetest.chat_send_player(name,string.format("Position: %d,%d,%d",pos.x,pos.y,pos.z)) end, diff --git a/firealarm_smokedetector/mod.conf b/firealarm_smokedetector/mod.conf new file mode 100644 index 0000000..88704a0 --- /dev/null +++ b/firealarm_smokedetector/mod.conf @@ -0,0 +1,3 @@ +name = firealarm_smokedetector +depends = firealarm_common +description = Smoke Detector |