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 ef788d0307
This commit is contained in:
mckaygerhard 2024-04-18 15:44:04 -04:00
parent 0ca6bc101a
commit 45e4ebf607
3 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,8 @@
-- Load support for MT game translation. -- Load support for MT game translation.
local S = minetest.get_translator("butterflies") 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 -- register butterflies
local butter_list = { local butter_list = {
@ -33,6 +35,7 @@ for i in ipairs (butter_list) do
sunlight_propagates = true, sunlight_propagates = true,
buildable_to = true, buildable_to = true,
walkable = false, walkable = false,
pointable = pointable_compat,
groups = {catchable = 1}, groups = {catchable = 1},
selection_box = { selection_box = {
type = "fixed", type = "fixed",

View File

@ -1,3 +1,4 @@
name = butterflies name = butterflies
description = Minetest Game mod: Butterflies description = Minetest Game mod: Butterflies
depends = default, flowers depends = default, flowers
optional_depends = fireflies

View File

@ -6,6 +6,8 @@ local S = minetest.get_translator("fireflies")
local m_eth = minetest.get_modpath("ethereal") local m_eth = minetest.get_modpath("ethereal")
-- detecting cretive engine over creative privilegies -- detecting cretive engine over creative privilegies
local m_cre = minetest.get_modpath("creative") 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 -- firefly
minetest.register_node("fireflies:firefly", { minetest.register_node("fireflies:firefly", {
@ -27,6 +29,7 @@ minetest.register_node("fireflies:firefly", {
sunlight_propagates = true, sunlight_propagates = true,
buildable_to = true, buildable_to = true,
walkable = false, walkable = false,
pointable = pointable_compat,
groups = {catchable = 1}, groups = {catchable = 1},
selection_box = { selection_box = {
type = "fixed", type = "fixed",
@ -95,6 +98,7 @@ minetest.register_node("fireflies:hidden_firefly", {
minetest.register_tool("fireflies:bug_net", { minetest.register_tool("fireflies:bug_net", {
description = S("Bug Net"), description = S("Bug Net"),
inventory_image = "fireflies_bugnet.png", inventory_image = "fireflies_bugnet.png",
pointabilities = {nodes = {["group:catchable"] = true}},
on_use = function(itemstack, player, pointed_thing) on_use = function(itemstack, player, pointed_thing)
if not pointed_thing or pointed_thing.type ~= "node" or if not pointed_thing or pointed_thing.type ~= "node" or
minetest.is_protected(pointed_thing.under, player:get_player_name()) then minetest.is_protected(pointed_thing.under, player:get_player_name()) then