mirror of
https://github.com/D00Med/scifi_nodes.git
synced 2024-12-22 16:10:18 +01:00
optional mesecons dependency
This commit is contained in:
parent
45d275eecf
commit
d803f17ba5
13
digicode.lua
13
digicode.lua
@ -2,6 +2,7 @@
|
|||||||
--------------
|
--------------
|
||||||
-- Digicode --
|
-- Digicode --
|
||||||
--------------
|
--------------
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
local secret_code = "1234"
|
local secret_code = "1234"
|
||||||
local allowed_chars = "0123456789"
|
local allowed_chars = "0123456789"
|
||||||
@ -122,7 +123,11 @@ minetest.register_node("scifi_nodes:digicode_on", {
|
|||||||
light_source = 5,
|
light_source = 5,
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||||
drop = {items = {"scifi_nodes:digicode_off"}},
|
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,
|
on_timer = toggle_digicode,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
@ -140,7 +145,11 @@ minetest.register_node("scifi_nodes:digicode_off", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
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,
|
after_place_node = set_owner,
|
||||||
on_rightclick = show_digicode_formspec,
|
on_rightclick = show_digicode_formspec,
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
|
4
mod.conf
4
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = scifi_nodes
|
name = scifi_nodes
|
||||||
description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
description = Minetest mod that adds scifi themed blocks, doors, materials, plants and other assets.
|
||||||
depends = default,dye,basic_materials, mesecons
|
depends = default,dye
|
||||||
optional_depends = xpanes,moreblocks,mesecons_microcontroller,mesecons_button,mesecons_torch,mesecons_receiver
|
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 ! --
|
-- re-use all the parameters in same order ! --
|
||||||
-----------------------------------------------
|
-----------------------------------------------
|
||||||
|
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
-- after_place_node
|
-- after_place_node
|
||||||
-- placer is a player object
|
-- placer is a player object
|
||||||
local function set_scanner_owner(pos, placer, itemstack, pointed_thing)
|
local function set_scanner_owner(pos, placer, itemstack, pointed_thing)
|
||||||
@ -47,7 +49,7 @@ local function check_owner(pos, elapsed)
|
|||||||
if clicker == owner then
|
if clicker == owner then
|
||||||
minetest.sound_play("scifi_nodes_scanner_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
minetest.sound_play("scifi_nodes_scanner_granted", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
minetest.chat_send_player(clicker, "Access granted !")
|
minetest.chat_send_player(clicker, "Access granted !")
|
||||||
toggle_palm_scanner (pos)
|
toggle_palm_scanner(pos)
|
||||||
else
|
else
|
||||||
minetest.chat_send_player(clicker, "Access refused !")
|
minetest.chat_send_player(clicker, "Access refused !")
|
||||||
minetest.sound_play("scifi_nodes_scanner_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
minetest.sound_play("scifi_nodes_scanner_refused", {max_hear_distance = 8, pos = pos, gain = 1.0})
|
||||||
@ -69,9 +71,13 @@ minetest.register_node("scifi_nodes:palm_scanner_off", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
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,
|
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(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -109,8 +115,12 @@ minetest.register_node("scifi_nodes:palm_scanner_on", {
|
|||||||
light_source = 5,
|
light_source = 5,
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
||||||
drop = "scifi_nodes:palm_scanner_off",
|
drop = "scifi_nodes:palm_scanner_off",
|
||||||
mesecons = {receptor = {state = mesecon.state.on,}},
|
mesecons = {
|
||||||
on_timer = toggle_palm_scanner,
|
receptor = {
|
||||||
|
state = (has_mesecons and mesecon.state.on)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_timer = (has_mesecons and toggle_palm_scanner),
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
20
switches.lua
20
switches.lua
@ -3,6 +3,8 @@
|
|||||||
-- Switches --
|
-- Switches --
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
local has_mesecons = minetest.get_modpath("mesecons")
|
||||||
|
|
||||||
local function toggle_switch(pos)
|
local function toggle_switch(pos)
|
||||||
local node = minetest.get_node(pos)
|
local node = minetest.get_node(pos)
|
||||||
local name = node.name
|
local name = node.name
|
||||||
@ -32,10 +34,14 @@ minetest.register_node("scifi_nodes:switch_on", {
|
|||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
light_source = 5,
|
light_source = 5,
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, not_in_creative_inventory=1, mesecon_needs_receiver = 1},
|
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(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
on_rightclick = toggle_switch,
|
on_rightclick = (has_mesecons and toggle_switch),
|
||||||
on_timer = toggle_switch
|
on_timer = (has_mesecons and toggle_switch)
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_node("scifi_nodes:switch_off", {
|
minetest.register_node("scifi_nodes:switch_off", {
|
||||||
@ -51,9 +57,13 @@ minetest.register_node("scifi_nodes:switch_off", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
paramtype2 = "wallmounted",
|
||||||
groups = {cracky=1, oddly_breakable_by_hand=1, mesecon_needs_receiver = 1},
|
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(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
on_rightclick = toggle_switch
|
on_rightclick = (has_mesecons and toggle_switch)
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
Loading…
Reference in New Issue
Block a user