Add a setting for disabling the wireless jammer

Fixes #17
This commit is contained in:
upsilon 2021-03-07 10:23:29 +01:00
parent 227cba54b2
commit 021100b3d4
2 changed files with 75 additions and 70 deletions

View File

@ -330,6 +330,15 @@ mesecon.register_node("moremesecons_wireless:wireless", {
minetest.register_alias("moremesecons_wireless:wireless", "moremesecons_wireless:wireless_off")
minetest.register_craft({
output = "moremesecons_wireless:wireless_off 2",
recipe = {
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
{"", "mesecons_torch:mesecon_torch_on", ""},
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
}
})
local function remove_jammer(pos)
moremesecons.remove_data_from_pos(jammers, pos)
end
@ -357,11 +366,12 @@ function is_jammed(pos)
return false
end
mesecon.register_node("moremesecons_wireless:jammer", {
if moremesecons.setting("wireless", "enable_jammer", true) then
mesecon.register_node("moremesecons_wireless:jammer", {
description = "Wireless Jammer",
paramtype = "light",
drawtype = "nodebox",
},{
},{
tiles = {"mesecons_wire_off.png^moremesecons_jammer_top.png", "moremesecons_jammer_bottom.png", "mesecons_wire_off.png^moremesecons_jammer_side_off.png"},
node_box = {
type = "fixed",
@ -388,7 +398,7 @@ mesecon.register_node("moremesecons_wireless:jammer", {
minetest.swap_node(pos, {name="moremesecons_wireless:jammer_on"})
end
}}
},{
},{
tiles = {"mesecons_wire_on.png^moremesecons_jammer_top.png", "moremesecons_jammer_bottom.png", "mesecons_wire_on.png^moremesecons_jammer_side_on.png"},
node_box = {
type = "fixed",
@ -417,23 +427,15 @@ mesecon.register_node("moremesecons_wireless:jammer", {
}},
on_destruct = remove_jammer,
on_construct = add_jammer,
})
})
minetest.register_craft({
minetest.register_craft({
output = "moremesecons_wireless:jammer_off",
recipe = {
{"moremesecons_wireless:wireless", "mesecons_torch:mesecon_torch_on", "moremesecons_wireless:wireless"}
}
})
minetest.register_craft({
output = "moremesecons_wireless:wireless_off 2",
recipe = {
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
{"", "mesecons_torch:mesecon_torch_on", ""},
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
}
})
})
end
if moremesecons.setting("wireless", "enable_lbm", false) then
minetest.register_lbm({

View File

@ -63,6 +63,9 @@ moremesecons_teleporter.enable_lbm (Enable Registration LBM) bool false
[Wireless]
# Whether to enable the wireless jammer node
moremesecons_wireless.enable_jammer (Enable wireless jammer) bool true
# Wireless Jammer action range
# Any value less than or equal to 0 will be changed to 1 and a NaN value will be changed to the default value
moremesecons_wireless.jammer_max_distance (Wireless Jammer action range) float 15