Browse Source

Cake+cauldron+endportalfr. put signal 4 comparator

Wuzzy 10 months ago
parent
commit
a62b5de79e

+ 1
- 0
GROUPS.md View File

@@ -55,6 +55,7 @@ Please read <http://minecraft.gamepedia.com/Breaking> to learn how digging times
55 55
 * `cauldron`: Cauldron. 1: Empty. 2-4: Water height
56 56
 * `anvil`: Anvil. 1: No damage. 2-3: Higher damage levels
57 57
 * `no_rename=1`: Item cannot be renamed by anvil
58
+* `comparator_signal=X`: If set, this node outputs a constant (!) comparator signal output of strength X.
58 59
 
59 60
 #### Footnotes
60 61
 

+ 13
- 4
mods/ITEMS/REDSTONE/mcl_comparators/init.lua View File

@@ -53,7 +53,7 @@ local comparator_deactivate = function(pos, node)
53 53
 end
54 54
 
55 55
 
56
+-- weather pos has an inventory that contains at least one item
56 57
 local container_inventory_nonempty = function(pos)
57 58
 	local invnode = minetest.get_node(pos)
58 59
 	local invnodedef = minetest.registered_nodes[invnode.name]
@@ -75,13 +75,21 @@ local container_inventory_nonempty = function(pos)
75 75
 	return false
76 76
 end
77 77
 
78
+-- weather pos has an constant signal output for the comparator
79
+local static_signal_output = function(pos)
80
+	local node = minetest.get_node(pos)
81
+	local g = minetest.get_item_group(node.name, "comparator_signal")
82
+	return g > 0
83
+end
84
+
78 85
 -- whether the comparator should be on according to its inputs
79 86
 local comparator_desired_on = function(pos, node)
80 87
 	local my_input_rules = comparator_get_input_rules(node);
81 88
 	local back_rule = my_input_rules[1]
82 89
 	local state
83 90
 	if back_rule then
84
-		state = mesecon.is_power_on(vector.add(pos, back_rule)) or container_inventory_nonempty(vector.add(pos, back_rule))
91
+		local back_pos = vector.add(pos, back_rule)
92
+		state = mesecon.is_power_on(back_pos) or container_inventory_nonempty(back_pos) or static_signal_output(back_pos)
85 93
 	end
86 94
 
87 95
 	-- if back input if off, we don't need to check side inputs
@@ -307,19 +315,19 @@ minetest.register_craft({
307 315
 
308 316
 -- Register active block handlers
309 317
 minetest.register_abm({
310
-	label = "Comparator check for containers",
318
+	label = "Comparator signal input check (comparator is off)",
311 319
 	nodenames = {
312 320
 		"mcl_comparators:comparator_off_comp",
313 321
 		"mcl_comparators:comparator_off_sub",
314 322
 	},
315
-	neighbors = {"group:container"},
323
+	neighbors = {"group:container", "group:comparator_signal"},
316 324
 	interval = 1,
317 325
 	chance = 1,
318 326
 	action = update_self,
319 327
 })
320 328
 
321 329
 minetest.register_abm({
322
-	label = "Comparator check for no containers",
330
+	label = "Comparator signal input check (comparator is on)",
323 331
 	nodenames = {
324 332
 		"mcl_comparators:comparator_on_comp",
325 333
 		"mcl_comparators:comparator_on_sub",

+ 8
- 8
mods/ITEMS/mcl_cake/init.lua View File

@@ -46,7 +46,7 @@ minetest.register_node("mcl_cake:cake", {
46 46
 		fixed = full_cake
47 47
 	},
48 48
 	stack_max = 1,
49
-	groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1},
49
+	groups = {handy=1, cake=7, food=2,no_eat_delay=1, attached_node=1, dig_by_piston=1, comparator_signal=14},
50 50
 	drop = '',
51 51
 	on_rightclick = function(pos, node, clicker, itemstack)
52 52
 		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)
102 102
 			type = "fixed",
103 103
 			fixed = nodebox,
104 104
 			},
105
-		groups = {handy=1, cake=level, food=2,no_eat_delay=1,attached_node=1,not_in_creative_inventory=1,dig_by_piston=1},
105
+		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},
106 106
 		drop = '',
107 107
 		on_rightclick = on_rightclick,
108 108
 		sounds = mcl_sounds.node_sound_leaves_defaults(),
@@ -118,9 +118,9 @@ local register_slice = function(level, nodebox, desc)
118 118
 	end
119 119
 end
120 120
 
121
-register_slice(6, slice_6, "Cake (6 Slices Left")
122
-register_slice(5, slice_5, "Cake (5 Slices Left")
123
-register_slice(4, slice_4, "Cake (4 Slices Left")
124
-register_slice(3, slice_3, "Cake (3 Slices Left")
125
-register_slice(2, slice_2, "Cake (2 Slices Left")
126
-register_slice(1, slice_1, "Cake (1 Slice Left")
121
+register_slice(6, slice_6, "Cake (6 Slices Left)")
122
+register_slice(5, slice_5, "Cake (5 Slices Left)")
123
+register_slice(4, slice_4, "Cake (4 Slices Left)")
124
+register_slice(3, slice_3, "Cake (3 Slices Left)")
125
+register_slice(2, slice_2, "Cake (2 Slices Left)")
126
+register_slice(1, slice_1, "Cake (1 Slice Left)")

+ 1
- 1
mods/ITEMS/mcl_cauldrons/init.lua View File

@@ -79,7 +79,7 @@ local register_filled_cauldron = function(water_level, description, river_water)
79 79
 		drawtype = "nodebox",
80 80
 		paramtype = "light",
81 81
 		is_ground_content = false,
82
-		groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level)},
82
+		groups = {pickaxey=1, not_in_creative_inventory=1, cauldron=(1+water_level), comparator_signal=water_level},
83 83
 		node_box = cauldron_nodeboxes[water_level],
84 84
 		collision_box = cauldron_nodeboxes[0],
85 85
 		selection_box = { type = "regular" },

+ 1
- 1
mods/ITEMS/mcl_portals/portal_end.lua View File

@@ -309,7 +309,7 @@ minetest.register_node("mcl_portals:end_portal_frame", {
309 309
 minetest.register_node("mcl_portals:end_portal_frame_eye", {
310 310
 	description = "End Portal Frame with Eye of Ender",
311 311
 	_doc_items_create_entry = false,
312
-	groups = { creative_breakable = 1, not_in_creative_inventory = 1 },
312
+	groups = { creative_breakable = 1, not_in_creative_inventory = 1, comparator_signal = 15 },
313 313
 	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" },
314 314
 	paramtype2 = "facedir",
315 315
 	drawtype = "nodebox",

Loading…
Cancel
Save