forked from mtcontrib/scifi_nodes
optional mesecons dependency
This commit is contained in:
parent
45d275eecf
commit
d803f17ba5
13
digicode.lua
13
digicode.lua
@ -2,6 +2,7 @@
|
||||
--------------
|
||||
-- Digicode --
|
||||
--------------
|
||||
local has_mesecons = minetest.get_modpath("mesecons")
|
||||
|
||||
local secret_code = "1234"
|
||||
local allowed_chars = "0123456789"
|
||||
@ -122,7 +123,11 @@ minetest.register_node("scifi_nodes:digicode_on", {
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
drop = {items = {"scifi_nodes:digicode_off"}},
|
||||
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.on)
|
||||
}
|
||||
},
|
||||
on_timer = toggle_digicode,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
@ -140,7 +145,11 @@ minetest.register_node("scifi_nodes:digicode_off", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
mesecons = {receptor = {state = mesecon.state.off,}},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.off)
|
||||
}
|
||||
},
|
||||
after_place_node = set_owner,
|
||||
on_rightclick = show_digicode_formspec,
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
|
4
mod.conf
4
mod.conf
@ -1,4 +1,4 @@
|
||||
name = scifi_nodes
|
||||
description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||
depends = default,dye,basic_materials, mesecons
|
||||
optional_depends = xpanes,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
||||
depends = default,dye
|
||||
optional_depends = xpanes,mesecons,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver,basic_materials
|
||||
|
@ -7,6 +7,8 @@
|
||||
-- re-use all the parameters in same order ! --
|
||||
-----------------------------------------------
|
||||
|
||||
local has_mesecons = minetest.get_modpath("mesecons")
|
||||
|
||||
-- after_place_node
|
||||
-- placer is a player object
|
||||
local function set_scanner_owner(pos, placer, itemstack, pointed_thing)
|
||||
@ -69,9 +71,13 @@ minetest.register_node("scifi_nodes:palm_scanner_off", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
mesecons = {receptor = {state = mesecon.state.off,}},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.off)
|
||||
}
|
||||
},
|
||||
after_place_node = set_scanner_owner,
|
||||
on_rightclick = toggle_palm_scanner,
|
||||
on_rightclick = (has_mesecons and toggle_palm_scanner),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
@ -109,8 +115,12 @@ minetest.register_node("scifi_nodes:palm_scanner_on", {
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
drop = "scifi_nodes:palm_scanner_off",
|
||||
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||
on_timer = toggle_palm_scanner,
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.on)
|
||||
}
|
||||
},
|
||||
on_timer = (has_mesecons and toggle_palm_scanner),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
|
20
switches.lua
20
switches.lua
@ -3,6 +3,8 @@
|
||||
-- Switches --
|
||||
--------------
|
||||
|
||||
local has_mesecons = minetest.get_modpath("mesecons")
|
||||
|
||||
local function toggle_switch(pos)
|
||||
local node = minetest.get_node(pos)
|
||||
local name = node.name
|
||||
@ -32,10 +34,14 @@ minetest.register_node("scifi_nodes:switch_on", {
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 5,
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||
mesecons = {receptor = {state = mesecon.state.on,}},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.on)
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_rightclick = toggle_switch,
|
||||
on_timer = toggle_switch
|
||||
on_rightclick = (has_mesecons and toggle_switch),
|
||||
on_timer = (has_mesecons and toggle_switch)
|
||||
})
|
||||
|
||||
minetest.register_node("scifi_nodes:switch_off", {
|
||||
@ -51,9 +57,13 @@ minetest.register_node("scifi_nodes:switch_off", {
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
||||
mesecons = {receptor = {state = mesecon.state.off,}},
|
||||
mesecons = {
|
||||
receptor = {
|
||||
state = (has_mesecons and mesecon.state.off)
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_rightclick = toggle_switch
|
||||
on_rightclick = (has_mesecons and toggle_switch)
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
Loading…
Reference in New Issue
Block a user