From a62b5de79e7464dbaca8458ccbb7715341e21c06 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 13 May 2018 00:23:34 +0200 Subject: [PATCH] Cake+cauldron+endportalfr. put signal 4 comparator --- GROUPS.md | 1 + mods/ITEMS/REDSTONE/mcl_comparators/init.lua | 18 +++++++++++++----- mods/ITEMS/mcl_cake/init.lua | 16 ++++++++-------- mods/ITEMS/mcl_cauldrons/init.lua | 2 +- mods/ITEMS/mcl_portals/portal_end.lua | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/GROUPS.md b/GROUPS.md index cf595783e..57c90eb43 100644 --- a/GROUPS.md +++ b/GROUPS.md @@ -55,6 +55,7 @@ Please read to learn how digging times * `cauldron`: Cauldron. 1: Empty. 2-4: Water height * `anvil`: Anvil. 1: No damage. 2-3: Higher damage levels * `no_rename=1`: Item cannot be renamed by anvil +* `comparator_signal=X`: If set, this node outputs a constant (!) comparator signal output of strength X. #### Footnotes diff --git a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua index c36c2f181..c25793f3d 100644 --- a/mods/ITEMS/REDSTONE/mcl_comparators/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_comparators/init.lua @@ -53,7 +53,7 @@ local comparator_deactivate = function(pos, node) end --- wether pos has an inventory that contains at least one item +-- weather pos has an inventory that contains at least one item local container_inventory_nonempty = function(pos) local invnode = minetest.get_node(pos) local invnodedef = minetest.registered_nodes[invnode.name] @@ -75,13 +75,21 @@ local container_inventory_nonempty = function(pos) return false end +-- weather pos has an constant signal output for the comparator +local static_signal_output = function(pos) + local node = minetest.get_node(pos) + local g = minetest.get_item_group(node.name, "comparator_signal") + return g > 0 +end + -- whether the comparator should be on according to its inputs local comparator_desired_on = function(pos, node) local my_input_rules = comparator_get_input_rules(node); local back_rule = my_input_rules[1] local state if back_rule then - state = mesecon.is_power_on(vector.add(pos, back_rule)) or container_inventory_nonempty(vector.add(pos, back_rule)) + local back_pos = vector.add(pos, back_rule) + state = mesecon.is_power_on(back_pos) or container_inventory_nonempty(back_pos) or static_signal_output(back_pos) end -- if back input if off, we don't need to check side inputs @@ -307,19 +315,19 @@ minetest.register_craft({ -- Register active block handlers minetest.register_abm({ - label = "Comparator check for containers", + label = "Comparator signal input check (comparator is off)", nodenames = { "mcl_comparators:comparator_off_comp", "mcl_comparators:comparator_off_sub", }, - neighbors = {"group:container"}, + neighbors = {"group:container", "group:comparator_signal"}, interval = 1, chance = 1, action = update_self, }) minetest.register_abm({ - label = "Comparator check for no containers", + label = "Comparator signal input check (comparator is on)", nodenames = { "mcl_comparators:comparator_on_comp", "mcl_comparators:comparator_on_sub", diff --git a/mods/ITEMS/mcl_cake/init.lua b/mods/ITEMS/mcl_cake/init.lua index 4683ce757..fdc110154 100644 --- a/mods/ITEMS/mcl_cake/init.lua +++ b/mods/ITEMS/mcl_cake/init.lua @@ -46,7 +46,7 @@ minetest.register_node("mcl_cake:cake", { fixed = full_cake }, stack_max = 1, - groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1}, + groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1, comparator_signal=14}, drop = '', on_rightclick = function(pos, node, clicker, itemstack) local newcake = minetest.do_item_eat(2, ItemStack("mcl_cake:cake_6"), ItemStack("mcl_cake:cake"), clicker, {type="nothing"}) @@ -102,7 +102,7 @@ local register_slice = function(level, nodebox, desc) type = "fixed", fixed = nodebox, }, - groups = {handy=1, cake=level, food=2,no_eat_delay=1,attached_node=1,not_in_creative_inventory=1,dig_by_piston=1}, + groups = {handy=1, cake=level, food=2,no_eat_delay=1,attached_node=1,not_in_creative_inventory=1,dig_by_piston=1,comparator_signal=level*2}, drop = '', on_rightclick = on_rightclick, sounds = mcl_sounds.node_sound_leaves_defaults(), @@ -118,9 +118,9 @@ local register_slice = function(level, nodebox, desc) end end -register_slice(6, slice_6, "Cake (6 Slices Left") -register_slice(5, slice_5, "Cake (5 Slices Left") -register_slice(4, slice_4, "Cake (4 Slices Left") -register_slice(3, slice_3, "Cake (3 Slices Left") -register_slice(2, slice_2, "Cake (2 Slices Left") -register_slice(1, slice_1, "Cake (1 Slice Left") +register_slice(6, slice_6, "Cake (6 Slices Left)") +register_slice(5, slice_5, "Cake (5 Slices Left)") +register_slice(4, slice_4, "Cake (4 Slices Left)") +register_slice(3, slice_3, "Cake (3 Slices Left)") +register_slice(2, slice_2, "Cake (2 Slices Left)") +register_slice(1, slice_1, "Cake (1 Slice Left)") diff --git a/mods/ITEMS/mcl_cauldrons/init.lua b/mods/ITEMS/mcl_cauldrons/init.lua index 8ccd6ce45..0b447155c 100644 --- a/mods/ITEMS/mcl_cauldrons/init.lua +++ b/mods/ITEMS/mcl_cauldrons/init.lua @@ -79,7 +79,7 @@ local register_filled_cauldron = function(water_level, description, river_water) drawtype = "nodebox", paramtype = "light", is_ground_content = false, - groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level)}, + groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), comparator_signal=water_level}, node_box = cauldron_nodeboxes[water_level], collision_box = cauldron_nodeboxes[0], selection_box = { type = "regular" }, diff --git a/mods/ITEMS/mcl_portals/portal_end.lua b/mods/ITEMS/mcl_portals/portal_end.lua index b005a2409..a83b42b2e 100644 --- a/mods/ITEMS/mcl_portals/portal_end.lua +++ b/mods/ITEMS/mcl_portals/portal_end.lua @@ -309,7 +309,7 @@ minetest.register_node("mcl_portals:end_portal_frame", { minetest.register_node("mcl_portals:end_portal_frame_eye", { description = "End Portal Frame with Eye of Ender", _doc_items_create_entry = false, - groups = { creative_breakable = 1, not_in_creative_inventory = 1 }, + groups = { creative_breakable = 1, not_in_creative_inventory = 1, comparator_signal = 15 }, tiles = { "mcl_portals_endframe_top.png^[lowpart:75:mcl_portals_endframe_eye.png", "mcl_portals_endframe_bottom.png", "mcl_portals_endframe_eye.png^mcl_portals_endframe_side.png" }, paramtype2 = "facedir", drawtype = "nodebox",