1
0
mirror of https://github.com/minetest/minetest_game.git synced 2024-12-22 23:10:17 +01:00

Make bugs only pointable with Bug Net (#3099)

This commit is contained in:
cx384 2024-03-10 17:57:22 +01:00 committed by GitHub
parent 5a80084800
commit ef788d0307
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,9 @@
-- 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 = {
{"white", S("White Butterfly")}, {"white", S("White Butterfly")},
@ -33,6 +36,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

@ -3,6 +3,8 @@
-- Load support for MT game translation. -- Load support for MT game translation.
local S = minetest.get_translator("fireflies") local S = minetest.get_translator("fireflies")
-- Legacy compatibility, when pointabilities don't exist, pointable is set to true.
local pointable_compat = not minetest.features.item_specific_pointabilities
minetest.register_node("fireflies:firefly", { minetest.register_node("fireflies:firefly", {
description = S("Firefly"), description = S("Firefly"),
@ -23,6 +25,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",
@ -91,6 +94,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)
local player_name = player and player:get_player_name() or "" local player_name = player and player:get_player_name() or ""
if not pointed_thing or pointed_thing.type ~= "node" or if not pointed_thing or pointed_thing.type ~= "node" or