Fix redstone torch state with block above

This commit is contained in:
Wuzzy 2018-01-22 21:49:20 +01:00
parent db4c860aa8
commit c9b731b8f9
3 changed files with 8 additions and 4 deletions

View file

@ -154,6 +154,8 @@ These groups are used mostly for informational purposes
* `pressure_plate=2`: Wooden pressure (on) * `pressure_plate=2`: Wooden pressure (on)
* `button=1`: Button (off) * `button=1`: Button (off)
* `button=2`: Button (on) * `button=2`: Button (on)
* `redstone_torch=1`: Redstone Torch (lit)
* `redstone_torch=2`: Redstone Torch (unlit)
* `plant=1`: Plant or part of a plant * `plant=1`: Plant or part of a plant
* `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part * `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part

View file

@ -60,7 +60,8 @@ mesecon.on_placenode = function(pos, node)
local nnode = minetest.get_node(npos) local nnode = minetest.get_node(npos)
if mesecon.is_conductor_off(nnode) then if mesecon.is_conductor_off(nnode) then
mesecon.receptor_on(npos, mesecon.conductor_get_rules(nnode)) mesecon.receptor_on(npos, mesecon.conductor_get_rules(nnode))
elseif mesecon.is_effector_off(nnode.name) then -- Redstone torch is a special case and must be ignored
elseif mesecon.is_effector_on(nnode.name) and minetest.get_item_group(nnode.name, "redstone_torch") == 0 then
mesecon.changesignal(npos, nnode, neighbors[n].link, mesecon.state.on, 1) mesecon.changesignal(npos, nnode, neighbors[n].link, mesecon.state.on, 1)
mesecon.activate(npos, nnode, neighbors[n].link, 1) mesecon.activate(npos, nnode, neighbors[n].link, 1)
end end
@ -84,7 +85,8 @@ mesecon.on_dignode = function(pos, node)
local nnode = minetest.get_node(npos) local nnode = minetest.get_node(npos)
if mesecon.is_conductor_on(nnode) then if mesecon.is_conductor_on(nnode) then
mesecon.receptor_off(npos, mesecon.conductor_get_rules(nnode)) mesecon.receptor_off(npos, mesecon.conductor_get_rules(nnode))
elseif mesecon.is_effector_on(nnode.name) and mesecon.is_powered(npos) == false then -- Redstone torch is a special case and must be ignored
elseif mesecon.is_effector_on(nnode.name) and mesecon.is_powered(npos) == false and minetest.get_item_group(nnode.name, "redstone_torch") == 0 then
mesecon.changesignal(npos, nnode, nlink, mesecon.state.off, 1) mesecon.changesignal(npos, nnode, nlink, mesecon.state.off, 1)
mesecon.deactivate(npos, nnode, nlink, 1) mesecon.deactivate(npos, nnode, nlink, 1)
end end

View file

@ -79,7 +79,7 @@ mcl_torches.register_torch("mesecon_torch_off", "Redstone Torch (off)",
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
{"jeija_torches_off.png"}, {"jeija_torches_off.png"},
0, 0,
{dig_immediate=3, dig_by_water=1, not_in_creative_inventory=1}, {dig_immediate=3, dig_by_water=1, redstone_torch=2, not_in_creative_inventory=1},
mcl_sounds.node_sound_wood_defaults(), mcl_sounds.node_sound_wood_defaults(),
{ {
mesecons = { mesecons = {
@ -109,7 +109,7 @@ mcl_torches.register_torch("mesecon_torch_on", "Redstone Torch",
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
{"jeija_torches_on.png"}, {"jeija_torches_on.png"},
7, 7,
{dig_immediate=3, dig_by_water=1,}, {dig_immediate=3, dig_by_water=1, redstone_torch=1},
mcl_sounds.node_sound_wood_defaults(), mcl_sounds.node_sound_wood_defaults(),
{ {
mesecons = { mesecons = {