mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-01-09 17:30:24 +01:00
Wireless: make an "on" version of the wireless node
This avoids self-activating bugs
This commit is contained in:
parent
5422017493
commit
ae9935fcca
@ -125,6 +125,7 @@ end
|
|||||||
|
|
||||||
local is_jammed
|
local is_jammed
|
||||||
local function wireless_activate(pos)
|
local function wireless_activate(pos)
|
||||||
|
print("activating wireless at pos " .. minetest.pos_to_string(pos))
|
||||||
if is_jammed(pos) then
|
if is_jammed(pos) then
|
||||||
-- jamming doesn't disallow receiving signals, only sending them
|
-- jamming doesn't disallow receiving signals, only sending them
|
||||||
return
|
return
|
||||||
@ -138,8 +139,10 @@ local function wireless_activate(pos)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.swap_node(pos, {name = "moremesecons_wireless:wireless_on"})
|
||||||
for i, wl_pos in ipairs(wireless[owner][channel]) do
|
for i, wl_pos in ipairs(wireless[owner][channel]) do
|
||||||
if i ~= id then
|
if i ~= id then
|
||||||
|
minetest.swap_node(wl_pos, {name = "moremesecons_wireless:wireless_on"})
|
||||||
mesecon.receptor_on(wl_pos)
|
mesecon.receptor_on(wl_pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -158,8 +161,10 @@ local function wireless_deactivate(pos)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.swap_node(pos, {name = "moremesecons_wireless:wireless_off"})
|
||||||
for i, wl_pos in ipairs(wireless[owner][channel]) do
|
for i, wl_pos in ipairs(wireless[owner][channel]) do
|
||||||
if i ~= id then
|
if i ~= id then
|
||||||
|
minetest.swap_node(wl_pos, {name = "moremesecons_wireless:wireless_off"})
|
||||||
mesecon.receptor_off(wl_pos)
|
mesecon.receptor_off(wl_pos)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -186,17 +191,10 @@ local function on_digiline_receive(pos, node, channel, msg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("moremesecons_wireless:wireless", {
|
mesecon.register_node("moremesecons_wireless:wireless", {
|
||||||
tiles = {"moremesecons_wireless.png"},
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
description = "Wireless",
|
description = "Wireless",
|
||||||
walkable = true,
|
|
||||||
groups = {cracky=3},
|
|
||||||
mesecons = {effector = {
|
|
||||||
action_on = wireless_activate,
|
|
||||||
action_off = wireless_deactivate
|
|
||||||
}},
|
|
||||||
digiline = {
|
digiline = {
|
||||||
receptor = {},
|
receptor = {},
|
||||||
effector = {
|
effector = {
|
||||||
@ -237,8 +235,22 @@ minetest.register_node("moremesecons_wireless:wireless", {
|
|||||||
update_mod_storage()
|
update_mod_storage()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
}, {
|
||||||
|
tiles = {"moremesecons_wireless_off.png"},
|
||||||
|
groups = {cracky=3},
|
||||||
|
mesecons = {effector = {
|
||||||
|
action_on = wireless_activate,
|
||||||
|
}},
|
||||||
|
}, {
|
||||||
|
tiles = {"moremesecons_wireless_on.png"},
|
||||||
|
groups = {cracky=3, not_in_creative_inventory=1},
|
||||||
|
mesecons = {effector = {
|
||||||
|
action_off = wireless_deactivate
|
||||||
|
}},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_alias("moremesecons_wireless:wireless", "moremesecons_wireless:wireless_off")
|
||||||
|
|
||||||
local jammers = {}
|
local jammers = {}
|
||||||
local function add_jammer(pos)
|
local function add_jammer(pos)
|
||||||
if get(jammers, pos.z,pos.y,pos.x) then
|
if get(jammers, pos.z,pos.y,pos.x) then
|
||||||
@ -345,7 +357,7 @@ minetest.register_craft({
|
|||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "moremesecons_wireless:wireless 2",
|
output = "moremesecons_wireless:wireless_off 2",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
|
{"group:mesecon_conductor_craftable", "", "group:mesecon_conductor_craftable"},
|
||||||
{"", "mesecons_torch:mesecon_torch_on", ""},
|
{"", "mesecons_torch:mesecon_torch_on", ""},
|
||||||
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
BIN
moremesecons_wireless/textures/moremesecons_wireless_on.png
Normal file
BIN
moremesecons_wireless/textures/moremesecons_wireless_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
Loading…
Reference in New Issue
Block a user