summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua381
1 files changed, 381 insertions, 0 deletions
diff --git a/init.lua b/init.lua
new file mode 100644
index 0000000..5eff4cf
--- /dev/null
+++ b/init.lua
@@ -0,0 +1,381 @@
+if minetest.get_modpath("firealarm_common") then
+ error("firealarm_decoronly conflicts with firealarm. Only one of them may be installed at a time.")
+end
+
+minetest.register_node(":firealarm:annunciator",{
+ description = "Fire Alarm Annunciator",
+ groups = { oddly_breakable_by_hand = 1,firealarm_clearformspec = 1,},
+ tiles = {
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_annunciator_front_normal.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.2,0.13,0.4,0.2,0.34,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:annunciator_alarm","firealarm:annunciator")
+minetest.register_alias("firealarm:annunciator_trouble","firealarm:annunciator")
+minetest.register_alias("firealarm:annunciator_supervisory","firealarm:annunciator")
+
+minetest.register_node(":firealarm:hornstrobe_off",{
+ description = "Fire Alarm Horn/Strobe",
+ groups = { oddly_breakable_by_hand = 1 },
+ tiles = {
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_back.png",
+ "firealarm_hornstrobe_front_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.02,0.4,0.18,0.37,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:hornstrobe_on","firealarm:hornstrobe_off")
+
+minetest.register_node(":firealarm:remotestrobe_off",{
+ description = "Fire Alarm Remote Strobe",
+ groups = { oddly_breakable_by_hand = 1 },
+ tiles = {
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_back.png",
+ "firealarm_hornstrobe_remotestrobe_front_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.02,0.4,0.18,0.37,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:remotestrobe_on","firealarm:remotestrobe_off")
+
+minetest.register_node(":firealarm:hornstrobe_old_off",{
+ description = "Fire Alarm Horn/Light Plate",
+ groups = { oddly_breakable_by_hand = 1 },
+ tiles = {
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_top.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_side.png",
+ "firealarm_hornstrobe_back.png",
+ "firealarm_hornstrobe_old_front_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.02,0.4,0.18,0.37,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:hornstrobe_old_on","firealarm:hornstrobe_old_off")
+
+minetest.register_node(":firealarm:mesecons_input_off",{
+ description = "Fire Alarm Mesecons Input Module",
+ groups = { oddly_breakable_by_hand = 1,not_in_creative_inventory=1, },
+ drop = "",
+ tiles = {
+ "firealarm_meseconsio_input_off.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.4,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:mesecons_input_on","firealarm:mesecons_input_off")
+
+minetest.register_node(":firealarm:mesecons_output_off",{
+ description = "Fire Alarm Mesecons Output Module",
+ groups = { oddly_breakable_by_hand = 1,not_in_creative_inventory=1, },
+ drop = "",
+ tiles = {
+ "firealarm_meseconsio_output_off.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ "firealarm_meseconsio_sides.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,-0.5,0.5,-0.4,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:mesecons_output_on","firealarm:mesecons_output_off")
+
+minetest.register_node(":firealarm:panel",{
+ description = "Fire Alarm Panel",
+ groups = { oddly_breakable_by_hand = 1,firealarm_clearformspec = 1,},
+ tiles = {
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_sides.png",
+ "firealarm_panel_front_normal.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.5,-0.5,0.4,0.5,0.5,0.5},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:panel_alarm","firealarm:panel")
+minetest.register_alias("firealarm:panel_supervisory","firealarm:panel")
+minetest.register_alias("firealarm:panel_trouble","firealarm:panel")
+
+minetest.register_privilege("firealarm",{
+ description = "Can bypass area protection when pulling fire alarms",
+ give_to_singleplayer = true,
+})
+
+minetest.register_node(":firealarm:pullstation_off",{
+ description = "Fire Alarm Pull Station",
+ groups = { oddly_breakable_by_hand = 1 },
+ tiles = {
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_front_off.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.5,0.4,0.18,-0.11,0.5},
+ },
+ },
+ 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,
+ 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
+ minetest.record_protection_violation(pos,clicker:get_player_name())
+ return
+ end
+ node.name = "firealarm:pullstation_on"
+ minetest.set_node(pos,node)
+ minetest.sound_play("firealarm_pullstation_pull",{pos=pos})
+ end,
+})
+
+minetest.register_node(":firealarm:pullstation_on",{
+ drop = "firealarm:pullstation_off",
+ description = "Fire Alarm Pull Station (pulled state - you hacker you!)",
+ groups = { oddly_breakable_by_hand = 1,not_in_creative_inventory = 1 },
+ tiles = {
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_back.png",
+ "firealarm_pullstation_front_on.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.15,-0.5,0.4,0.18,-0.11,0.5},
+ },
+ },
+ 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,
+ on_rightclick = function(pos,node,clicker)
+ if minetest.is_protected(pos,clicker:get_player_name()) and not minetest.check_player_privs(clicker,"protection_bypass") then
+ minetest.record_protection_violation(pos,clicker:get_player_name())
+ minetest.chat_send_player(clicker:get_player_name(),"You are not authorized to reset this pull station")
+ return
+ end
+ node.name = "firealarm:pullstation_off"
+ minetest.set_node(pos,node)
+ minetest.sound_play("firealarm_pullstation_reset",{pos=pos})
+ end,
+})
+
+local smokeDetectorOffBottomTexture = "[combine:32x320"..
+ ":0,0=firealarm_smokedetector_bottom_on.png"..
+ ":0,32=firealarm_smokedetector_bottom_off.png"..
+ ":0,64=firealarm_smokedetector_bottom_off.png"..
+ ":0,96=firealarm_smokedetector_bottom_off.png"..
+ ":0,128=firealarm_smokedetector_bottom_off.png"..
+ ":0,160=firealarm_smokedetector_bottom_off.png"..
+ ":0,192=firealarm_smokedetector_bottom_off.png"..
+ ":0,224=firealarm_smokedetector_bottom_off.png"..
+ ":0,256=firealarm_smokedetector_bottom_off.png"..
+ ":0,288=firealarm_smokedetector_bottom_off.png"
+
+minetest.register_node(":firealarm:smokedetector_off",{
+ description = "Fire Alarm Smoke Detector",
+ groups = { oddly_breakable_by_hand = 1 },
+ tiles = {
+ "firealarm_smokedetector_sides.png",
+ {
+ name = smokeDetectorOffBottomTexture,
+ animation =
+ {
+ type = "vertical_frames",
+ aspect_w = 32,
+ aspect_h = 32,
+ length = 5,
+ },
+ },
+ "firealarm_smokedetector_sides.png",
+ "firealarm_smokedetector_sides.png",
+ "firealarm_smokedetector_sides.png",
+ "firealarm_smokedetector_sides.png",
+ },
+ paramtype = "light",
+ paramtype2 = "facedir",
+ drawtype = "nodebox",
+ node_box = {
+ type = "fixed",
+ fixed = {
+ {-0.2,0.4,-0.2,0.2,0.5,0.2},
+ {-0.075,0.35,-0.075,0.075,0.4,0.075},
+ },
+ },
+})
+
+minetest.register_alias("firealarm:smokedetector_on","firealarm:smokedetector_off")
+
+minetest.register_craft({
+ output = "firealarm:annunciator",
+ recipe = {
+ {"moreblocks:slab_steelblock_1","","moreblocks:slab_steelblock_1",},
+ {"digistuff:touchscreen","mesecons_luacontroller:luacontroller0000","mesecons_lightstone:lightstone_red_off",},
+ {"moreblocks:slab_steelblock_1","","moreblocks:slab_steelblock_1",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:hornstrobe_off",
+ recipe = {
+ {"","mesecons_lightstone:lightstone_white_off","",},
+ {"dye:white","homedecor:speaker_driver","dye:white",},
+ {"","plasticbox:plasticbox","homedecor:ic",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:remotestrobe_off",
+ recipe = {
+ {"","mesecons_lightstone:lightstone_white_off","",},
+ {"dye:white","","dye:white",},
+ {"","plasticbox:plasticbox","homedecor:ic",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:hornstrobe_old_off",
+ recipe = {
+ {"","ilights:light","",},
+ {"dye:white","homedecor:speaker_driver","dye:white",},
+ {"","plasticbox:plasticbox","",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:panel",
+ recipe = {
+ {"moreblocks:slab_steelblock_1","moreblocks:slab_steelblock_1","moreblocks:slab_steelblock_1",},
+ {"moreblocks:slab_steelblock_1","firealarm:annunciator","moreblocks:slab_steelblock_1",},
+ {"moreblocks:slab_steelblock_1","mesecons:wire_00000000_off","moreblocks:slab_steelblock_1",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:pullstation_off",
+ recipe = {
+ {"dye:red","dye:white","dye:red",},
+ {"","mesecons_walllever:wall_lever_off","",},
+ {"","plasticbox:plasticbox","",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:smokedetector_off",
+ recipe = {
+ {"plasticbox:plasticbox","homedecor:ic","plasticbox:plasticbox",},
+ {"homedecor:copper_strip","technic:uranium_lump","homedecor:copper_strip",},
+ {"","plasticbox:plasticbox","mesecons_lightstone:lightstone_red_off",},
+ }
+})
+
+minetest.register_craft({
+ output = "firealarm:smokedetector_off",
+ recipe = {
+ {"plasticbox:plasticbox","homedecor:ic","plasticbox:plasticbox",},
+ {"mesecons_lamp:lamp_off","","mesecons_solarpanel:solar_panel_off",},
+ {"","plasticbox:plasticbox","mesecons_lightstone:lightstone_red_off",},
+ }
+})
+
+minetest.register_lbm({
+ name = "firealarm_decoronly:nuke_formspecs",
+ label = "Remove firealarm device formspecs",
+ nodenames = {"group:firealarm_clearformspec",},
+ action = function(pos)
+ minetest.get_meta(pos):set_string("formspec","")
+ end,
+})