From c9b731b8f925ec6f2952e4c3216307ab2f0a9a02 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 22 Jan 2018 21:49:20 +0100 Subject: [PATCH] Fix redstone torch state with block above --- GROUPS.md | 2 ++ mods/ITEMS/REDSTONE/mesecons/services.lua | 6 ++++-- mods/ITEMS/REDSTONE/mesecons_torch/init.lua | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/GROUPS.md b/GROUPS.md index 8e21ecc24..688441d0a 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -154,6 +154,8 @@ These groups are used mostly for informational purposes * `pressure_plate=2`: Wooden pressure (on) * `button=1`: Button (off) * `button=2`: Button (on) +* `redstone_torch=1`: Redstone Torch (lit) +* `redstone_torch=2`: Redstone Torch (unlit) * `plant=1`: Plant or part of a plant * `double_plant`: Part of a double-sized plant. 1 = lower part, 2 = upper part diff --git a/mods/ITEMS/REDSTONE/mesecons/services.lua b/mods/ITEMS/REDSTONE/mesecons/services.lua index 9de9cb462..3b75010f1 100644 --- a/mods/ITEMS/REDSTONE/mesecons/services.lua +++ b/mods/ITEMS/REDSTONE/mesecons/services.lua @@ -60,7 +60,8 @@ mesecon.on_placenode = function(pos, node) local nnode = minetest.get_node(npos) if mesecon.is_conductor_off(nnode) then 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.activate(npos, nnode, neighbors[n].link, 1) end @@ -84,7 +85,8 @@ mesecon.on_dignode = function(pos, node) local nnode = minetest.get_node(npos) if mesecon.is_conductor_on(nnode) then 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.deactivate(npos, nnode, nlink, 1) end diff --git a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua index fb0226461..c40bef610 100644 --- a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua @@ -79,7 +79,7 @@ mcl_torches.register_torch("mesecon_torch_off", "Redstone Torch (off)", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", {"jeija_torches_off.png"}, 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(), { mesecons = { @@ -109,7 +109,7 @@ mcl_torches.register_torch("mesecon_torch_on", "Redstone Torch", "mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj", {"jeija_torches_on.png"}, 7, - {dig_immediate=3, dig_by_water=1,}, + {dig_immediate=3, dig_by_water=1, redstone_torch=1}, mcl_sounds.node_sound_wood_defaults(), { mesecons = {