diff --git a/.luacheckrc b/.luacheckrc index 995f9ab..53d01d2 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -17,5 +17,6 @@ read_globals = { "dump", "VoxelArea", -- Deps - "unified_inventory", "default", "xp_redo" + "unified_inventory", "default", "xp_redo", + "mesecon" } diff --git a/block.lua b/block.lua index 85a18e1..c98c3c9 100644 --- a/block.lua +++ b/block.lua @@ -9,7 +9,11 @@ minetest.register_node("missions:mission", { "default_gold_block.png^default_paper.png^missions_m_overlay.png", "default_gold_block.png^default_paper.png^missions_m_overlay.png" }, - groups = {cracky=3,oddly_breakable_by_hand=3}, + groups = { + cracky = 3, + oddly_breakable_by_hand = 3, + mesecon_needs_receiver = 1 + }, sounds = default.node_sound_glass_defaults(), after_place_node = function(pos, placer) diff --git a/depends.txt b/depends.txt index 0611de0..21279fc 100644 --- a/depends.txt +++ b/depends.txt @@ -11,3 +11,5 @@ mobs_crocs? mobs_jellyfish? mobs_sharks? mobs_turtles? +mesecons? + diff --git a/executor.lua b/executor.lua index cf9ee0c..58b0b38 100644 --- a/executor.lua +++ b/executor.lua @@ -109,11 +109,12 @@ local update_mission = function(mission, player) if not step.initialized then if spec.on_step_enter then spec.on_step_enter({ - player=player, - step=step, - on_success=on_success, - on_failed=on_failed, - block_meta=block_meta + player = player, + step = step, + on_success = on_success, + on_failed = on_failed, + block_meta = block_meta, + block_pos = block_pos }) end step.initialized = true diff --git a/init.lua b/init.lua index 8895538..f7d27ed 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,7 @@ local has_xp_redo_mod = minetest.get_modpath("xp_redo") local has_mobs_mod = minetest.get_modpath("mobs") local has_unified_inv = minetest.get_modpath("unified_inventory") +local has_mesecons = minetest.get_modpath("mesecons") local MP = minetest.get_modpath("missions") @@ -69,6 +70,10 @@ dofile(MP.."/steps/checkpriv.lua") dofile(MP.."/steps/limitedtries.lua") -- dofile(MP.."/steps/followup.lua") +if has_mesecons then + dofile(MP.."/steps/mesecons_receptor_on.lua") +end + if has_xp_redo_mod then dofile(MP.."/steps/checkxp.lua") dofile(MP.."/steps/givexp.lua") diff --git a/steps/mesecons_receptor_on.lua b/steps/mesecons_receptor_on.lua new file mode 100644 index 0000000..cfba976 --- /dev/null +++ b/steps/mesecons_receptor_on.lua @@ -0,0 +1,19 @@ + +missions.register_step({ + + type = "mesecons_receptor_on", + name = "Emit mesecons signal", + + on_step_enter = function(ctx) + mesecon.receptor_on(ctx.block_pos) + + minetest.after(1, function() + mesecon.receptor_off(ctx.block_pos) + end) + + ctx.on_success() + end + +}) + +