mesecons receptor step

This commit is contained in:
NatureFreshMilk 2019-07-30 13:17:41 +02:00
parent 32332d2148
commit afb4c3acc4
6 changed files with 39 additions and 7 deletions

View File

@ -17,5 +17,6 @@ read_globals = {
"dump", "VoxelArea",
-- Deps
"unified_inventory", "default", "xp_redo"
"unified_inventory", "default", "xp_redo",
"mesecon"
}

View File

@ -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)

View File

@ -11,3 +11,5 @@ mobs_crocs?
mobs_jellyfish?
mobs_sharks?
mobs_turtles?
mesecons?

View File

@ -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

View File

@ -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")

View File

@ -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
})