0
0
Fork 0

Cake+cauldron+endportalfr. put signal 4 comparator

This commit is contained in:
Wuzzy 2018-05-13 00:23:34 +02:00
parent acd58f6fe5
commit a62b5de79e
5 changed files with 24 additions and 15 deletions

View File

@ -55,6 +55,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> 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

View File

@ -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",

View File

@ -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)")

View File

@ -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" },

View File

@ -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",