From 45e4ebf6074d13caa1d9d7e264c42ce950b745fe Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 18 Apr 2024 15:44:04 -0400 Subject: [PATCH] Make bugs only pointable with Bug Net * Add legacy compatibility making to work with older clients * backported https://github.com/minetest/minetest_game/pull/3099 * backported commit https://github.com/minetest/minetest_game/commit/ef788d0307e3bbcc6a7d1a903bc2ddfd920baf49 --- mods/butterflies/init.lua | 3 +++ mods/butterflies/mod.conf | 1 + mods/fireflies/init.lua | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/mods/butterflies/init.lua b/mods/butterflies/init.lua index 29bb96e..6d88482 100644 --- a/mods/butterflies/init.lua +++ b/mods/butterflies/init.lua @@ -2,6 +2,8 @@ -- Load support for MT game translation. local S = minetest.get_translator("butterflies") +-- Legacy compatibility, when pointabilities don't exist, pointable is set to true. +local pointable_compat = not minetest.features.item_specific_pointabilities -- register butterflies local butter_list = { @@ -33,6 +35,7 @@ for i in ipairs (butter_list) do sunlight_propagates = true, buildable_to = true, walkable = false, + pointable = pointable_compat, groups = {catchable = 1}, selection_box = { type = "fixed", diff --git a/mods/butterflies/mod.conf b/mods/butterflies/mod.conf index 1c66497..d0380e1 100644 --- a/mods/butterflies/mod.conf +++ b/mods/butterflies/mod.conf @@ -1,3 +1,4 @@ name = butterflies description = Minetest Game mod: Butterflies depends = default, flowers +optional_depends = fireflies diff --git a/mods/fireflies/init.lua b/mods/fireflies/init.lua index a28fd12..7359f26 100644 --- a/mods/fireflies/init.lua +++ b/mods/fireflies/init.lua @@ -6,6 +6,8 @@ local S = minetest.get_translator("fireflies") local m_eth = minetest.get_modpath("ethereal") -- detecting cretive engine over creative privilegies local m_cre = minetest.get_modpath("creative") +-- Legacy compatibility, when pointabilities don't exist, pointable is set to true. +local pointable_compat = not minetest.features.item_specific_pointabilities -- firefly minetest.register_node("fireflies:firefly", { @@ -27,6 +29,7 @@ minetest.register_node("fireflies:firefly", { sunlight_propagates = true, buildable_to = true, walkable = false, + pointable = pointable_compat, groups = {catchable = 1}, selection_box = { type = "fixed", @@ -95,6 +98,7 @@ minetest.register_node("fireflies:hidden_firefly", { minetest.register_tool("fireflies:bug_net", { description = S("Bug Net"), inventory_image = "fireflies_bugnet.png", + pointabilities = {nodes = {["group:catchable"] = true}}, on_use = function(itemstack, player, pointed_thing) if not pointed_thing or pointed_thing.type ~= "node" or minetest.is_protected(pointed_thing.under, player:get_player_name()) then