diff --git a/mods/ITEMS/REDSTONE/mcl_target/init.lua b/mods/ITEMS/REDSTONE/mcl_target/init.lua index 268c6ebe3..cd61a04f6 100644 --- a/mods/ITEMS/REDSTONE/mcl_target/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_target/init.lua @@ -27,6 +27,11 @@ minetest.register_node("mcl_target:target_off", { rules = mesecon.rules.alldirs, }, }, + _vl_projectile = { + on_collide = function(projectile, pos, node, node_def) + mcl_target.hit(pos, 1) --10 redstone ticks + end + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, }) @@ -67,4 +72,4 @@ if mod_farming then {"", "mesecons:redstone", ""}, }, }) -end \ No newline at end of file +end diff --git a/mods/ITEMS/REDSTONE/mesecons_button/init.lua b/mods/ITEMS/REDSTONE/mesecons_button/init.lua index 8e2159045..726d1f5e7 100644 --- a/mods/ITEMS/REDSTONE/mesecons_button/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_button/init.lua @@ -151,6 +151,20 @@ function mesecon.register_button(basename, description, texture, recipeitem, sou }}, _mcl_button_basename = basename, _mcl_button_timer = button_timer, + _vl_projectile = { + on_collide = function(projectile, pos, node, node_def) + pos = vector.round(pos) + + -- Push the button! Push, push, push the button! + if node_def.groups.button_push_by_arrow == 1 then + minetest.log("hit"..dump({ + pos = pos, + node = node, + })) + mesecon.push_button(pos, node) + end + end + }, _mcl_blast_resistance = 0.5, _mcl_hardness = 0.5, diff --git a/mods/ITEMS/mcl_bows/arrow.lua b/mods/ITEMS/mcl_bows/arrow.lua index e467cdbf1..d90d5a13d 100644 --- a/mods/ITEMS/mcl_bows/arrow.lua +++ b/mods/ITEMS/mcl_bows/arrow.lua @@ -198,28 +198,11 @@ local arrow_entity = { minetest.sound_play({name="mcl_bows_hit_other", gain=0.3}, {pos=self.object:get_pos(), max_hear_distance=16}, true) - if mcl_burning.is_burning(self.object) and snode.name == "mcl_tnt:tnt" then - tnt.ignite(self._stuckin) - end - - -- Ignite Campfires - if mod_campfire and mcl_burning.is_burning(self.object) and minetest.get_item_group(snode.name, "campfire") ~= 0 then - mcl_campfires.light_campfire(self._stuckin) - end - - -- Activate target - if mod_target and snode.name == "mcl_target:target_off" then - mcl_target.hit(self._stuckin, 1) --10 redstone ticks - end - - -- Push the button! Push, push, push the button! - if mod_button and minetest.get_item_group(node.name, "button") > 0 and minetest.get_item_group(node.name, "button_push_by_arrow") == 1 then - local bdir = minetest.wallmounted_to_dir(node.param2) - -- Check the button orientation - if vector.equals(vector.add(dpos, bdir), self._stuckin) then - mesecon.push_button(dpos, node) - end - end + -- Temporary handler here to test moving this to node definitions. + -- TODO: move to vl_projectile when the stuck logic gets moved there and before merging + -- Trigger hits on the node the projectile hit + local hook = sdef._vl_projectile and sdef._vl_projectile.on_collide + if hook then hook(self, self._stuckin, snode, sdef) end end, on_collide_with_entity = function(self, pos, obj) local is_player = obj:is_player() diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index bacbdeccc..34f800b32 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -261,6 +261,14 @@ function mcl_campfires.register_campfire(name, def) }, _mcl_blast_resistance = 2, _mcl_hardness = 2, + _vl_projectile = { + on_collide = function(projectile, pos, node, node_def) + -- Ignite Campfires + if mcl_burning.is_burning(projectile) then + mcl_campfires.light_campfire(pos) + end + end + }, after_dig_node = function(pos, node, oldmeta, digger) campfire_drops(pos, digger, def.drops, name.."_lit") end, diff --git a/mods/ITEMS/mcl_tnt/init.lua b/mods/ITEMS/mcl_tnt/init.lua index a839611b9..db32726ea 100644 --- a/mods/ITEMS/mcl_tnt/init.lua +++ b/mods/ITEMS/mcl_tnt/init.lua @@ -110,6 +110,13 @@ minetest.register_node("mcl_tnt:tnt", { tnt.ignite(droppos) end end, + _vl_projectile = { + on_collide = function(projectile, pos, node, node_def) + if mcl_burning.is_burning(projectile) then + tnt.ignite(pos) + end + end + }, sounds = sounds, })